Bug 1676551 - part1 : handle rejected promise when fail to start the audio sink. r=padenot

In the change from bug1674597, AudioSinkWrapper only handles the promise when we succeed opening AudioSink. However, it forgots to handle the promise when fail to start AudioSink.

Differential Revision: https://phabricator.services.mozilla.com/D96738
This commit is contained in:
alwu 2020-11-13 16:10:15 +00:00
parent f50c3a4253
commit f798106d65

View File

@ -170,15 +170,15 @@ nsresult AudioSinkWrapper::Start(const TimeUnit& aStartTime,
if (rv.isErr()) {
mEndedPromise =
MediaSink::EndedPromise::CreateAndReject(rv.unwrapErr(), __func__);
return rv.unwrapErr();
} else {
mEndedPromise = rv.unwrap();
}
mEndedPromise = rv.unwrap();
mEndedPromise
->Then(mOwnerThread.get(), __func__, this,
&AudioSinkWrapper::OnAudioEnded, &AudioSinkWrapper::OnAudioEnded)
->Track(mAudioSinkEndedPromise);
return NS_OK;
return rv.isErr() ? rv.unwrapErr() : NS_OK;
}
bool AudioSinkWrapper::IsAudioSourceEnded(const MediaInfo& aInfo) const {