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

Commit d72b9560 authored by Ashish Jain's avatar Ashish Jain Committed by Linux Build Service Account
Browse files

audio: Update with correct audio format for WMA Pro clips.

-WMA and WMA pro clips differ only based on WMA Version, hence
they have a same mime type.
-To set correct audio format, add an avextension api updateAudioFormat
-This api updates the correct WMA format ( WMA pro or WMA) based on
wma version.

CRs-Fixed: 1028041
Change-Id: I75c7ed56a437c818d7072dbd5092db24bce1baad
parent 17a6de9c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -115,6 +115,10 @@ struct AVUtils {

    virtual int getAudioSampleBits(const sp<MetaData> &);
    virtual int getAudioSampleBits(const sp<AMessage> &);
    virtual audio_format_t updateAudioFormat(audio_format_t audioFormat,
            const sp<MetaData> &);
    virtual audio_format_t updateAudioFormat(audio_format_t audioFormat,
            const sp<AMessage> &);
    virtual void setPcmSampleBits(const sp<MetaData> &, int32_t /*bitWidth*/);
    virtual void setPcmSampleBits(const sp<AMessage> &, int32_t /*bitWidth*/);

+10 −0
Original line number Diff line number Diff line
@@ -68,6 +68,16 @@ int AVUtils::getAudioSampleBits(const sp<AMessage> &) {
    return 16;
}

audio_format_t AVUtils::updateAudioFormat(audio_format_t audioFormat,
        const sp<MetaData> &){
    return audioFormat;
}

audio_format_t AVUtils::updateAudioFormat(audio_format_t audioFormat,
        const sp<AMessage> &){
    return audioFormat;
}

void AVUtils::setPcmSampleBits(const sp<AMessage> &, int32_t /*bitWidth*/) {
}

+1 −0
Original line number Diff line number Diff line
@@ -1791,6 +1791,7 @@ status_t NuPlayer::Renderer::onOpenAudioSink(
            ALOGV("Mime \"%s\" mapped to audio_format 0x%x",
                    mime.c_str(), audioFormat);

            audioFormat = AVUtils::get()->updateAudioFormat(audioFormat, format);
            bitWidth = AVUtils::get()->getAudioSampleBits(format);
            int avgBitRate = -1;
            format->findInt32("bitrate", &avgBitRate);
+2 −0
Original line number Diff line number Diff line
@@ -1561,6 +1561,8 @@ bool canOffloadStream(const sp<MetaData>& meta, bool hasVideo,
    } else {
        ALOGV("Mime type \"%s\" mapped to audio_format %d", mime, info.format);
    }

    info.format  = AVUtils::get()->updateAudioFormat(info.format, meta);
    if (AUDIO_FORMAT_INVALID == info.format) {
        // can't offload if we don't know what the source format is
        ALOGE("mime type \"%s\" not a known audio format", mime);