Loading include/media/omx/1.0/WGraphicBufferSource.h +1 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ struct LWGraphicBufferSource : public BnGraphicBufferSource { BnStatus setTimeLapseConfig(double fps, double captureFps) override; BnStatus setStartTimeUs(int64_t startTimeUs) override; BnStatus setStopTimeUs(int64_t stopTimeUs) override; BnStatus getStopTimeOffsetUs(int64_t *stopTimeOffsetUs) override; BnStatus setColorAspects(int32_t aspects) override; BnStatus setTimeOffsetUs(int64_t timeOffsetsUs) override; BnStatus signalEndOfInputStream() override; Loading media/libmedia/aidl/android/IGraphicBufferSource.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ interface IGraphicBufferSource { void setTimeLapseConfig(double fps, double captureFps); void setStartTimeUs(long startTimeUs); void setStopTimeUs(long stopTimeUs); long getStopTimeOffsetUs(); void setColorAspects(int aspects); void setTimeOffsetUs(long timeOffsetsUs); void signalEndOfInputStream(); Loading media/libmedia/omx/1.0/WGraphicBufferSource.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,14 @@ BnStatus LWGraphicBufferSource::setStopTimeUs( return toBinderStatus(mBase->setStopTimeUs(stopTimeUs)); } BnStatus LWGraphicBufferSource::getStopTimeOffsetUs( int64_t *stopTimeOffsetUs) { return toBinderStatus(mBase->getStopTimeOffsetUs( [stopTimeOffsetUs](auto, auto offsetUs) { *stopTimeOffsetUs = offsetUs; })); } BnStatus LWGraphicBufferSource::setColorAspects( int32_t aspects) { return toBinderStatus(mBase->setColorAspects( Loading media/libstagefright/ACodec.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -7201,6 +7201,16 @@ status_t ACodec::setParameters(const sp<AMessage> ¶ms) { ALOGE("Failed to set parameter 'stop-time-us' (err %d)", err); return err; } int64_t stopTimeOffsetUs; err = statusFromBinderStatus( mGraphicBufferSource->getStopTimeOffsetUs(&stopTimeOffsetUs)); if (err != OK) { ALOGE("Failed to get stop time offset (err %d)", err); return err; } mInputFormat->setInt64("android._stop-time-offset-us", stopTimeOffsetUs); } int32_t dummy; Loading media/libstagefright/MediaCodecSource.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -1004,12 +1004,21 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { mStopping = true; int64_t timeoutUs = kStopTimeoutUs; // if using surface, signal source EOS and wait for EOS to come back. // otherwise, stop puller (which also clears the input buffer queue) // and wait for the EOS message. We cannot call source->stop() because // the encoder may still be processing input buffers. if (mFlags & FLAG_USE_SURFACE_INPUT) { mEncoder->signalEndOfInputStream(); // Increase the timeout if there is delay in the GraphicBufferSource sp<AMessage> inputFormat; int64_t stopTimeOffsetUs; if (mEncoder->getInputFormat(&inputFormat) == OK && inputFormat->findInt64("android._stop-time-offset-us", &stopTimeOffsetUs) && stopTimeOffsetUs > 0) { timeoutUs += stopTimeOffsetUs; } } else { mPuller->stop(); } Loading @@ -1017,7 +1026,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { // complete stop even if encoder/puller stalled sp<AMessage> timeoutMsg = new AMessage(kWhatStopStalled, mReflector); timeoutMsg->setInt32("generation", mGeneration); timeoutMsg->post(kStopTimeoutUs); timeoutMsg->post(timeoutUs); break; } Loading Loading
include/media/omx/1.0/WGraphicBufferSource.h +1 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ struct LWGraphicBufferSource : public BnGraphicBufferSource { BnStatus setTimeLapseConfig(double fps, double captureFps) override; BnStatus setStartTimeUs(int64_t startTimeUs) override; BnStatus setStopTimeUs(int64_t stopTimeUs) override; BnStatus getStopTimeOffsetUs(int64_t *stopTimeOffsetUs) override; BnStatus setColorAspects(int32_t aspects) override; BnStatus setTimeOffsetUs(int64_t timeOffsetsUs) override; BnStatus signalEndOfInputStream() override; Loading
media/libmedia/aidl/android/IGraphicBufferSource.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ interface IGraphicBufferSource { void setTimeLapseConfig(double fps, double captureFps); void setStartTimeUs(long startTimeUs); void setStopTimeUs(long stopTimeUs); long getStopTimeOffsetUs(); void setColorAspects(int aspects); void setTimeOffsetUs(long timeOffsetsUs); void signalEndOfInputStream(); Loading
media/libmedia/omx/1.0/WGraphicBufferSource.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,14 @@ BnStatus LWGraphicBufferSource::setStopTimeUs( return toBinderStatus(mBase->setStopTimeUs(stopTimeUs)); } BnStatus LWGraphicBufferSource::getStopTimeOffsetUs( int64_t *stopTimeOffsetUs) { return toBinderStatus(mBase->getStopTimeOffsetUs( [stopTimeOffsetUs](auto, auto offsetUs) { *stopTimeOffsetUs = offsetUs; })); } BnStatus LWGraphicBufferSource::setColorAspects( int32_t aspects) { return toBinderStatus(mBase->setColorAspects( Loading
media/libstagefright/ACodec.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -7201,6 +7201,16 @@ status_t ACodec::setParameters(const sp<AMessage> ¶ms) { ALOGE("Failed to set parameter 'stop-time-us' (err %d)", err); return err; } int64_t stopTimeOffsetUs; err = statusFromBinderStatus( mGraphicBufferSource->getStopTimeOffsetUs(&stopTimeOffsetUs)); if (err != OK) { ALOGE("Failed to get stop time offset (err %d)", err); return err; } mInputFormat->setInt64("android._stop-time-offset-us", stopTimeOffsetUs); } int32_t dummy; Loading
media/libstagefright/MediaCodecSource.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -1004,12 +1004,21 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { mStopping = true; int64_t timeoutUs = kStopTimeoutUs; // if using surface, signal source EOS and wait for EOS to come back. // otherwise, stop puller (which also clears the input buffer queue) // and wait for the EOS message. We cannot call source->stop() because // the encoder may still be processing input buffers. if (mFlags & FLAG_USE_SURFACE_INPUT) { mEncoder->signalEndOfInputStream(); // Increase the timeout if there is delay in the GraphicBufferSource sp<AMessage> inputFormat; int64_t stopTimeOffsetUs; if (mEncoder->getInputFormat(&inputFormat) == OK && inputFormat->findInt64("android._stop-time-offset-us", &stopTimeOffsetUs) && stopTimeOffsetUs > 0) { timeoutUs += stopTimeOffsetUs; } } else { mPuller->stop(); } Loading @@ -1017,7 +1026,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { // complete stop even if encoder/puller stalled sp<AMessage> timeoutMsg = new AMessage(kWhatStopStalled, mReflector); timeoutMsg->setInt32("generation", mGeneration); timeoutMsg->post(kStopTimeoutUs); timeoutMsg->post(timeoutUs); break; } Loading