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

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

NuPlayer : send the correct streaming info while opening audio sink

 -For any offload playback NuPlayerRenderer always open the audio sink
  with isStreaming info as true.
 -Pass the streaming info to the NuPlayerRenderer while opening audio
  sink

Conflicts:
	media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp

Change-Id: Ic9d5e7ae0b82a316ec4b4a72037519448f1a011c
parent 2553099e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1504,7 +1504,7 @@ void NuPlayer::tryOpenAudioSinkForOffload(
    // is possible; otherwise the decoders call the renderer openAudioSink directly.

    status_t err = mRenderer->openAudioSink(
            format, true /* offloadOnly */, hasVideo, AUDIO_OUTPUT_FLAG_NONE, &mOffloadAudio);
            format, true /* offloadOnly */, hasVideo, AUDIO_OUTPUT_FLAG_NONE, &mOffloadAudio, mSource->isStreaming());
    if (err != OK) {
        // Any failure we turn off mOffloadAudio.
        mOffloadAudio = false;
+1 −1
Original line number Diff line number Diff line
@@ -654,7 +654,7 @@ void NuPlayer::Decoder::handleOutputFormatChange(const sp<AMessage> &format) {
        }

        status_t err = mRenderer->openAudioSink(
                format, false /* offloadOnly */, hasVideo, flags, NULL /* isOffloaed */);
                format, false /* offloadOnly */, hasVideo, flags, NULL /* isOffloaed */, mSource->isStreaming());
        if (err != OK) {
            handleError(err);
        }
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ void NuPlayer::DecoderPassThrough::onConfigure(const sp<AMessage> &format) {
    // format is different.
    status_t err = mRenderer->openAudioSink(
            format, true /* offloadOnly */, hasVideo,
            AUDIO_OUTPUT_FLAG_NONE /* flags */, NULL /* isOffloaded */);
            AUDIO_OUTPUT_FLAG_NONE /* flags */, NULL /* isOffloaded */, mSource->isStreaming());
    if (err != OK) {
        handleError(err);
    }
+10 −4
Original line number Diff line number Diff line
@@ -387,12 +387,14 @@ status_t NuPlayer::Renderer::openAudioSink(
        bool offloadOnly,
        bool hasVideo,
        uint32_t flags,
        bool *isOffloaded) {
        bool *isOffloaded,
        bool isStreaming) {
    sp<AMessage> msg = new AMessage(kWhatOpenAudioSink, this);
    msg->setMessage("format", format);
    msg->setInt32("offload-only", offloadOnly);
    msg->setInt32("has-video", hasVideo);
    msg->setInt32("flags", flags);
    msg->setInt32("isStreaming", isStreaming);

    sp<AMessage> response;
    status_t postStatus = msg->postAndAwaitResponse(&response);
@@ -431,7 +433,10 @@ void NuPlayer::Renderer::onMessageReceived(const sp<AMessage> &msg) {
            uint32_t flags;
            CHECK(msg->findInt32("flags", (int32_t *)&flags));

            status_t err = onOpenAudioSink(format, offloadOnly, hasVideo, flags);
            uint32_t isStreaming;
            CHECK(msg->findInt32("isStreaming", (int32_t *)&isStreaming));

            status_t err = onOpenAudioSink(format, offloadOnly, hasVideo, flags, isStreaming);

            sp<AMessage> response = new AMessage;
            response->setInt32("err", err);
@@ -1784,7 +1789,8 @@ status_t NuPlayer::Renderer::onOpenAudioSink(
        const sp<AMessage> &format,
        bool offloadOnly,
        bool hasVideo,
        uint32_t flags) {
        uint32_t flags,
        bool isStreaming) {
    ALOGV("openAudioSink: offloadOnly(%d) offloadingAudio(%d)",
            offloadOnly, offloadingAudio());

@@ -1857,7 +1863,7 @@ status_t NuPlayer::Renderer::onOpenAudioSink(
            offloadInfo.stream_type = AUDIO_STREAM_MUSIC;
            offloadInfo.bit_rate = avgBitRate;
            offloadInfo.has_video = hasVideo;
            offloadInfo.is_streaming = true;
            offloadInfo.is_streaming = isStreaming;
            offloadInfo.bit_width = bitWidth;
            offloadInfo.offload_buffer_size = offloadBufferSize;

+4 −2
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ struct NuPlayer::Renderer : public AHandler {
            bool offloadOnly,
            bool hasVideo,
            uint32_t flags,
            bool *isOffloaded);
            bool *isOffloaded,
            bool isStreaming);
    void closeAudioSink();
    void signalAudioTearDownComplete();

@@ -256,7 +257,8 @@ protected:
            const sp<AMessage> &format,
            bool offloadOnly,
            bool hasVideo,
            uint32_t flags);
            uint32_t flags,
            bool isStreaming);
    void onCloseAudioSink();
    void onAudioTearDownComplete();