зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1092996 - MSE/WebM: limit size read to what is available. r=kinetik
This commit is contained in:
Родитель
36fc612e81
Коммит
119321d8c2
|
@ -127,6 +127,10 @@ public:
|
|||
// Called from HTMLMediaElement when owner document activity changes
|
||||
virtual void SetElementVisibility(bool aIsVisible) {}
|
||||
|
||||
// Called by some MediaDecoderReader to determine if we can rely
|
||||
// on the resource length to limit reads.
|
||||
virtual bool HasInitializationData() { return false; }
|
||||
|
||||
// Stack based class to assist in notifying the frame statistics of
|
||||
// parsed and decoded frames. Use inside video demux & decode functions
|
||||
// to ensure all parsed and decoded frames are reported on all return paths.
|
||||
|
|
|
@ -119,6 +119,12 @@ SourceBufferDecoder::UpdatePlaybackPosition(int64_t aTime)
|
|||
MSE_DEBUG("SourceBufferDecoder(%p)::UpdatePlaybackPosition UNIMPLEMENTED", this);
|
||||
}
|
||||
|
||||
bool
|
||||
SourceBufferDecoder::HasInitializationData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
SourceBufferDecoder::OnReadMetadataCompleted()
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
virtual void SetMediaSeekable(bool aMediaSeekable) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual void UpdatePlaybackPosition(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
|
||||
virtual bool HasInitializationData() MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
// SourceBufferResource specific interface below.
|
||||
|
||||
|
|
|
@ -287,7 +287,8 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
|||
io.seek = webm_seek;
|
||||
io.tell = webm_tell;
|
||||
io.userdata = mDecoder;
|
||||
int64_t maxOffset = -1;
|
||||
int64_t maxOffset = mDecoder->HasInitializationData() ?
|
||||
mDecoder->GetResource()->GetLength() : -1;
|
||||
int r = nestegg_init(&mContext, io, &webm_log, maxOffset);
|
||||
if (r == -1) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче