Bug 1752345 - Remove the prefill quirk in AudioStream.cpp. r=alwu,kinetik

It's doing annoying cross-thread accesses that require the lock, and it's not
needed anyways these days.

Differential Revision: https://phabricator.services.mozilla.com/D137181
This commit is contained in:
Paul Adenot 2022-02-03 15:18:12 +00:00
Родитель 1b19f8ca22
Коммит d882853fe6
2 изменённых файлов: 0 добавлений и 22 удалений

Просмотреть файл

@ -141,7 +141,6 @@ AudioStream::AudioStream(DataSource& aSource)
mTimeStretcher(nullptr),
mState(INITIALIZED),
mDataSource(aSource),
mPrefillQuirk(false),
mAudioThreadId(ProfilerThreadId{}),
mSandboxed(CubebUtils::SandboxEnabled()) {}
@ -301,10 +300,6 @@ nsresult AudioStream::Init(uint32_t aNumChannels,
return NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR;
}
// cubeb's winmm backend prefills buffers on init rather than stream start.
// See https://github.com/kinetiknz/cubeb/issues/150
mPrefillQuirk = !strcmp(cubeb_get_backend_id(cubebContext), "winmm");
return OpenCubeb(cubebContext, params, startTime,
CubebUtils::GetFirstStream());
}
@ -630,21 +625,6 @@ long AudioStream::DataCallback(void* aBuffer, long aFrames) {
mOutChannels * aFrames),
mOutChannels, aFrames);
if (mPrefillQuirk) {
// Don't consume audio data until Start() is called.
// Expected only with cubeb winmm backend.
if (mState == INITIALIZED) {
NS_WARNING("data callback fires before cubeb_stream_start() is called");
mAudioClock.UpdateFrameHistory(0, aFrames);
return writer.WriteZeros(aFrames);
}
} else {
MOZ_ASSERT(mState != INITIALIZED);
}
// NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState
// == SHUTDOWN) Bug 996162
if (mAudioClock.GetInputRate() == mAudioClock.GetOutputRate()) {
GetUnprocessed(writer);
} else {

Просмотреть файл

@ -346,8 +346,6 @@ class AudioStream final {
DataSource& mDataSource;
bool mPrefillQuirk;
// The device info of the current sink. If null
// the default device is used. It is set
// during the Init() in decoder thread.