Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd44d8e2 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

MediaCodec refactoring part 1-c: buffer ownership

- Buffers are (roughly) owned by themselves.
- As a corollary, remove output format change related events
and replace by inspecting formats associated with each buffers.

Bug: 32133435
Test: gts-tradefed run gts -m GtsExoPlayerTestCases
Test: (manual) Run Play Movies app to play a secure content.
Change-Id: I6b57da61c2d71acd0d5be4281de823ba1c95b72f
parent 1e4d737f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -230,7 +230,6 @@ protected:
                    mCodec->signalResume();

                    (new AMessage(kWhatSeek, this))->post(5000000ll);
                } else if (what == CodecBase::kWhatOutputFormatChanged) {
                } else if (what == CodecBase::kWhatShutdownCompleted) {
                    mDecodeLooper->unregisterHandler(mCodec->id());

+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ public:
    sp<AMessage> meta();
    sp<AMessage> format();

    virtual sp<MediaCodecBuffer> clone(const sp<AMessage> &format);

private:
    MediaCodecBuffer() = delete;

+1 −4
Original line number Diff line number Diff line
@@ -188,7 +188,6 @@ private:
        sp<RefBase> mCodecRef;            // and a reference to the IMemory

        sp<GraphicBuffer> mGraphicBuffer;
        sp<NativeHandle> mNativeHandle;
        int mFenceFd;
        FrameRenderTracker::Info *mRenderInfo;

@@ -200,8 +199,6 @@ private:
        // Log error, if the current fence is not a read/write fence.
        void checkReadFence(const char *dbg);
        void checkWriteFence(const char *dbg);

        sp<MediaCodecBuffer> alloc(const sp<AMessage> &format);
    };

    static const char *_asString(BufferInfo::Status s);
+0 −1
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ struct CodecBase : public AHandler, /* static */ ColorUtils {
        kWhatEOS                 = 'eos ',
        kWhatShutdownCompleted   = 'scom',
        kWhatFlushCompleted      = 'fcom',
        kWhatOutputFormatChanged = 'outC',
        kWhatError               = 'erro',
        kWhatComponentAllocated  = 'cAll',
        kWhatComponentConfigured = 'cCon',
+2 −2
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ private:
        kFlagIsSecure                   = 64,
        kFlagSawMediaServerDie          = 128,
        kFlagIsEncoder                  = 256,
        kFlagGatherCodecSpecificData    = 512,
        // 512 skipped
        kFlagIsAsync                    = 1024,
        kFlagIsComponentAllocated       = 2048,
        kFlagPushBlankBuffersOnShutdown = 4096,
@@ -258,7 +258,6 @@ private:
        sp<MediaCodecBuffer> mSecureData;
        sp<IMemory> mSharedEncryptedBuffer;
        sp<AMessage> mNotify;
        sp<AMessage> mFormat;
        bool mOwnedByClient;
    };

@@ -329,6 +328,7 @@ private:

    List<size_t> mAvailPortBuffers[2];
    Vector<BufferInfo> mPortBuffers[2];
    Vector<sp<MediaCodecBuffer>> mPortBufferArrays[2];

    int32_t mDequeueInputTimeoutGeneration;
    sp<AReplyToken> mDequeueInputReplyID;
Loading