Loading media/libstagefright/codecs/avc/enc/AVCEncoder.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -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; Loading media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -306,8 +306,13 @@ status_t M4vH263Encoder::read( int64_t timeUs; CHECK(mInputBuffer->meta_data()->findInt64(kKeyTime, &timeUs)); if (mNextModTimeUs > timeUs) { LOGV("mNextModTimeUs %lld > timeUs %lld", mNextModTimeUs, timeUs); // When the timestamp of the current sample is the same as that // of the previous sample, encoding of the current sample is // bypassed, and the output length of the sample is set to 0 if (mNumInputFrames >= 1 && (mNextModTimeUs > timeUs || mPrevTimestampUs == timeUs)) { // Frame arrives too late outputBuffer->set_range(0, 0); *out = outputBuffer; mInputBuffer->release(); Loading @@ -315,6 +320,10 @@ status_t M4vH263Encoder::read( return OK; } // Don't accept out-of-order samples CHECK(mPrevTimestampUs < timeUs); mPrevTimestampUs = timeUs; // Color convert to OMX_COLOR_FormatYUV420Planar if necessary outputBuffer->meta_data()->setInt64(kKeyTime, timeUs); uint8_t *inPtr = (uint8_t *) mInputBuffer->data(); Loading media/libstagefright/include/AVCEncoder.h +1 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ private: int32_t mVideoBitRate; int32_t mVideoColorFormat; int64_t mNumInputFrames; int64_t mPrevTimestampUs; status_t mInitCheck; bool mStarted; bool mSpsPpsHeaderReceived; Loading media/libstagefright/include/M4vH263Encoder.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ private: int32_t mVideoColorFormat; int64_t mNumInputFrames; int64_t mNextModTimeUs; int64_t mPrevTimestampUs; status_t mInitCheck; bool mStarted; Loading Loading
media/libstagefright/codecs/avc/enc/AVCEncoder.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
media/libstagefright/codecs/m4v_h263/enc/M4vH263Encoder.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -306,8 +306,13 @@ status_t M4vH263Encoder::read( int64_t timeUs; CHECK(mInputBuffer->meta_data()->findInt64(kKeyTime, &timeUs)); if (mNextModTimeUs > timeUs) { LOGV("mNextModTimeUs %lld > timeUs %lld", mNextModTimeUs, timeUs); // When the timestamp of the current sample is the same as that // of the previous sample, encoding of the current sample is // bypassed, and the output length of the sample is set to 0 if (mNumInputFrames >= 1 && (mNextModTimeUs > timeUs || mPrevTimestampUs == timeUs)) { // Frame arrives too late outputBuffer->set_range(0, 0); *out = outputBuffer; mInputBuffer->release(); Loading @@ -315,6 +320,10 @@ status_t M4vH263Encoder::read( return OK; } // Don't accept out-of-order samples CHECK(mPrevTimestampUs < timeUs); mPrevTimestampUs = timeUs; // Color convert to OMX_COLOR_FormatYUV420Planar if necessary outputBuffer->meta_data()->setInt64(kKeyTime, timeUs); uint8_t *inPtr = (uint8_t *) mInputBuffer->data(); Loading
media/libstagefright/include/AVCEncoder.h +1 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ private: int32_t mVideoBitRate; int32_t mVideoColorFormat; int64_t mNumInputFrames; int64_t mPrevTimestampUs; status_t mInitCheck; bool mStarted; bool mSpsPpsHeaderReceived; Loading
media/libstagefright/include/M4vH263Encoder.h +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ private: int32_t mVideoColorFormat; int64_t mNumInputFrames; int64_t mNextModTimeUs; int64_t mPrevTimestampUs; status_t mInitCheck; bool mStarted; Loading