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

Commit 39c8969f authored by wjiang's avatar wjiang Committed by Steve Kondik
Browse files

audio: Add pause support for hardware omx component

-ADSP doesn't enter sleep state after wma playback is paused
and power suspended.
-No support for NT session pause in case of hardware component.
NT session need to be paused to put ADSP into power collapse.
-Add support of pause in stagefright to ensure device enters
suspend mode. Also add intermediate states to avoid concurrency
issues between read and pause.

(cherry picked from commit f0a2da308d5e683ccde2d3d6f52c651bff6634e6)
(cherry picked from commit 27dc50267c424242930afe4740f2ddf5161d6d2c)
(cherry picked from commit 20e8fd2241be5dcf48a03a6f2a7927b6cd1ac15f)
(cherry picked from commit 2a15a4bf9754bda6e53530f65f82fa64b27f0f4f)

Change-Id: I41b946b8c8805e6ee303646b63513b5b16514ef6
parent f415766d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -118,6 +118,9 @@ private:
    bool mPlaying;
    int64_t mStartPosUs;
    const uint32_t mCreateFlags;
#ifdef QCOM_HARDWARE
    bool mPauseRequired;
#endif

    static void AudioCallback(int event, void *user, void *info);
    void AudioCallback(int event, void *info);
+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ struct ExtendedCodec {

    static bool useHWAACDecoder(const char *mime);

    static bool isSourcePauseRequired(const char *componentName);

private:
    static const char* getMsgKey(int key );

+4 −0
Original line number Diff line number Diff line
@@ -370,6 +370,10 @@ private:
    status_t applyRotation();
    status_t waitForBufferFilled_l();

#ifdef QCOM_HARDWARE
    status_t resumeLocked(bool drainInputBuf);
#endif

    int64_t getDecodingTimeUs();

    status_t parseAVCCodecSpecificData(
+23 −4
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@
#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>

#ifdef QCOM_HARDWARE
#include <media/stagefright/ExtendedCodec.h>
#endif

#include "include/AwesomePlayer.h"

namespace android {
@@ -63,7 +67,11 @@ AudioPlayer::AudioPlayer(
      mPinnedTimeUs(-1ll),
      mPlaying(false),
      mStartPosUs(0),
      mCreateFlags(flags) {
      mCreateFlags(flags)
#ifdef QCOM_HARDWARE
      ,mPauseRequired(false)
#endif
      {
}

AudioPlayer::~AudioPlayer() {
@@ -254,7 +262,13 @@ status_t AudioPlayer::start(bool sourceAlreadyStarted) {
    mStarted = true;
    mPlaying = true;
    mPinnedTimeUs = -1ll;

#ifdef QCOM_HARDWARE
    const char *componentName;
    if (!(format->findCString(kKeyDecoderComponent, &componentName))) {
          componentName = "none";
    }
    mPauseRequired = ExtendedCodec::isSourcePauseRequired(componentName);
#endif
    return OK;
}

@@ -282,9 +296,11 @@ void AudioPlayer::pause(bool playPendingSamples) {
    mPlaying = false;
#ifdef QCOM_HARDWARE
    CHECK(mSource != NULL);
    if (mPauseRequired) {
        if (mSource->pause() == OK) {
            mSourcePaused = true;
        }
    }
#endif
}

@@ -390,6 +406,9 @@ void AudioPlayer::reset() {
    mStarted = false;
    mPlaying = false;
    mStartPosUs = 0;
#ifdef QCOM_HARDWARE
    mPauseRequired = false;
#endif
}

// static
+11 −0
Original line number Diff line number Diff line
@@ -915,6 +915,14 @@ bool ExtendedCodec::useHWAACDecoder(const char *mime) {
    return false;
}

bool ExtendedCodec::isSourcePauseRequired(const char *componentName) {
    /* pause is required for hardware component to release adsp resources */
    if (!strncmp(componentName, "OMX.qcom.", 9)) {
        return true;
    }
    return false;
}

} //namespace android

#else //ENABLE_AV_ENHANCEMENTS
@@ -1075,6 +1083,9 @@ namespace android {
        return;
    }

    bool ExtendedCodec::isSourcePauseRequired(const char *componentName) {
        return false;
    }
} //namespace android

#endif //ENABLE_AV_ENHANCEMENTS
Loading