mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187817. Part 1 - Move Set{Volume,PlaybackRate,PreservesPitch} to the audio thread. r=kinetik.
This commit is contained in:
parent
13ce72b0cf
commit
47df8c722d
@ -159,26 +159,41 @@ AudioSink::Shutdown()
|
||||
void
|
||||
AudioSink::SetVolume(double aVolume)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mVolume = aVolume;
|
||||
mSetVolume = true;
|
||||
AssertNotOnAudioThread();
|
||||
nsRefPtr<AudioSink> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
if (self->mState == AUDIOSINK_STATE_PLAYING) {
|
||||
self->mAudioStream->SetVolume(aVolume);
|
||||
}
|
||||
});
|
||||
DispatchTask(r.forget());
|
||||
}
|
||||
|
||||
void
|
||||
AudioSink::SetPlaybackRate(double aPlaybackRate)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
NS_ASSERTION(mPlaybackRate != 0, "Don't set the playbackRate to 0 on AudioStream");
|
||||
mPlaybackRate = aPlaybackRate;
|
||||
mSetPlaybackRate = true;
|
||||
AssertNotOnAudioThread();
|
||||
MOZ_ASSERT(aPlaybackRate != 0, "Don't set the playbackRate to 0 on AudioStream");
|
||||
nsRefPtr<AudioSink> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
if (self->mState == AUDIOSINK_STATE_PLAYING) {
|
||||
self->mAudioStream->SetPlaybackRate(aPlaybackRate);
|
||||
}
|
||||
});
|
||||
DispatchTask(r.forget());
|
||||
}
|
||||
|
||||
void
|
||||
AudioSink::SetPreservesPitch(bool aPreservesPitch)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mPreservesPitch = aPreservesPitch;
|
||||
mSetPreservesPitch = true;
|
||||
AssertNotOnAudioThread();
|
||||
nsRefPtr<AudioSink> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
if (self->mState == AUDIOSINK_STATE_PLAYING) {
|
||||
self->mAudioStream->SetPreservesPitch(aPreservesPitch);
|
||||
}
|
||||
});
|
||||
DispatchTask(r.forget());
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user