Bug 972246 - Keep sending EOS signal unitl OMXVideoEncoder actually receive it. r=roc

This commit is contained in:
John Lin 2014-02-18 08:50:15 -05:00
parent 87c19ce54e
commit c571b8f73a

View File

@ -112,12 +112,16 @@ OmxVideoTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData)
// Send the EOS signal to OMXCodecWrapper.
if (mEndOfStream && iter.IsEnded() && !mEosSetInEncoder) {
mEosSetInEncoder = true;
uint64_t totalDurationUs = mTotalFrameDuration * USECS_PER_S / mTrackRate;
layers::Image* img = (!mLastFrame.GetImage() || mLastFrame.GetForceBlack())
? nullptr : mLastFrame.GetImage();
mEncoder->Encode(img, mFrameWidth, mFrameHeight, totalDurationUs,
nsresult result = mEncoder->Encode(img, mFrameWidth, mFrameHeight,
totalDurationUs,
OMXCodecWrapper::BUFFER_EOS);
// Keep sending EOS signal until OMXVideoEncoder gets it.
if (result == NS_OK) {
mEosSetInEncoder = true;
}
}
// Dequeue an encoded frame from the output buffers of OMXCodecWrapper.