Bug 1276840 - Remove AudioStream::RUNNING. r=kinetik.
MozReview-Commit-ID: 3sCGYifUxJO
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -436,17 +436,17 @@ void
AudioStream::Pause()
{
MonitorAutoLock mon(mMonitor);
if (mState == ERRORED) {
return;
}
- if (mState != STARTED && mState != RUNNING) {
+ if (mState != STARTED) {
mState = STOPPED; // which also tells async OpenCubeb not to start, just init
return;
}
int r = InvokeCubeb(cubeb_stream_stop);
if (mState != ERRORED && r == CUBEB_OK) {
mState = STOPPED;
}
@@ -621,21 +621,16 @@ AudioStream::DataCallback(void* aBuffer,
NS_WARNING("data callback fires before cubeb_stream_start() is called");
mAudioClock.UpdateFrameHistory(0, aFrames);
return writer.WriteZeros(aFrames);
}
// NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState == SHUTDOWN)
// Bug 996162
- // callback tells us cubeb succeeded initializing
- if (mState == STARTED) {
- mState = RUNNING;
- }
-
if (mInRate == mOutRate) {
GetUnprocessed(writer);
} else {
GetTimeStretched(writer);
}
// Always send audible frames first, and silent frames later.
// Otherwise it will break the assumption of FrameHistory.
--- a/dom/media/AudioStream.h
+++ b/dom/media/AudioStream.h
@@ -358,18 +358,17 @@ private:
// Output file for dumping audio
FILE* mDumpFile;
// Owning reference to a cubeb_stream.
UniquePtr<cubeb_stream, CubebDestroyPolicy> mCubebStream;
enum StreamState {
INITIALIZED, // Initialized, playback has not begun.
- STARTED, // cubeb started, but callbacks haven't started
- RUNNING, // DataCallbacks have started after STARTED, or after Resume().
+ STARTED, // cubeb started.
STOPPED, // Stopped by a call to Pause().
DRAINED, // StateCallback has indicated that the drain is complete.
ERRORED, // Stream disabled due to an internal error.
SHUTDOWN // Shutdown has been called
};
StreamState mState;
bool mIsFirst;