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

Commit 16590077 authored by Leena Winterrowd's avatar Leena Winterrowd Committed by Steve Kondik
Browse files

libstagefright: Add hooks for extended media utils

Add following enhancements:
 - Shell property to disable audio
   property: persist.debug.sf.noaudio
   0 = all audio enabled
   1 = audio decode disabled (AwesomePlayer)
   2 = audio encode disabled (StagefrightRecorder)
   3 = audio encode & decode disabled
 - Shell property to override encoding profiles
   property: encoder.video.profile
   H264 profiles: base, main, high
   MPEG4 profiles: simple, asp

CRs: 573176

Change-Id: Iec32177cae40b0de606b52bbbd41eb24b1643c56
parent 41fbca0b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ status_t StagefrightRecorder::setAudioSource(audio_source_t as) {
        return BAD_VALUE;
    }
#ifdef QCOM_HARDWARE
    if (ExtendedUtils::ShellProp::isAudioDisabled()) {
    if (ExtendedUtils::ShellProp::isAudioDisabled(true)) {
        return OK;
    }
#endif
@@ -176,10 +176,11 @@ status_t StagefrightRecorder::setAudioEncoder(audio_encoder ae) {
    }

#ifdef QCOM_HARDWARE
    if (ExtendedUtils::ShellProp::isAudioDisabled()) {
    if (ExtendedUtils::ShellProp::isAudioDisabled(true)) {
        return OK;
    }
#endif

    if (ae == AUDIO_ENCODER_DEFAULT) {
        mAudioEncoder = AUDIO_ENCODER_AMR_NB;
    } else {
+10 −1
Original line number Diff line number Diff line
@@ -61,6 +61,9 @@
#include <media/stagefright/MetaData.h>
#include <media/stagefright/OMXCodec.h>
#include <media/stagefright/Utils.h>
#ifdef QCOM_HARDWARE
#include "include/ExtendedUtils.h"
#endif

#include <gui/IGraphicBufferProducer.h>
#include <gui/Surface.h>
@@ -256,7 +259,9 @@ AwesomePlayer::AwesomePlayer()
    mIsTunnelAudio = false;
#endif

#ifdef QCOM_HARDWARE
    mLateAVSyncMargin = ExtendedUtils::ShellProp::getMaxAVSyncLateMargin();
#endif
}

AwesomePlayer::~AwesomePlayer() {
@@ -534,7 +539,11 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
                    &mStats.mTracks.editItemAt(mStats.mVideoTrackIndex);
                stat->mMIME = mime.string();
            }
        } else if (!haveAudio && !strncasecmp(mime.string(), "audio/", 6)) {
        } else if (!haveAudio &&
#ifdef QCOM_HARDWARE
                !ExtendedUtils::ShellProp::isAudioDisabled(false) &&
#endif
                !strncasecmp(mime.string(), "audio/", 6)) {
            setAudioSource(extractor->getTrack(i));
            haveAudio = true;
            mActiveAudioTrackIndex = i;
+5 −3
Original line number Diff line number Diff line
@@ -156,11 +156,13 @@ void ExtendedUtils::HFR::copyHFRParams(
    outputFormat->setInt32(kKeyFrameRate, frameRate);
}

bool ExtendedUtils::ShellProp::isAudioDisabled() {
bool ExtendedUtils::ShellProp::isAudioDisabled(bool isEncoder) {
    bool retVal = false;
    char disableAudio[PROPERTY_VALUE_MAX];
    property_get("persist.debug.sf.noaudio", disableAudio, "0");
    if (atoi(disableAudio) == 1) {
    if (isEncoder && (atoi(disableAudio) & 0x02)) {
        retVal = true;
    } else if (atoi(disableAudio) & 0x01) {
        retVal = true;
    }
    return retVal;
@@ -576,7 +578,7 @@ void ExtendedUtils::HFR::copyHFRParams(
        sp<MetaData> &outputFormat) {
}

bool ExtendedUtils::ShellProp::isAudioDisabled() {
bool ExtendedUtils::ShellProp::isAudioDisabled(bool isEncoder) {
    return false;
}

+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ struct ExtendedUtils {
     */
    struct ShellProp {
        // check if shell property to disable audio is set
        static bool isAudioDisabled();
        static bool isAudioDisabled(bool isEncoder);

        //helper function to set encoding profiles
        static void setEncoderProfile(video_encoder &videoEncoder,