mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 1286041 - Assert audio callback is not called in initialized state. r=jwwang
This commit is contained in:
parent
ff133bd20d
commit
d635328838
@ -400,9 +400,12 @@ AudioStream::Start()
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
MOZ_ASSERT(mState == INITIALIZED);
|
||||
mState = STARTED;
|
||||
auto r = InvokeCubeb(cubeb_stream_start);
|
||||
mState = r == CUBEB_OK ? STARTED : ERRORED;
|
||||
LOG("started, state %s", mState == STARTED ? "STARTED" : "ERRORED");
|
||||
if (r != CUBEB_OK) {
|
||||
mState = ERRORED;
|
||||
}
|
||||
LOG("started, state %s", mState == STARTED ? "STARTED" : mState == DRAINED ? "DRAINED" : "ERRORED");
|
||||
}
|
||||
|
||||
void
|
||||
@ -593,13 +596,7 @@ AudioStream::DataCallback(void* aBuffer, long aFrames)
|
||||
auto writer = AudioBufferWriter(
|
||||
reinterpret_cast<AudioDataValue*>(aBuffer), mOutChannels, aFrames);
|
||||
|
||||
// FIXME: cubeb_pulse sometimes calls us before cubeb_stream_start() is called.
|
||||
// We don't want to consume audio data until Start() is called by the client.
|
||||
if (mState == INITIALIZED) {
|
||||
NS_WARNING("data callback fires before cubeb_stream_start() is called");
|
||||
mAudioClock.UpdateFrameHistory(0, aFrames);
|
||||
return writer.WriteZeros(aFrames);
|
||||
}
|
||||
MOZ_ASSERT(mState != INITIALIZED);
|
||||
|
||||
// NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState == SHUTDOWN)
|
||||
// Bug 996162
|
||||
|
Loading…
Reference in New Issue
Block a user