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

This commit is contained in:
Paul Adenot 2013-03-01 19:55:01 +01:00
Родитель 2067e704b4
Коммит 4e28d37be4
2 изменённых файлов: 8 добавлений и 2 удалений

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

@ -1262,10 +1262,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);
}
}

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

@ -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 if (mDecoder->GetMediaDuration() == -1) {
// We don't have a duration, 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;