Bug 693391 - Pin nsMediaStream while determining buffered ranges. r=roc

This commit is contained in:
Chris Pearce 2011-03-24 11:28:58 +13:00
Родитель 740652ece1
Коммит 3bc0fa6ae7
2 изменённых файлов: 10 добавлений и 3 удалений

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

@ -1668,3 +1668,12 @@ void nsBuiltinDecoderStateMachine::StartBuffering()
stats.mPlaybackRate/1024, stats.mPlaybackRateReliable ? "" : " (unreliable)",
stats.mDownloadRate/1024, stats.mDownloadRateReliable ? "" : " (unreliable)"));
}
nsresult nsBuiltinDecoderStateMachine::GetBuffered(nsTimeRanges* aBuffered) {
nsMediaStream* stream = mDecoder->GetCurrentStream();
NS_ENSURE_TRUE(stream, NS_ERROR_FAILURE);
stream->Pin();
nsresult res = mReader->GetBuffered(aBuffered, mStartTime);
stream->Unpin();
return res;
}

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

@ -235,9 +235,7 @@ public:
// Accessed on state machine, audio, main, and AV thread.
State mState;
nsresult GetBuffered(nsTimeRanges* aBuffered) {
return mReader->GetBuffered(aBuffered, mStartTime);
}
nsresult GetBuffered(nsTimeRanges* aBuffered);
void NotifyDataArrived(const char* aBuffer, PRUint32 aLength, PRUint32 aOffset) {
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");