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

Commit df3f6856 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handle mp4 file with abnormal pcm audio playback stuck" into qt-dev

parents 2f56f072 93cf3dfb
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1972,6 +1972,8 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return err;
            }

            adjustRawDefaultFrameSize();

            size_t max_size;
            err = mLastTrack->sampleTable->getMaxSampleSize(&max_size);

@@ -4606,6 +4608,20 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio(
    return OK;
}

void MPEG4Extractor::adjustRawDefaultFrameSize() {
    int32_t chanCount = 0;
    int32_t bitWidth = 0;
    const char *mimeStr = NULL;

    if(AMediaFormat_getString(mLastTrack->meta, AMEDIAFORMAT_KEY_MIME, &mimeStr) &&
        !strcasecmp(mimeStr, MEDIA_MIMETYPE_AUDIO_RAW) &&
        AMediaFormat_getInt32(mLastTrack->meta, AMEDIAFORMAT_KEY_CHANNEL_COUNT, &chanCount) &&
        AMediaFormat_getInt32(mLastTrack->meta, AMEDIAFORMAT_KEY_BITS_PER_SAMPLE, &bitWidth)) {
        // samplesize in stsz may not right , so updade default samplesize
        mLastTrack->sampleTable->setPredictSampleSize(chanCount * bitWidth / 8);
    }
}

////////////////////////////////////////////////////////////////////////////////

MPEG4Source::MPEG4Source(
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ private:
    status_t parseAC3SpecificBox(off64_t offset);
    status_t parseEAC3SpecificBox(off64_t offset);
    status_t parseAC4SpecificBox(off64_t offset);
    void adjustRawDefaultFrameSize();

    MPEG4Extractor(const MPEG4Extractor &);
    MPEG4Extractor &operator=(const MPEG4Extractor &);
+4 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ public:

    status_t findThumbnailSample(uint32_t *sample_index);

    void setPredictSampleSize(uint32_t sampleSize) {
        mDefaultSampleSize = sampleSize;
    }

protected:
    ~SampleTable();