mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 802661: Clean up getUserMedia MediaStream handling r=roc,anant
This commit is contained in:
parent
6fac36bac0
commit
bb05ef58b2
@ -125,7 +125,12 @@ MediaEngineWebRTCAudioSource::Stop()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mState = kStopped;
|
||||
{
|
||||
ReentrantMonitorAutoEnter enter(mMonitor);
|
||||
mState = kStopped;
|
||||
mSource->EndTrack(mTrackID);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -224,6 +229,8 @@ MediaEngineWebRTCAudioSource::Process(const int channel,
|
||||
const int length, const int samplingFreq, const bool isStereo)
|
||||
{
|
||||
ReentrantMonitorAutoEnter enter(mMonitor);
|
||||
if (mState != kStarted)
|
||||
return;
|
||||
|
||||
nsRefPtr<SharedBuffer> buffer = SharedBuffer::Create(length * sizeof(sample));
|
||||
|
||||
|
@ -102,7 +102,6 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
||||
VideoSegment segment;
|
||||
|
||||
ReentrantMonitorAutoEnter enter(mMonitor);
|
||||
|
||||
if (mState != kStarted)
|
||||
return;
|
||||
|
||||
@ -278,14 +277,16 @@ MediaEngineWebRTCVideoSource::Stop()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mSource->EndTrack(mTrackID);
|
||||
mSource->Finish();
|
||||
{
|
||||
ReentrantMonitorAutoEnter enter(mMonitor);
|
||||
mState = kStopped;
|
||||
mSource->EndTrack(mTrackID);
|
||||
}
|
||||
|
||||
mViERender->StopRender(mCaptureIndex);
|
||||
mViERender->RemoveRenderer(mCaptureIndex);
|
||||
mViECapture->StopCapture(mCaptureIndex);
|
||||
|
||||
mState = kStopped;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,9 @@ public:
|
||||
mVideoSource->Stop();
|
||||
mVideoSource->Deallocate();
|
||||
}
|
||||
// Do this after stopping all tracks with EndTrack()
|
||||
mStream->GetStream()->AsSourceStream()->Finish();
|
||||
|
||||
nsCOMPtr<GetUserMediaNotificationEvent> event =
|
||||
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STOPPING);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user