Bug 1277188. Part 5 - rename AudioClock::SetPlaybackRateUnlocked(). r=kinetik.
MozReview-Commit-ID: C7m8xeMAJES
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -182,17 +182,17 @@ nsresult AudioStream::SetPlaybackRate(do
if (aPlaybackRate == mAudioClock.GetPlaybackRate()) {
return NS_OK;
}
if (EnsureTimeStretcherInitializedUnlocked() != NS_OK) {
return NS_ERROR_FAILURE;
}
- mAudioClock.SetPlaybackRateUnlocked(aPlaybackRate);
+ mAudioClock.SetPlaybackRate(aPlaybackRate);
mOutRate = mInRate / aPlaybackRate;
if (mAudioClock.GetPreservesPitch()) {
mTimeStretcher->setTempo(aPlaybackRate);
mTimeStretcher->setRate(1.0f);
} else {
mTimeStretcher->setTempo(1.0f);
mTimeStretcher->setRate(aPlaybackRate);
@@ -668,17 +668,17 @@ int64_t AudioClock::GetPositionInFrames(
return (GetPosition(frames) * mInRate) / USECS_PER_S;
}
int64_t AudioClock::GetPosition(int64_t frames) const
{
return mFrameHistory->GetPosition(frames);
}
-void AudioClock::SetPlaybackRateUnlocked(double aPlaybackRate)
+void AudioClock::SetPlaybackRate(double aPlaybackRate)
{
mOutRate = static_cast<uint32_t>(mInRate / aPlaybackRate);
}
double AudioClock::GetPlaybackRate() const
{
return static_cast<double>(mInRate) / mOutRate;
}
--- a/dom/media/AudioStream.h
+++ b/dom/media/AudioStream.h
@@ -56,19 +56,17 @@ public:
* @param frames The playback position in frames of the audio engine.
* @return The playback position in microseconds of the stream,
* adjusted by playback rate changes and underrun frames.
*/
int64_t GetPosition(int64_t frames) const;
// Set the playback rate.
// Called on the audio thread.
- // Assumes the AudioStream lock is held and thus calls Unlocked versions
- // of AudioStream funcs.
- void SetPlaybackRateUnlocked(double aPlaybackRate);
+ void SetPlaybackRate(double aPlaybackRate);
// Get the current playback rate.
// Called on the audio thread.
double GetPlaybackRate() const;
// Set if we are preserving the pitch.
// Called on the audio thread.
void SetPreservesPitch(bool aPreservesPitch);
// Get the current pitch preservation state.
// Called on the audio thread.