Loading media/codec2/sfplugin/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ cc_library_shared { "libstagefright_codecbase", "libstagefright_foundation", "libstagefright_omx", "libstagefright_surface_utils", "libstagefright_xmlparser", "libui", "libutils", Loading media/codec2/sfplugin/CCodec.cpp +19 −1 Original line number Diff line number Diff line Loading @@ -871,6 +871,11 @@ void CCodec::configure(const sp<AMessage> &msg) { } config->mTunneled = true; } int32_t pushBlankBuffersOnStop = 0; if (msg->findInt32(KEY_PUSH_BLANK_BUFFERS_ON_STOP, &pushBlankBuffersOnStop)) { config->mPushBlankBuffersOnStop = pushBlankBuffersOnStop == 1; } } } setSurface(surface); Loading Loading @@ -1841,7 +1846,13 @@ void CCodec::initiateStop() { } state->set(STOPPING); } { Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig); const std::unique_ptr<Config> &config = *configLocked; if (config->mPushBlankBuffersOnStop) { mChannel->pushBlankBufferToOutputSurface(); } } mChannel->reset(); (new AMessage(kWhatStop, this))->post(); } Loading Loading @@ -1929,6 +1940,13 @@ void CCodec::initiateRelease(bool sendCallback /* = true */) { config->mInputSurfaceDataspace = HAL_DATASPACE_UNKNOWN; } } { Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig); const std::unique_ptr<Config> &config = *configLocked; if (config->mPushBlankBuffersOnStop) { mChannel->pushBlankBufferToOutputSurface(); } } mChannel->reset(); // thiz holds strong ref to this while the thread is running. Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ //#define LOG_NDEBUG 0 #include <utils/Errors.h> #define LOG_TAG "CCodecBufferChannel" #define ATRACE_TAG ATRACE_TAG_VIDEO #include <utils/Log.h> Loading Loading @@ -48,6 +49,7 @@ #include <media/stagefright/foundation/hexdump.h> #include <media/stagefright/MediaCodecConstants.h> #include <media/stagefright/SkipCutBuffer.h> #include <media/stagefright/SurfaceUtils.h> #include <media/MediaCodecBuffer.h> #include <mediadrm/ICrypto.h> #include <system/window.h> Loading Loading @@ -2180,4 +2182,13 @@ status_t toStatusT(c2_status_t c2s, c2_operation_t c2op) { } } status_t CCodecBufferChannel::pushBlankBufferToOutputSurface() { Mutexed<OutputSurface>::Locked output(mOutputSurface); sp<ANativeWindow> nativeWindow = static_cast<ANativeWindow *>(output->surface.get()); if (nativeWindow == nullptr) { return INVALID_OPERATION; } return pushBlankBuffersToNativeWindow(nativeWindow.get()); } } // namespace android media/codec2/sfplugin/CCodecBufferChannel.h +5 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,11 @@ public: void setMetaMode(MetaMode mode); /** * Push a blank buffer to the configured native output surface. */ status_t pushBlankBufferToOutputSurface(); private: class QueueGuard; Loading media/codec2/sfplugin/CCodecConfig.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -324,7 +324,8 @@ CCodecConfig::CCodecConfig() : mInputFormat(new AMessage), mOutputFormat(new AMessage), mUsingSurface(false), mTunneled(false) { } mTunneled(false), mPushBlankBuffersOnStop(false) { } void CCodecConfig::initializeStandardParams() { typedef Domain D; Loading Loading @@ -963,8 +964,6 @@ void CCodecConfig::initializeStandardParams() { .limitTo(D::ENCODER & D::VIDEO & D::READ)); /* still to do constexpr char KEY_PUSH_BLANK_BUFFERS_ON_STOP[] = "push-blank-buffers-on-shutdown"; not yet used by MediaCodec, but defined as MediaFormat KEY_AUDIO_SESSION_ID // we use "audio-hw-sync" KEY_OUTPUT_REORDER_DEPTH Loading Loading
media/codec2/sfplugin/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ cc_library_shared { "libstagefright_codecbase", "libstagefright_foundation", "libstagefright_omx", "libstagefright_surface_utils", "libstagefright_xmlparser", "libui", "libutils", Loading
media/codec2/sfplugin/CCodec.cpp +19 −1 Original line number Diff line number Diff line Loading @@ -871,6 +871,11 @@ void CCodec::configure(const sp<AMessage> &msg) { } config->mTunneled = true; } int32_t pushBlankBuffersOnStop = 0; if (msg->findInt32(KEY_PUSH_BLANK_BUFFERS_ON_STOP, &pushBlankBuffersOnStop)) { config->mPushBlankBuffersOnStop = pushBlankBuffersOnStop == 1; } } } setSurface(surface); Loading Loading @@ -1841,7 +1846,13 @@ void CCodec::initiateStop() { } state->set(STOPPING); } { Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig); const std::unique_ptr<Config> &config = *configLocked; if (config->mPushBlankBuffersOnStop) { mChannel->pushBlankBufferToOutputSurface(); } } mChannel->reset(); (new AMessage(kWhatStop, this))->post(); } Loading Loading @@ -1929,6 +1940,13 @@ void CCodec::initiateRelease(bool sendCallback /* = true */) { config->mInputSurfaceDataspace = HAL_DATASPACE_UNKNOWN; } } { Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig); const std::unique_ptr<Config> &config = *configLocked; if (config->mPushBlankBuffersOnStop) { mChannel->pushBlankBufferToOutputSurface(); } } mChannel->reset(); // thiz holds strong ref to this while the thread is running. Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ //#define LOG_NDEBUG 0 #include <utils/Errors.h> #define LOG_TAG "CCodecBufferChannel" #define ATRACE_TAG ATRACE_TAG_VIDEO #include <utils/Log.h> Loading Loading @@ -48,6 +49,7 @@ #include <media/stagefright/foundation/hexdump.h> #include <media/stagefright/MediaCodecConstants.h> #include <media/stagefright/SkipCutBuffer.h> #include <media/stagefright/SurfaceUtils.h> #include <media/MediaCodecBuffer.h> #include <mediadrm/ICrypto.h> #include <system/window.h> Loading Loading @@ -2180,4 +2182,13 @@ status_t toStatusT(c2_status_t c2s, c2_operation_t c2op) { } } status_t CCodecBufferChannel::pushBlankBufferToOutputSurface() { Mutexed<OutputSurface>::Locked output(mOutputSurface); sp<ANativeWindow> nativeWindow = static_cast<ANativeWindow *>(output->surface.get()); if (nativeWindow == nullptr) { return INVALID_OPERATION; } return pushBlankBuffersToNativeWindow(nativeWindow.get()); } } // namespace android
media/codec2/sfplugin/CCodecBufferChannel.h +5 −0 Original line number Diff line number Diff line Loading @@ -181,6 +181,11 @@ public: void setMetaMode(MetaMode mode); /** * Push a blank buffer to the configured native output surface. */ status_t pushBlankBufferToOutputSurface(); private: class QueueGuard; Loading
media/codec2/sfplugin/CCodecConfig.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -324,7 +324,8 @@ CCodecConfig::CCodecConfig() : mInputFormat(new AMessage), mOutputFormat(new AMessage), mUsingSurface(false), mTunneled(false) { } mTunneled(false), mPushBlankBuffersOnStop(false) { } void CCodecConfig::initializeStandardParams() { typedef Domain D; Loading Loading @@ -963,8 +964,6 @@ void CCodecConfig::initializeStandardParams() { .limitTo(D::ENCODER & D::VIDEO & D::READ)); /* still to do constexpr char KEY_PUSH_BLANK_BUFFERS_ON_STOP[] = "push-blank-buffers-on-shutdown"; not yet used by MediaCodec, but defined as MediaFormat KEY_AUDIO_SESSION_ID // we use "audio-hw-sync" KEY_OUTPUT_REORDER_DEPTH Loading