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

Commit a04bede9 authored by Naresh Tanniru's avatar Naresh Tanniru Committed by Ricardo Cerqueira
Browse files

frameworks/av: AAC CSD support for MediaCodec path

- AudioFlush CTS test case is failing for AAC

- AAC Codec specific data is missing for
MediaCodec path for AAC if we use Qualcomm
ExtendedExtractor for demuxing

- Added CSD buffer while converting from
metadata to message , which can be used by
ACodec/MediaCodec

Change-Id: Ic8197138f5107f2a6026c28847e74987d91acc16
CRs-Fixed: 509575
parent a6f9da5b
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@
#include <media/stagefright/Utils.h>
#include <media/AudioParameter.h>

#ifdef ENABLE_QC_AV_ENHANCEMENTS
#include "QCMetaData.h"
#endif

namespace android {

uint16_t U16_AT(const uint8_t *ptr) {
@@ -128,6 +132,30 @@ status_t convertMetaDataToMessage(
        if (meta->findInt32(kKeyIsADTS, &isADTS)) {
            msg->setInt32("is-adts", true);
        }

#ifdef ENABLE_QC_AV_ENHANCEMENTS
        uint32_t type;
        const void *data;
        size_t size;

        if (meta->findData(kKeyAacCodecSpecificData, &type, &data, &size)) {
            if (size > 0 && data != NULL) {
                sp<ABuffer> buffer = new ABuffer(size);
                if (buffer != NULL) {
                    memcpy(buffer->data(), data, size);
                    buffer->meta()->setInt32("csd", true);
                    buffer->meta()->setInt64("timeUs", 0);
                    msg->setBuffer("csd-0", buffer);
                }
                else {
                    ALOGE("kKeyAacCodecSpecificData ABuffer Allocation failed");
                }
            }
            else {
                ALOGE("Not a valid data pointer or size == 0");
            }
       }
#endif
    }

    int32_t maxInputSize;