mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1118123: Update mediasource duration following sourcebuffer::appendBuffer. r=cajbir
This commit is contained in:
parent
60494c8665
commit
1e5eade7ba
@ -178,7 +178,7 @@ void
|
||||
MediaSource::SetDuration(double aDuration, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MSE_API("MediaSource(%p)::SetDuration(aDuration=%f)", this, aDuration);
|
||||
MSE_API("MediaSource(%p)::SetDuration(aDuration=%f, ErrorResult)", this, aDuration);
|
||||
if (aDuration < 0 || IsNaN(aDuration)) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
|
||||
return;
|
||||
@ -188,6 +188,14 @@ MediaSource::SetDuration(double aDuration, ErrorResult& aRv)
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
SetDuration(aDuration);
|
||||
}
|
||||
|
||||
void
|
||||
MediaSource::SetDuration(double aDuration)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MSE_API("MediaSource(%p)::SetDuration(aDuration=%f)", this, aDuration);
|
||||
mDecoder->SetMediaSourceDuration(aDuration);
|
||||
}
|
||||
|
||||
|
@ -113,6 +113,8 @@ private:
|
||||
// MediaSourceDecoder uses DurationChange to set the duration
|
||||
// without hitting the checks in SetDuration.
|
||||
friend class mozilla::MediaSourceDecoder;
|
||||
// SourceBuffer uses SetDuration
|
||||
friend class mozilla::dom::SourceBuffer;
|
||||
|
||||
~MediaSource();
|
||||
|
||||
@ -126,6 +128,9 @@ private:
|
||||
|
||||
void InitializationEvent();
|
||||
|
||||
// SetDuration with no checks.
|
||||
void SetDuration(double aDuration);
|
||||
|
||||
nsRefPtr<SourceBufferList> mSourceBuffers;
|
||||
nsRefPtr<SourceBufferList> mActiveSourceBuffers;
|
||||
|
||||
|
@ -326,6 +326,16 @@ SourceBuffer::AbortUpdating()
|
||||
QueueAsyncSimpleEvent("updateend");
|
||||
}
|
||||
|
||||
void
|
||||
SourceBuffer::CheckEndTime()
|
||||
{
|
||||
// Check if we need to update mMediaSource duration
|
||||
double endTime = GetBufferedEnd();
|
||||
if (endTime > mMediaSource->Duration()) {
|
||||
mMediaSource->SetDuration(endTime);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aRv)
|
||||
{
|
||||
@ -349,6 +359,8 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
|
||||
mMediaSource->QueueInitializationEvent();
|
||||
}
|
||||
|
||||
CheckEndTime();
|
||||
|
||||
// Run the final step of the buffer append algorithm asynchronously to
|
||||
// ensure the SourceBuffer's updating flag transition behaves as required
|
||||
// by the spec.
|
||||
|
@ -127,6 +127,11 @@ private:
|
||||
void StopUpdating();
|
||||
void AbortUpdating();
|
||||
|
||||
// If the media segment contains data beyond the current duration,
|
||||
// then run the duration change algorithm with new duration set to the
|
||||
// maximum of the current duration and the group end timestamp.
|
||||
void CheckEndTime();
|
||||
|
||||
// Shared implementation of AppendBuffer overloads.
|
||||
void AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aRv);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user