Bug 2065821 - Clear SoundTouch state when discarding future audio r=media-playback-reviewers,karlt
ClearFutureData discards raw decoded samples but previously retained SoundTouch output derived from them. Clear its internal state too, so pause, seek, and reset do not continue playing discarded audio. Differential Revision: https://phabricator.services.mozilla.com/D320704
This commit is contained in:
committed by
cchang@mozilla.com
parent
e9610bf418
commit
ac8df485a6
@@ -353,6 +353,9 @@ void AudioDecoderInputTrack::HandleSPSCData(SPSCData& aData) {
|
||||
if (aData.IsClearFutureData()) {
|
||||
LOG("Clear future data");
|
||||
mBufferedData.Clear();
|
||||
if (mTimeStretcher) {
|
||||
mTimeStretcher->clear();
|
||||
}
|
||||
if (!Ended()) {
|
||||
LOG("Clear EOS");
|
||||
mReceivedEOS = false;
|
||||
|
||||
@@ -151,6 +151,10 @@ uint RLBoxSoundTouch::receiveSamples(AudioDataValue* aOutput,
|
||||
return numWrittenSamples;
|
||||
}
|
||||
|
||||
void RLBoxSoundTouch::clear() {
|
||||
return mSandbox.invoke_sandbox_function(Clear, mTimeStretcher);
|
||||
}
|
||||
|
||||
void RLBoxSoundTouch::flush() {
|
||||
return mSandbox.invoke_sandbox_function(Flush, mTimeStretcher);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,8 @@ class RLBoxSoundTouch {
|
||||
RLBOX_SOUNDTOUCH_API
|
||||
uint receiveSamples(mozilla::AudioDataValue* aOutput, uint aMaxSamples);
|
||||
RLBOX_SOUNDTOUCH_API
|
||||
void clear();
|
||||
RLBOX_SOUNDTOUCH_API
|
||||
void flush();
|
||||
|
||||
RLBOX_SOUNDTOUCH_API
|
||||
|
||||
@@ -56,5 +56,7 @@ uint ReceiveSamples(SoundTouch* mTimeStretcher, SAMPLETYPE* output,
|
||||
return mTimeStretcher->receiveSamples(output, maxSamples);
|
||||
}
|
||||
|
||||
void Clear(SoundTouch* mTimeStretcher) { mTimeStretcher->clear(); }
|
||||
|
||||
void Flush(SoundTouch* mTimeStretcher) { return mTimeStretcher->flush(); }
|
||||
}
|
||||
|
||||
@@ -22,5 +22,6 @@ void PutSamples(soundtouch::SoundTouch* mTimeStretcher,
|
||||
const soundtouch::SAMPLETYPE* samples, uint numSamples);
|
||||
uint ReceiveSamples(soundtouch::SoundTouch* mTimeStretcher,
|
||||
soundtouch::SAMPLETYPE* output, uint maxSamples);
|
||||
void Clear(soundtouch::SoundTouch* mTimeStretcher);
|
||||
void Flush(soundtouch::SoundTouch* mTimeStretcher);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user