Bug 723860 - Early bail from reader's GetBuffered() if not yet initialized. r=doublec

This commit is contained in:
Matthew Gregan 2012-06-06 17:58:07 +12:00
parent 1665611abc
commit 1fc0488427
3 changed files with 8 additions and 2 deletions

View File

@ -505,6 +505,10 @@ nsresult nsGStreamerReader::Seek(PRInt64 aTarget,
nsresult nsGStreamerReader::GetBuffered(nsTimeRanges* aBuffered,
PRInt64 aStartTime)
{
if (!mInfo.mHasVideo && !mInfo.mHasAudio) {
return NS_OK;
}
GstFormat format = GST_FORMAT_TIME;
MediaResource* resource = mDecoder->GetResource();
gint64 resourceLength = resource->GetLength();

View File

@ -1532,8 +1532,7 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
{
// HasAudio and HasVideo are not used here as they take a lock and cause
// a deadlock. Accessing mInfo doesn't require a lock - it doesn't change
// after metadata is read and GetBuffered isn't called before metadata is
// read.
// after metadata is read.
if (!mInfo.mHasVideo && !mInfo.mHasAudio) {
// No need to search through the file if there are no audio or video tracks
return NS_OK;

View File

@ -239,6 +239,9 @@ static double RoundToUsecs(double aSeconds) {
nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
{
if (!mInfo.mHasAudio) {
return NS_OK;
}
PRInt64 startOffset = mDecoder->GetResource()->GetNextCachedData(mWavePCMOffset);
while (startOffset >= 0) {
PRInt64 endOffset = mDecoder->GetResource()->GetCachedDataEnd(startOffset);