Loading media/libstagefright/MediaCodecSource.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,9 @@ const int32_t kDefaultHwVideoEncoderFormat = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEF const int32_t kDefaultVideoEncoderDataSpace = HAL_DATASPACE_V0_BT709; const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder // allow maximum 1 sec for stop time offset. This limits the the delay in the // input source. const int kMaxStopTimeOffsetUs = 1000000; struct MediaCodecSource::Puller : public AHandler { explicit Puller(const sp<MediaSource> &source); Loading Loading @@ -1017,7 +1020,15 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { if (mEncoder->getInputFormat(&inputFormat) == OK && inputFormat->findInt64("android._stop-time-offset-us", &stopTimeOffsetUs) && stopTimeOffsetUs > 0) { if (stopTimeOffsetUs > kMaxStopTimeOffsetUs) { ALOGW("Source stopTimeOffsetUs %lld too large, limit at %lld us", (long long)stopTimeOffsetUs, (long long)kMaxStopTimeOffsetUs); stopTimeOffsetUs = kMaxStopTimeOffsetUs; } timeoutUs += stopTimeOffsetUs; } else { // Use kMaxStopTimeOffsetUs if stop time offset is not provided by input source timeoutUs = kMaxStopTimeOffsetUs; } } else { mPuller->stop(); Loading media/libstagefright/omx/GraphicBufferSource.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -1229,7 +1229,8 @@ status_t GraphicBufferSource::getStopTimeOffsetUs(int64_t *stopTimeOffsetUs) { ALOGW("Fail to return stopTimeOffsetUs as stop time is not set"); return INVALID_OPERATION; } *stopTimeOffsetUs = mStopTimeUs - mLastFrameTimestampUs; *stopTimeOffsetUs = mLastFrameTimestampUs == -1 ? 0 : mStopTimeUs - mLastFrameTimestampUs; return OK; } Loading Loading
media/libstagefright/MediaCodecSource.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,9 @@ const int32_t kDefaultHwVideoEncoderFormat = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEF const int32_t kDefaultVideoEncoderDataSpace = HAL_DATASPACE_V0_BT709; const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder // allow maximum 1 sec for stop time offset. This limits the the delay in the // input source. const int kMaxStopTimeOffsetUs = 1000000; struct MediaCodecSource::Puller : public AHandler { explicit Puller(const sp<MediaSource> &source); Loading Loading @@ -1017,7 +1020,15 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { if (mEncoder->getInputFormat(&inputFormat) == OK && inputFormat->findInt64("android._stop-time-offset-us", &stopTimeOffsetUs) && stopTimeOffsetUs > 0) { if (stopTimeOffsetUs > kMaxStopTimeOffsetUs) { ALOGW("Source stopTimeOffsetUs %lld too large, limit at %lld us", (long long)stopTimeOffsetUs, (long long)kMaxStopTimeOffsetUs); stopTimeOffsetUs = kMaxStopTimeOffsetUs; } timeoutUs += stopTimeOffsetUs; } else { // Use kMaxStopTimeOffsetUs if stop time offset is not provided by input source timeoutUs = kMaxStopTimeOffsetUs; } } else { mPuller->stop(); Loading
media/libstagefright/omx/GraphicBufferSource.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -1229,7 +1229,8 @@ status_t GraphicBufferSource::getStopTimeOffsetUs(int64_t *stopTimeOffsetUs) { ALOGW("Fail to return stopTimeOffsetUs as stop time is not set"); return INVALID_OPERATION; } *stopTimeOffsetUs = mStopTimeUs - mLastFrameTimestampUs; *stopTimeOffsetUs = mLastFrameTimestampUs == -1 ? 0 : mStopTimeUs - mLastFrameTimestampUs; return OK; } Loading