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

Commit 0a62c194 authored by Ronghua Wu's avatar Ronghua Wu Committed by Android (Google) Code Review
Browse files

Merge "libmediaplayerservice: get isStreaming info from source." into mnc-dev

parents 96de55f3 02cb98d7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -324,6 +324,10 @@ status_t NuPlayer::GenericSource::setBuffers(
    return INVALID_OPERATION;
}

bool NuPlayer::GenericSource::isStreaming() const {
    return mIsStreaming;
}

NuPlayer::GenericSource::~GenericSource() {
    if (mLooper != NULL) {
        mLooper->unregisterHandler(id());
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ struct NuPlayer::GenericSource : public NuPlayer::Source {

    virtual status_t setBuffers(bool audio, Vector<MediaBuffer *> &buffers);

    virtual bool isStreaming() const;

protected:
    virtual ~GenericSource();

+3 −4
Original line number Diff line number Diff line
@@ -834,7 +834,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
                audio_stream_type_t streamType = mAudioSink->getAudioStreamType();
                const bool hasVideo = (videoFormat != NULL);
                const bool canOffload = canOffloadStream(
                        audioMeta, hasVideo, true /* is_streaming */, streamType);
                        audioMeta, hasVideo, mSource->isStreaming(), streamType);
                if (canOffload) {
                    if (!mOffloadAudio) {
                        mRenderer->signalEnableOffloadAudio();
@@ -1107,7 +1107,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
                    audio_stream_type_t streamType = mAudioSink->getAudioStreamType();
                    const bool hasVideo = (videoFormat != NULL);
                    const bool canOffload = canOffloadStream(
                            audioMeta, hasVideo, true /* is_streaming */, streamType);
                            audioMeta, hasVideo, mSource->isStreaming(), streamType);
                    if (canOffload) {
                        mRenderer->signalEnableOffloadAudio();
                        sp<AMessage> format = mSource->getFormat(true /*audio*/);
@@ -1288,8 +1288,7 @@ void NuPlayer::onStart(int64_t startPositionUs) {
    sp<AMessage> videoFormat = mSource->getFormat(false /* audio */);

    mOffloadAudio =
        canOffloadStream(audioMeta, (videoFormat != NULL),
                         true /* is_streaming */, streamType);
        canOffloadStream(audioMeta, (videoFormat != NULL), mSource->isStreaming(), streamType);
    if (mOffloadAudio) {
        flags |= Renderer::FLAG_OFFLOAD_AUDIO;
    }
+4 −0
Original line number Diff line number Diff line
@@ -118,6 +118,10 @@ struct NuPlayer::Source : public AHandler {
        return false;
    }

    virtual bool isStreaming() const {
        return true;
    }

protected:
    virtual ~Source() {}