Bug 1296531 - Don't wait for TracksAvailableCallback if tracks are already available. r?jesup
MozReview-Commit-ID: JQMyhhxaLLq
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -474,34 +474,38 @@ public:
{
LOG(LogLevel::Debug, ("Session.Start %p", this));
MOZ_ASSERT(NS_IsMainThread());
DOMMediaStream* domStream = mRecorder->Stream();
if (domStream) {
// The callback reports back when tracks are available and can be
// attached to MediaEncoder. This allows `recorder.start()` before any tracks are available.
- // We have supported this historically and have mochitests assuming this.
+ // We have supported this historically and have mochitests assuming this behavior.
TracksAvailableCallback* tracksAvailableCallback = new TracksAvailableCallback(this);
domStream->OnTracksAvailable(tracksAvailableCallback);
- } else if (mRecorder->mAudioNode) {
+ return;
+ }
+
+ if (mRecorder->mAudioNode) {
// Check that we may access the audio node's content.
if (!AudioNodePrincipalSubsumes()) {
LOG(LogLevel::Warning, ("Session.Start AudioNode principal check failed"));
DoSessionEndTask(NS_ERROR_DOM_SECURITY_ERR);
return;
}
TrackRate trackRate = mRecorder->mAudioNode->Context()->Graph()->GraphRate();
// Web Audio node has only audio.
InitEncoder(ContainerWriter::CREATE_AUDIO_TRACK, trackRate);
- } else {
- MOZ_ASSERT(false, "Unknown source");
+ return;
}
+
+ MOZ_ASSERT(false, "Unknown source");
}
void Stop()
{
LOG(LogLevel::Debug, ("Session.Stop %p", this));
MOZ_ASSERT(NS_IsMainThread());
mStopIssued = true;