Skip to content

Commit

Permalink
[MSE] SourceBuffer incorrectly emits error when timestamps are negative
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264721
rdar://118315768

Reviewed by Youenn Fablet.

This wasn't in the spec.
The bug linked to in the comment referred to https://dvcs.w3.org/hg/html-media/rev/cb96bc1c87c3 in 2014 which drops the requirement.

It was dead code, as the steps prior are about dropping frames that are outside the WindowAppend range, so "If the decode timestamp is less than the presentation start time" will always be false.

Covered by existing tests.

* Source/WebCore/Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateStreamEndedWithDecodeError): Deleted.
* Source/WebCore/Modules/mediasource/SourceBuffer.h:
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::processMediaSample):
* Source/WebCore/platform/graphics/SourceBufferPrivateClient.h:
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError): Deleted.
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateStreamEndedWithDecodeError): Deleted.
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:

Canonical link: https://commits.webkit.org/270631@main
  • Loading branch information
jyavenard committed Nov 13, 2023
1 parent 7a27fcd commit 711b192
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 36 deletions.
6 changes: 0 additions & 6 deletions Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,6 @@ void SourceBuffer::sourceBufferPrivateDidDropSample()
m_source->mediaElement()->incrementDroppedFrameCount();
}

void SourceBuffer::sourceBufferPrivateStreamEndedWithDecodeError()
{
if (!isRemoved())
m_source->streamEndedWithError(MediaSource::EndOfStreamError::Decode);
}

void SourceBuffer::monitorBufferingRate()
{
// We avoid the first update of m_averageBufferRate on purpose, but in exchange we get a more accurate m_timeOfBufferingMonitor initial time.
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/Modules/mediasource/SourceBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ class SourceBuffer

// SourceBufferPrivateClient
void sourceBufferPrivateDidReceiveInitializationSegment(InitializationSegment&&, CompletionHandler<void(ReceiveResult)>&&) final;
void sourceBufferPrivateStreamEndedWithDecodeError() final;
void sourceBufferPrivateAppendComplete(AppendResult) final;
void sourceBufferPrivateBufferedChanged(const PlatformTimeRanges&, CompletionHandler<void()>&&) final;
void sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime&) final;
Expand Down
11 changes: 0 additions & 11 deletions Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,17 +1017,6 @@ void SourceBufferPrivate::processMediaSample(Ref<MediaSample>&& sample)
return;
}

// If the decode timestamp is less than the presentation start time, then run the end of stream
// algorithm with the error parameter set to "decode", and abort these steps.
// NOTE: Until <https://www.w3.org/Bugs/Public/show_bug.cgi?id=27487> is resolved, we will only check
// the presentation timestamp.
MediaTime presentationStartTime = MediaTime::zeroTime();
if (presentationTimestamp < presentationStartTime) {
ERROR_LOG(LOGIDENTIFIER, "failing because presentationTimestamp (", presentationTimestamp, ") < presentationStartTime (", presentationStartTime, ")");
m_client->sourceBufferPrivateStreamEndedWithDecodeError();
return;
}

// 1.10 If the need random access point flag on track buffer equals true, then run the following steps:
if (trackBuffer.needRandomAccessFlag()) {
// 1.11.1 If the coded frame is not a random access point, then drop the coded frame and jump
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class SourceBufferPrivateClient : public CanMakeWeakPtr<SourceBufferPrivateClien
IPCError,
};
virtual void sourceBufferPrivateDidReceiveInitializationSegment(InitializationSegment&&, CompletionHandler<void(ReceiveResult)>&&) = 0;
virtual void sourceBufferPrivateStreamEndedWithDecodeError() = 0;
enum class AppendResult : uint8_t {
Succeeded,
ReadStreamFailed,
Expand Down
8 changes: 0 additions & 8 deletions Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ void RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment
m_connectionToWebProcess->connection().sendWithAsyncReply(Messages::SourceBufferPrivateRemote::SourceBufferPrivateDidReceiveInitializationSegment(segmentInfo), WTFMove(completionHandler), m_identifier);
}

void RemoteSourceBufferProxy::sourceBufferPrivateStreamEndedWithDecodeError()
{
if (!m_connectionToWebProcess)
return;

m_connectionToWebProcess->connection().send(Messages::SourceBufferPrivateRemote::SourceBufferPrivateStreamEndedWithDecodeError(), m_identifier);
}

void RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime& timestamp)
{
if (!m_connectionToWebProcess)
Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class RemoteSourceBufferProxy final

// SourceBufferPrivateClient
void sourceBufferPrivateDidReceiveInitializationSegment(InitializationSegment&&, CompletionHandler<void(ReceiveResult)>&&) final;
void sourceBufferPrivateStreamEndedWithDecodeError() final;
void sourceBufferPrivateAppendComplete(WebCore::SourceBufferPrivateClient::AppendResult) final;
void sourceBufferPrivateBufferedChanged(const WebCore::PlatformTimeRanges&, CompletionHandler<void()>&&) final;
void sourceBufferPrivateTrackBuffersChanged(const Vector<WebCore::PlatformTimeRanges>&) final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,6 @@ void SourceBufferPrivateRemote::sourceBufferPrivateDidReceiveInitializationSegme
m_client->sourceBufferPrivateDidReceiveInitializationSegment(WTFMove(segment), WTFMove(completionHandler));
}

void SourceBufferPrivateRemote::sourceBufferPrivateStreamEndedWithDecodeError()
{
if (m_client)
m_client->sourceBufferPrivateStreamEndedWithDecodeError();
}

void SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete(SourceBufferPrivateClient::AppendResult appendResult, uint64_t totalTrackBufferSizeInBytes, const MediaTime& timestampOffset)
{
m_totalTrackBufferSizeInBytes = totalTrackBufferSizeInBytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class SourceBufferPrivateRemote final

void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
void sourceBufferPrivateDidReceiveInitializationSegment(InitializationSegmentInfo&&, CompletionHandler<void(WebCore::SourceBufferPrivateClient::ReceiveResult)>&&);
void sourceBufferPrivateStreamEndedWithDecodeError();
void sourceBufferPrivateAppendComplete(WebCore::SourceBufferPrivateClient::AppendResult, uint64_t totalTrackBufferSizeInBytes, const MediaTime& timestampOffset);
void sourceBufferPrivateHighestPresentationTimestampChanged(const MediaTime&);
void sourceBufferPrivateBufferedChanged(WebCore::PlatformTimeRanges&&, CompletionHandler<void()>&&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

messages -> SourceBufferPrivateRemote NotRefCounted {
SourceBufferPrivateDidReceiveInitializationSegment(struct WebKit::InitializationSegmentInfo segmentConfiguration) -> (WebCore::SourceBufferPrivateClient::ReceiveResult result)
SourceBufferPrivateStreamEndedWithDecodeError()
SourceBufferPrivateAppendComplete(WebCore::SourceBufferPrivateClient::AppendResult appendResult, uint64_t totalTrackBufferSizeInBytes, MediaTime timeStampOffset)
SourceBufferPrivateHighestPresentationTimestampChanged(MediaTime timestamp)
SourceBufferPrivateBufferedChanged(WebCore::PlatformTimeRanges buffered) -> ()
Expand Down

0 comments on commit 711b192

Please sign in to comment.