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

Commit 9fdb3bd4 authored by Vignesh Venkatasubramanian's avatar Vignesh Venkatasubramanian Committed by Android (Google) Code Review
Browse files

Merge "opus: Support for > 2 channels"

parents e743a47f 9b4b24a4
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -344,6 +344,28 @@ status_t convertMetaDataToMessage(
        buffer->meta()->setInt32("csd", true);
        buffer->meta()->setInt64("timeUs", 0);
        msg->setBuffer("csd-0", buffer);

        if (!meta->findData(kKeyOpusCodecDelay, &type, &data, &size)) {
            return -EINVAL;
        }

        buffer = new ABuffer(size);
        memcpy(buffer->data(), data, size);

        buffer->meta()->setInt32("csd", true);
        buffer->meta()->setInt64("timeUs", 0);
        msg->setBuffer("csd-1", buffer);

        if (!meta->findData(kKeyOpusSeekPreRoll, &type, &data, &size)) {
            return -EINVAL;
        }

        buffer = new ABuffer(size);
        memcpy(buffer->data(), data, size);

        buffer->meta()->setInt32("csd", true);
        buffer->meta()->setInt64("timeUs", 0);
        msg->setBuffer("csd-2", buffer);
    }

    *format = msg;
+9 −3
Original line number Diff line number Diff line
@@ -345,9 +345,15 @@ void SoftOpus::onQueueFilled(OMX_U32 portIndex) {
            }

            uint8_t channel_mapping[kMaxChannels] = {0};
            if (mHeader->channels <= kMaxChannelsWithDefaultLayout) {
                memcpy(&channel_mapping,
                       kDefaultOpusChannelLayout,
                       kMaxChannelsWithDefaultLayout);
            } else {
                memcpy(&channel_mapping,
                       mHeader->stream_map,
                       mHeader->channels);
            }

            int status = OPUS_INVALID_STATE;
            mDecoder = opus_multistream_decoder_create(kRate,