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

Commit adac80e2 authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat Committed by Linux Build Service Account
Browse files

AVCustomizations: Enable 16 and 24 bit PCM offload.

-create extended decoder and renderer
-add change to pass bit width and format info to renderer.
-add changes for time stamp calculation.
-Enables 24 bit PCM and 16 Bit PCM playback in
NuPlayer via direct PCM, if it is allowed.

Change-Id: I3363140fad441a7746884076c40b46e777f2e06e
parent 1792299e
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
namespace android {

struct NuPlayer;

/*
 * Factory to create extended NuPlayer objects
 */
@@ -46,6 +45,17 @@ struct AVNuFactory {
            const sp<NuPlayer::Source> &source,
            const sp<NuPlayer::Renderer> &renderer);

    virtual sp<NuPlayer::DecoderBase> createDecoder(
            const sp<AMessage> &notify,
            const sp<NuPlayer::Source> &source,
            pid_t pid,
            const sp<NuPlayer::Renderer> &renderer);

    virtual sp<NuPlayer::Renderer> createRenderer(
            const sp<MediaPlayerBase::AudioSink> &sink,
            const sp<AMessage> &notify,
            uint32_t flags);

    // ----- NO TRESSPASSING BEYOND THIS LINE ------
    DECLARE_LOADABLE_SINGLETON(AVNuFactory);
};
@@ -60,6 +70,18 @@ struct AVNuUtils {
    virtual bool dropCorruptFrame();
    virtual void addFlagsInMeta(const sp<ABuffer> &buffer, int32_t flags, bool isAudio);
    virtual void checkFormatChange(bool *formatChange, const sp<ABuffer> &accessUnit);
    virtual void overWriteAudioOutputFormat(sp <AMessage> &dst, const sp <AMessage> &src);
    virtual bool pcmOffloadException(const sp<AMessage> &);
    virtual bool isRAWFormat(const sp<MetaData> &);
    virtual bool isRAWFormat(const sp<AMessage> &);
    virtual int updateAudioBitWidth(audio_format_t audioFormat,
            const sp<AMessage> &);
    virtual audio_format_t getKeyPCMFormat(const sp<MetaData> &);
    virtual void setKeyPCMFormat(const sp<MetaData> &, audio_format_t audioFormat);
    virtual audio_format_t getPCMFormat(const sp<AMessage> &);
    virtual void setPCMFormat(const sp<AMessage> &, audio_format_t audioFormat);
    virtual void setSourcePCMFormat(const sp<MetaData> &);
    virtual void setDecodedPCMFormat(const sp<AMessage> &);

    // ----- NO TRESSPASSING BEYOND THIS LINE ------
    DECLARE_LOADABLE_SINGLETON(AVNuUtils);
+18 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@
#include <nuplayer/NuPlayer.h>
#include <nuplayer/NuPlayerDecoderBase.h>
#include <nuplayer/NuPlayerDecoderPassThrough.h>
#include <nuplayer/NuPlayerDecoder.h>
#include <nuplayer/NuPlayerCCDecoder.h>
#include <gui/Surface.h>
#include <nuplayer/NuPlayerSource.h>
#include <nuplayer/NuPlayerRenderer.h>

@@ -56,6 +59,21 @@ sp<NuPlayer::DecoderBase> AVNuFactory::createPassThruDecoder(
    return new NuPlayer::DecoderPassThrough(notify, source, renderer);
}

sp<NuPlayer::DecoderBase> AVNuFactory::createDecoder(
            const sp<AMessage> &notify,
            const sp<NuPlayer::Source> &source,
            pid_t pid,
            const sp<NuPlayer::Renderer> &renderer) {
    return new NuPlayer::Decoder(notify, source, pid, renderer);
}

sp<NuPlayer::Renderer> AVNuFactory::createRenderer(
            const sp<MediaPlayerBase::AudioSink> &sink,
            const sp<AMessage> &notify,
            uint32_t flags) {
    return new NuPlayer::Renderer(sink, notify, flags);
}

// ----- NO TRESSPASSING BEYOND THIS LINE ------
AVNuFactory::AVNuFactory() {
}
+46 −0
Original line number Diff line number Diff line
@@ -56,6 +56,52 @@ void AVNuUtils::addFlagsInMeta(const sp<ABuffer> & /*buffer*/,
        int32_t /*flags*/, bool /*isAudio*/) {
}

bool AVNuUtils::pcmOffloadException(const sp<AMessage> &) {
    return true;
}

bool AVNuUtils::isRAWFormat(const sp<MetaData> &) {
    return false;
}

bool AVNuUtils::isRAWFormat(const sp<AMessage> &) {
    return false;
}

int AVNuUtils::updateAudioBitWidth(audio_format_t /*audioFormat*/,
        const sp<AMessage> &){
    return 16;
}

audio_format_t AVNuUtils::getKeyPCMFormat(const sp<MetaData> &) {
    return AUDIO_FORMAT_INVALID;
}

void AVNuUtils::setKeyPCMFormat(const sp<MetaData> &, audio_format_t /*audioFormat*/) {

}

audio_format_t AVNuUtils::getPCMFormat(const sp<AMessage> &) {
    return AUDIO_FORMAT_PCM_16_BIT;
}

void AVNuUtils::setPCMFormat(const sp<AMessage> &, audio_format_t /*audioFormat*/) {

}

void AVNuUtils::setSourcePCMFormat(const sp<MetaData> &) {

}

void AVNuUtils::setDecodedPCMFormat(const sp<AMessage> &) {

}


void AVNuUtils::overWriteAudioOutputFormat(
       sp <AMessage> & /*dst*/, const sp <AMessage> & /*src*/) {
}

void AVNuUtils::checkFormatChange(bool * /*formatChange*/,
        const sp<ABuffer> & /*accessUnit*/) {
}
+3 −4
Original line number Diff line number Diff line
@@ -115,12 +115,11 @@ 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 void setPcmSampleBits(const sp<MetaData> &, int32_t /*bitWidth*/);
    virtual void setPcmSampleBits(const sp<AMessage> &, int32_t /*bitWidth*/);

    virtual audio_format_t updateAudioFormat(audio_format_t audioFormat,
            const sp<AMessage> &);
    virtual bool canOffloadAPE(const sp<MetaData> &meta);

    virtual bool useQCHWEncoder(const sp<AMessage> &,Vector<AString> *) { return false; }

    virtual int32_t getAudioMaxInputBufferSize(audio_format_t audioFormat,
+2 −6
Original line number Diff line number Diff line
@@ -68,14 +68,10 @@ int AVUtils::getAudioSampleBits(const sp<AMessage> &) {
    return 16;
}

audio_format_t AVUtils::updateAudioFormat(audio_format_t audioFormat,
        const sp<MetaData> &){
    return audioFormat;
void AVUtils::setPcmSampleBits(const sp<AMessage> &, int32_t /*bitWidth*/) {
}

audio_format_t AVUtils::updateAudioFormat(audio_format_t audioFormat,
        const sp<AMessage> &){
    return audioFormat;
void AVUtils::setPcmSampleBits(const sp<MetaData> &, int32_t /*bitWidth*/) {
}

static bool dumbSniffer(
Loading