Revert "media: Mediarecorder drops the mediabuffer with negative adjusted timestamp."
This reverts commit 901ca36bf02726ca07d83820c93c76d696549a03.
Change-Id: I56a0ec7b8d70e19cc6009d8fbc4560becf1d04c9
diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp
index 5039922..0aafa6bd 100644
--- a/media/libstagefright/MediaCodecSource.cpp
+++ b/media/libstagefright/MediaCodecSource.cpp
@@ -648,15 +648,6 @@
CHECK(mbuf->meta_data()->findInt64(kKeyTime, &timeUs));
timeUs += mInputBufferTimeOffsetUs;
- // Due to the extra delay adjustment at the beginning of start/resume,
- // the adjusted timeUs may be negative if MediaCodecSource goes into pause
- // state before feeding any buffers to the encoder. Drop the buffer in this
- // case.
- if (timeUs < 0) {
- mbuf->release();
- return OK;
- }
-
// push decoding time for video, or drift time for audio
if (mIsVideo) {
mDecodingTimeQueue.push_back(timeUs);
@@ -841,16 +832,9 @@
// Time offset is not applied at
// feedEncoderInputBuffer() in surface input case.
timeUs += mInputBufferTimeOffsetUs;
-
- // Due to the extra delay adjustment at the beginning of
- // start/resume, the adjusted timeUs may be negative if
- // MediaCodecSource goes into pause state before feeding
- // any buffers to the encoder. Drop the buffer in this case.
- if (timeUs < 0) {
- mEncoder->releaseOutputBuffer(index);
- break;
- }
-
+ // GraphicBufferSource is supposed to discard samples
+ // queued before start, and offset timeUs by start time
+ CHECK_GE(timeUs, 0ll);
// TODO:
// Decoding time for surface source is unavailable,
// use presentation time for now. May need to move