Skip to content

Commit

Permalink
fix(mediacodec): reset width and height to videoInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
I-m-SuperMan authored and pingkai committed Jun 2, 2020
1 parent 2d1127f commit 400049c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions framework/codec/Android/mediaCodecDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,16 @@ namespace Cicada {
} else if (index == MC_INFO_OUTPUT_FORMAT_CHANGED) {
mc_out out{};
mDecoder->get_out(index, &out, false);
mVideoInfo.height = out.conf.video.height;
mVideoHeight = out.conf.video.height;

if (out.conf.video.crop_bottom != MC_ERROR && out.conf.video.crop_top != MC_ERROR) {
mVideoInfo.height = out.conf.video.crop_bottom + 1 - out.conf.video.crop_top;
mVideoHeight = out.conf.video.crop_bottom + 1 - out.conf.video.crop_top;
}

mVideoInfo.width = out.conf.video.width;
mVideoWidth = out.conf.video.width;

if (out.conf.video.crop_right != MC_ERROR && out.conf.video.crop_left != MC_ERROR) {
mVideoInfo.width = out.conf.video.crop_right + 1 - out.conf.video.crop_left;
mVideoWidth = out.conf.video.crop_right + 1 - out.conf.video.crop_left;
}

return -EAGAIN;
Expand All @@ -256,7 +256,9 @@ namespace Cicada {
mDecoder->release_out(index, render);
}));
// AF_LOGD("mediacodec out pts %" PRId64, out.buf.pts);
pFrame->getInfo().video = mVideoInfo;
pFrame->getInfo().video.width = mVideoWidth;
pFrame->getInfo().video.height = mVideoHeight;

pFrame->getInfo().pts = out.buf.pts != -1 ? out.buf.pts : INT64_MIN;

if (out.b_eos) {
Expand Down
3 changes: 2 additions & 1 deletion framework/codec/Android/mediaCodecDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ namespace Cicada{
static mediaCodecDecoder se;

private:
IAFFrame::videoInfo mVideoInfo{};
int mVideoWidth{0};
int mVideoHeight{0};
mediaCodec *mDecoder{nullptr};

std::recursive_mutex mFuncEntryMutex;
Expand Down

0 comments on commit 400049c

Please sign in to comment.