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

Commit d0115d8c authored by Eric Laurent's avatar Eric Laurent
Browse files

update offloaded audio track sampling rate

AudioPlayer must read the sampling rate from offloaded audio sinks
whenever a new time position is computed as the decoder can update
the sampling rate on the fly.

Bug: 12823955.

Change-Id: I997e5248cfd4017aeceb4e11689324ded2a5bc88
parent 7e92abea
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -661,7 +661,7 @@ protected:
    sp<AudioTrackThread>    mAudioTrackThread;
    float                   mVolume[2];
    float                   mSendLevel;
    uint32_t                mSampleRate;
    mutable uint32_t        mSampleRate;            // mutable because getSampleRate() can update it.
    size_t                  mFrameCount;            // corresponds to current IAudioTrack
    size_t                  mReqFrameCount;         // frame count to request the next time a new
                                                    // IAudioTrack is needed
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public:
        virtual status_t    getFramesWritten(uint32_t *frameswritten) const = 0;
        virtual int         getSessionId() const = 0;
        virtual audio_stream_type_t getAudioStreamType() const = 0;
        virtual uint32_t    getSampleRate() const = 0;

        // If no callback is specified, use the "write" API below to submit
        // audio data.
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ private:
    void reset();

    uint32_t getNumFramesPendingPlayout() const;
    int64_t getOutputPlayPositionUs_l() const;
    int64_t getOutputPlayPositionUs_l();

    bool allowDeepBuffering() const { return (mCreateFlags & ALLOW_DEEP_BUFFERING) != 0; }
    bool useOffload() const { return (mCreateFlags & USE_OFFLOAD) != 0; }
+7 −0
Original line number Diff line number Diff line
@@ -585,4 +585,11 @@ int VideoEditorPlayer::VeAudioOutput::getSessionId() const {
    return mSessionId;
}

uint32_t VideoEditorPlayer::VeAudioOutput::getSampleRate() const {
    if (mMsecsPerFrame == 0) {
        return 0;
    }
    return (uint32_t)(1.e3 / mMsecsPerFrame);
}

}  // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ class VideoEditorPlayer : public MediaPlayerInterface {
        virtual status_t        getPosition(uint32_t *position) const;
        virtual status_t        getFramesWritten(uint32_t*) const;
        virtual int             getSessionId() const;
        virtual uint32_t        getSampleRate() const;

        virtual status_t        open(
                uint32_t sampleRate, int channelCount, audio_channel_mask_t channelMask,
Loading