mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 899935 - Produce zero-length output if calling Stop right after a Start call of MediaRecorder. r=roc
This commit is contained in:
parent
6f3bfc2065
commit
fcd6eb5264
@ -89,10 +89,14 @@ public:
|
||||
NS_IMETHODIMP Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mRecorder->mState = RecordingState::Inactive;
|
||||
mRecorder->DispatchSimpleEvent(NS_LITERAL_STRING("stop"));
|
||||
mRecorder->mReadThread->Shutdown();
|
||||
mRecorder->mReadThread = nullptr;
|
||||
|
||||
// Setting mState to Inactive here is for the case where SourceStream
|
||||
// ends itself, thus the recorder should stop itself too.
|
||||
mRecorder->mState = RecordingState::Inactive;
|
||||
mRecorder->DispatchSimpleEvent(NS_LITERAL_STRING("stop"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -154,7 +158,7 @@ MediaRecorder::ExtractEncodedData()
|
||||
NS_DispatchToMainThread(new PushBlobTask(this));
|
||||
lastBlobTimeStamp = TimeStamp::Now();
|
||||
}
|
||||
} while (mState == RecordingState::Recording && !mEncoder->IsShutdown());
|
||||
} while (!mEncoder->IsShutdown());
|
||||
|
||||
NS_DispatchToMainThread(new PushBlobTask(this));
|
||||
}
|
||||
@ -229,7 +233,12 @@ MediaRecorder::Stop(ErrorResult& aResult)
|
||||
return;
|
||||
}
|
||||
mState = RecordingState::Inactive;
|
||||
mTrackUnionStream->RemoveListener(mEncoder);
|
||||
|
||||
mStreamPort->Destroy();
|
||||
mStreamPort = nullptr;
|
||||
|
||||
mTrackUnionStream->Destroy();
|
||||
mTrackUnionStream = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -82,7 +82,7 @@ AudioTrackEncoder::NotifyEndOfStream()
|
||||
// If source audio chunks are completely silent till the end of encoding,
|
||||
// initialize the encoder with default channel counts and sampling rate, and
|
||||
// append this many null data to the segment of track encoder.
|
||||
if (!mCanceled && !mInitialized && mSilentDuration > 0) {
|
||||
if (!mCanceled && !mInitialized) {
|
||||
Init(DEFAULT_CHANNELS, DEFAULT_SAMPLING_RATE);
|
||||
mRawSegment->AppendNullData(mSilentDuration);
|
||||
mSilentDuration = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user