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

Commit 84565432 authored by Li Sun's avatar Li Sun Committed by Steve Kondik
Browse files

NuPlayer: use video hardware codec only

- if the client has the specific request,
  only use video hardware codec for nuplayer

Change-Id: Id6dd13b99d02ea4466f2014e0e4b3ff9b3f7e492
parent d8ee6bfb
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -161,7 +161,8 @@ NuPlayer::NuPlayer()
      mNumFramesDropped(0ll),
      mVideoScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW),
      mStarted(false),
      mSeeking(false) {
      mSeeking(false),
      isCodecSpecific(false) {
}

NuPlayer::~NuPlayer() {
@@ -216,6 +217,13 @@ void NuPlayer::setDataSourceAsync(

    sp<AMessage> notify = new AMessage(kWhatSourceNotify, id());

    if (headers) {
        ssize_t index = headers->indexOfKey(String8("codecspecific"));
        if (index >= 0) {
            isCodecSpecific = true;
        }
    }

    sp<Source> source;
    if (IsHTTPLiveURL(url)) {
        source = new HTTPLiveSource(notify, url, headers, mUIDValid, mUID);
@@ -922,6 +930,8 @@ status_t NuPlayer::instantiateDecoder(bool audio, sp<Decoder> *decoder) {
        AString mime;
        CHECK(format->findString("mime", &mime));
        mVideoIsAVC = !strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime.c_str());
        if(isCodecSpecific)
            format->setInt32("hardwarecodecOnly", 1);
    }

    sp<AMessage> notify =
+2 −0
Original line number Diff line number Diff line
@@ -160,6 +160,8 @@ private:
    bool mStarted;
    bool mSeeking;

    bool isCodecSpecific;

    status_t instantiateDecoder(bool audio, sp<Decoder> *decoder);

    status_t feedDecoderInputData(bool audio, const sp<AMessage> &msg);
+6 −2
Original line number Diff line number Diff line
@@ -3734,7 +3734,11 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
        // about any notifications in the afterlife.
        mDeathNotifier.clear();
    }

    int32_t hardwarecodecOnly = 0;
    if (msg->findInt32("hardwarecodecOnly", &hardwarecodecOnly)
            && hardwarecodecOnly == 1) {
        ALOGV("use hardware codec only");
    }
    Vector<OMXCodec::CodecNameAndQuirks> matchingCodecs;

    AString mime;
@@ -3769,7 +3773,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
                mime.c_str(),
                encoder, // createEncoder
                NULL,  // matchComponentName
                0,     // flags
                hardwarecodecOnly ? OMXCodec::kHardwareCodecsOnly : 0,     // flags
                &matchingCodecs);
    }