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

Commit 67d0d2e8 authored by zhenxingwang's avatar zhenxingwang Committed by zhenxingwang
Browse files

When OggWriter stops, stop codec source first before pthread_join to prevent stall

When StagefrightRecorder changes from paused to stopped,
pthread_join before mSource->stop get blocked because MediaCodecSource is paused.

Stop codec source first just as AMRWriter/AACWriter have done it.

Bug: 260336332
Test: follow bug repro steps
Change-Id: I42ab1395a7c3ce22d373253dd74197334cad3a1a
parent e25b43e7
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -242,13 +242,15 @@ status_t OggWriter::reset() {


    mDone = true;
    mDone = true;


    void* dummy;
    status_t status = mSource->stop();
    pthread_join(mThread, &dummy);

    void *pthread_res;
    pthread_join(mThread, &pthread_res);


    status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy));
    status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(pthread_res));
    {
    {
        status_t status = mSource->stop();
        if (err == OK &&
        if (err == OK && (status != OK && status != ERROR_END_OF_STREAM)) {
            (status != OK && status != ERROR_END_OF_STREAM)) {
            err = status;
            err = status;
        }
        }
    }
    }