diff options
author | James Dong <jdong@google.com> | 2010-08-11 17:29:09 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-08-12 10:40:58 -0700 |
commit | 5328abe1e36a39b1d4617a74ac82c201b8c14c43 (patch) | |
tree | 99661b4d62fce7c687e6afd1bc44056b29016df9 /media/libstagefright/codecs/avc | |
parent | bef4b56250b7c9bd4cc34c5fad49fec7b57d4526 (diff) | |
download | frameworks_av-5328abe1e36a39b1d4617a74ac82c201b8c14c43.zip frameworks_av-5328abe1e36a39b1d4617a74ac82c201b8c14c43.tar.gz frameworks_av-5328abe1e36a39b1d4617a74ac82c201b8c14c43.tar.bz2 |
Don't send late frames to software encoders for encoding
o Document on what frames will be rejected and what frames will be accepted
Change-Id: I5a5d489ad3d2b50dbb40a0f6e01529312ce81c54
Diffstat (limited to 'media/libstagefright/codecs/avc')
-rw-r--r-- | media/libstagefright/codecs/avc/enc/AVCEncoder.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp index 6e74279..0d89e02 100644 --- a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp +++ b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp @@ -407,6 +407,22 @@ status_t AVCEncoder::read( CHECK(mInputBuffer->meta_data()->findInt64(kKeyTime, &timeUs)); outputBuffer->meta_data()->setInt64(kKeyTime, timeUs); + // When the timestamp of the current sample is the same as + // that of the previous sample, the encoding of the sample + // is bypassed, and the output length is set to 0. + if (mNumInputFrames >= 1 && mPrevTimestampUs == timeUs) { + // Frame arrives too late + mInputBuffer->release(); + mInputBuffer = NULL; + outputBuffer->set_range(0, 0); + *out = outputBuffer; + return OK; + } + + // Don't accept out-of-order samples + CHECK(mPrevTimestampUs < timeUs); + mPrevTimestampUs = timeUs; + AVCFrameIO videoInput; memset(&videoInput, 0, sizeof(videoInput)); videoInput.height = ((mVideoHeight + 15) >> 4) << 4; |