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

Commit 3b4a2ba8 authored by Mingming Yin's avatar Mingming Yin Committed by Linux Build Service Account
Browse files

NuPlayer: Add support for non-streaming offload playback.

- Introduce mIsStreaming to identify non-streaming use case
  when setDataSourceAsync is called with valid fd.
- Call canOffloadStream with mIsStreaming instead of TRUE to
  support non-steaming compress offload playback.

Change-Id: Iecc0def40006c2c0884be6ea673185cce9883bb1
Conflicts:
media/libmediaplayerservice/nuplayer/NuPlayer.cpp
media/libmediaplayerservice/nuplayer/NuPlayer.h
parent 5f51ebf7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ NuPlayer::NuPlayer()
      mSourceFlags(0),
      mVideoIsAVC(false),
      mOffloadAudio(false),
      mIsStreaming(true),
      mAudioDecoderGeneration(0),
      mVideoDecoderGeneration(0),
      mRendererGeneration(0),
@@ -191,6 +192,7 @@ void NuPlayer::setDataSourceAsync(const sp<IStreamSource> &source) {

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

    mIsStreaming = true;
    msg->setObject("source", new StreamingSource(notify, source));
    msg->post();
}
@@ -249,6 +251,7 @@ void NuPlayer::setDataSourceAsync(
            ALOGE("Failed to set data source!");
        }
    }
    mIsStreaming = true;
    msg->setObject("source", source);
    msg->post();
}
@@ -267,6 +270,7 @@ void NuPlayer::setDataSourceAsync(int fd, int64_t offset, int64_t length) {
        ALOGE("Failed to set data source!");
        source = NULL;
    }
    mIsStreaming = false;

    msg->setObject("source", source);
    msg->post();
@@ -616,7 +620,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {

            mOffloadAudio =
                canOffloadStream(audioMeta, (videoFormat != NULL), vMeta,
                                 true /* is_streaming */, streamType);
                                 mIsStreaming /* is_streaming */, streamType);
            if (mOffloadAudio) {
                flags |= Renderer::FLAG_OFFLOAD_AUDIO;
            }
+1 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ private:
    sp<Decoder> mVideoDecoder;
    bool mVideoIsAVC;
    bool mOffloadAudio;
    bool mIsStreaming;
    sp<Decoder> mAudioDecoder;
    sp<CCDecoder> mCCDecoder;
    sp<Renderer> mRenderer;