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

Commit 51364921 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge changes I2384bf8f,I2f09d6d1,Ide6ed2fb

* changes:
  Cannot play 3gp file which esds box is over 256 bytes
  Sample index in stsc is bigger than samplecount in stsz
  Make mp4 file support mp3 audio
parents ed6addb0 7c182f9f
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -345,6 +345,9 @@ static const char *FourCC2MIME(uint32_t fourcc) {

        case FOURCC("av01"):
            return MEDIA_MIMETYPE_VIDEO_AV1;
        case FOURCC(".mp3"):
        case 0x6D730055: // "ms U" mp3 audio
            return MEDIA_MIMETYPE_AUDIO_MPEG;
        default:
            ALOGW("Unknown fourcc: %c%c%c%c",
                   (fourcc >> 24) & 0xff,
@@ -1629,6 +1632,8 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
        case FOURCC("twos"):
        case FOURCC("sowt"):
        case FOURCC("alac"):
        case FOURCC(".mp3"):
        case 0x6D730055: // "ms U" mp3 audio
        {
            if (mIsQT && chunk_type == FOURCC("mp4a")
                    && depth >= 1 && mPath[depth - 1] == FOURCC("wave")) {
@@ -2096,9 +2101,10 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
                return ERROR_MALFORMED;
            }

            uint8_t buffer[256];
            if (chunk_data_size > (off64_t)sizeof(buffer)) {
                return ERROR_BUFFER_TOO_SMALL;
            auto tmp = heapbuffer<uint8_t>(chunk_data_size);
            uint8_t *buffer = tmp.get();
            if (buffer == NULL) {
                return -ENOMEM;
            }

            if (mDataSource->readAt(
@@ -4085,12 +4091,10 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio(
        return OK;
    }

    if (objectTypeIndication  == 0x6b) {
        // The media subtype is MP3 audio
        // Our software MP3 audio decoder may not be able to handle
        // packetized MP3 audio; for now, lets just return ERROR_UNSUPPORTED
        ALOGE("MP3 track in MP4/3GPP file is not supported");
        return ERROR_UNSUPPORTED;
    if (objectTypeIndication == 0x6B || objectTypeIndication == 0x69) {
        // mp3 audio
        AMediaFormat_setString(mLastTrack->meta,AMEDIAFORMAT_KEY_MIME, MEDIA_MIMETYPE_AUDIO_MPEG);
        return OK;
    }

    if (mLastTrack != NULL) {
+9 −2
Original line number Diff line number Diff line
@@ -111,9 +111,16 @@ status_t SampleIterator::seekTo(uint32_t sampleIndex) {
            if ((err = getSampleSizeDirect(
                            firstChunkSampleIndex + i, &sampleSize)) != OK) {
                ALOGE("getSampleSizeDirect return error");
                // stsc sample count is not sync with stsz sample count
                if (err == ERROR_OUT_OF_RANGE) {
                    ALOGW("stsc samples(%d) not sync with stsz samples(%d)", mSamplesPerChunk, i);
                    mSamplesPerChunk = i;
                    break;
                } else{
                    mCurrentChunkSampleSizes.clear();
                    return err;
                }
            }

            mCurrentChunkSampleSizes.push(sampleSize);
        }