author | Anthony Jones <ajones@mozilla.com> |
Mon, 09 Jun 2014 18:07:44 +1200 | |
changeset 187521 | b70ca6c774c92d2de4caf763196a08245e6d3f72 |
parent 187520 | bfdb673c1eadd6927516d159482c056300ee396a |
child 187522 | 7987a44a68140f5341f9659b08729e1305e0e909 |
push id | 44611 |
push user | ajones@mozilla.com |
push date | Mon, 09 Jun 2014 06:08:33 +0000 |
treeherder | mozilla-inbound@7987a44a6814 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | cpearce |
bugs | 1016150 |
milestone | 32.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp +++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp @@ -66,42 +66,40 @@ FFmpegH264Decoder::DecodeFrame(mp4_demux avcodec_decode_video2(&mCodecContext, frame, &decoded, &packet); if (bytesConsumed < 0) { NS_WARNING("FFmpeg video decoder error."); mCallback->Error(); return; } - if (!decoded) { - // The decoder doesn't have enough data to decode a frame yet. - return; - } + // If we've decoded a frame then we need to output it + if (decoded) { + nsAutoPtr<VideoData> data; - nsAutoPtr<VideoData> data; - - VideoInfo info; - info.mDisplay = nsIntSize(mCodecContext.width, mCodecContext.height); - info.mStereoMode = StereoMode::MONO; - info.mHasVideo = true; + VideoInfo info; + info.mDisplay = nsIntSize(mCodecContext.width, mCodecContext.height); + info.mStereoMode = StereoMode::MONO; + info.mHasVideo = true; - data = VideoData::CreateFromImage( - info, mImageContainer, aSample->byte_offset, aSample->composition_timestamp, - aSample->duration, mCurrentImage, aSample->is_sync_point, -1, - gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height)); + data = VideoData::CreateFromImage( + info, mImageContainer, aSample->byte_offset, aSample->composition_timestamp, + aSample->duration, mCurrentImage, aSample->is_sync_point, -1, + gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height)); + + // Insert the frame into the heap for reordering. + mDelayedFrames.Push(data.forget()); - // Insert the frame into the heap for reordering. - mDelayedFrames.Push(data.forget()); - - // Reorder video frames from decode order to presentation order. The minimum - // size of the heap comes from one P frame + |max_b_frames| B frames, which - // is the maximum number of frames in a row which will be out-of-order. - if (mDelayedFrames.Length() > (uint32_t)mCodecContext.max_b_frames + 1) { - VideoData* d = mDelayedFrames.Pop(); - mCallback->Output(d); + // Reorder video frames from decode order to presentation order. The minimum + // size of the heap comes from one P frame + |max_b_frames| B frames, which + // is the maximum number of frames in a row which will be out-of-order. + if (mDelayedFrames.Length() > (uint32_t)mCodecContext.max_b_frames + 1) { + VideoData* d = mDelayedFrames.Pop(); + mCallback->Output(d); + } } if (mTaskQueue->IsEmpty()) { mCallback->InputExhausted(); } } static void