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

Commit 7ffd5dca authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Fix Opus CSD-1 and CSD-2

Bug: 118361859
Bug: 111407253
Test: manual
Change-Id: I45c0045a65450acbda94211a7be5f7b7cbe93e95
parent 2d4cf009
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -987,11 +987,10 @@ media_status_t MyOpusExtractor::verifyOpusHeader(MediaBufferBase *buffer) {
    AMediaFormat_setBuffer(mMeta, AMEDIAFORMAT_KEY_CSD_0, data, size);
    AMediaFormat_setInt32(mMeta, AMEDIAFORMAT_KEY_SAMPLE_RATE, kOpusSampleRate);
    AMediaFormat_setInt32(mMeta, AMEDIAFORMAT_KEY_CHANNEL_COUNT, mChannelCount);
    // are these actually used anywhere?
    // (they are kKeyOpusSeekPreRoll and kKeyOpusCodecDelay respectively)
    AMediaFormat_setInt64(mMeta, AMEDIAFORMAT_KEY_CSD_2, kOpusSeekPreRollUs * 1000 /* = 80 ms*/);
    AMediaFormat_setInt64(mMeta, AMEDIAFORMAT_KEY_CSD_1,
            mCodecDelay /* sample/s */ * 1000000000ll / kOpusSampleRate);
    int64_t codecdelay = mCodecDelay /* sample/s */ * 1000000000ll / kOpusSampleRate;
    AMediaFormat_setBuffer(mMeta, AMEDIAFORMAT_KEY_CSD_1, &codecdelay, sizeof(codecdelay));
    int64_t preroll = kOpusSeekPreRollUs * 1000 /* = 80 ms*/;
    AMediaFormat_setBuffer(mMeta, AMEDIAFORMAT_KEY_CSD_2, &preroll, sizeof(preroll));

    return AMEDIA_OK;
}
+2 −2
Original line number Diff line number Diff line
@@ -135,13 +135,13 @@ status_t MediaTrackCUnwrapperV2::read(MediaBufferBase **buffer, const ReadOption

    uint32_t opts = 0;

    if (options->getNonBlocking()) {
    if (options && options->getNonBlocking()) {
        opts |= CMediaTrackReadOptions::NONBLOCKING;
    }

    int64_t seekPosition = 0;
    MediaTrack::ReadOptions::SeekMode seekMode;
    if (options->getSeekTo(&seekPosition, &seekMode)) {
    if (options && options->getSeekTo(&seekPosition, &seekMode)) {
        opts |= SEEK;
        opts |= (uint32_t) seekMode;
    }