Bug 900811 - Fix the hang if closing its tab during recording a fake gUM. r=roc

This commit is contained in:
Shelly Lin 2013-08-02 14:59:30 +08:00
Родитель ae052c7acf
Коммит 78d33c4c72
2 изменённых файлов: 11 добавлений и 8 удалений

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

@ -67,16 +67,24 @@ AudioTrackEncoder::NotifyRemoved(MediaStreamGraph* aGraph)
{
// In case that MediaEncoder does not receive a TRACK_EVENT_ENDED event.
LOG("[AudioTrackEncoder]: NotifyRemoved.");
NotifyEndOfStream();
}
void
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 (!mInitialized && mSilentDuration > 0) {
if (!mCanceled && !mInitialized && mSilentDuration > 0) {
Init(DEFAULT_CHANNELS, DEFAULT_SAMPLING_RATE);
mRawSegment->AppendNullData(mSilentDuration);
mSilentDuration = 0;
}
NotifyEndOfStream();
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mEndOfStream = true;
mReentrantMonitor.NotifyAll();
}
nsresult

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

@ -130,12 +130,7 @@ protected:
* Notifies the audio encoder that we have reached the end of source stream,
* and wakes up mReentrantMonitor if encoder is waiting for more track data.
*/
void NotifyEndOfStream()
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mEndOfStream = true;
mReentrantMonitor.NotifyAll();
}
void NotifyEndOfStream();
/**
* Interleaves the track data and stores the result into aOutput. Might need