Bug 846687 - Set the transport as non-seekable if the server sends Accept-Ranges, but no Content-Duration. r=cpearce

This commit is contained in:
Paul Adenot 2013-03-01 19:55:01 +01:00
parent 67ec77499c
commit 8434bba8b7
2 changed files with 8 additions and 2 deletions

View File

@ -1263,10 +1263,10 @@ void MediaDecoder::SetMediaSeekable(bool aMediaSeekable) {
void MediaDecoder::SetTransportSeekable(bool aTransportSeekable)
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
MOZ_ASSERT(NS_IsMainThread() || OnDecodeThread());
mTransportSeekable = aTransportSeekable;
if (mDecoderStateMachine) {
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mDecoderStateMachine->SetTransportSeekable(aTransportSeekable);
}
}

View File

@ -365,6 +365,12 @@ nsresult OggReader::ReadMetadata(VideoInfo* aInfo,
LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime));
}
mDecoder->GetResource()->EndSeekingForMetadata();
} else {
// We don't have a duration, we and we don't know enough about the resource
// to try a seek. Abort trying to get a duration. This happens for example
// when the server says it accepts range requests, but does not give us a
// Content-Length.
mDecoder->SetTransportSeekable(false);
}
} else {
return NS_ERROR_FAILURE;