-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SourceBuffer.writeHead attribute #4559
Changes from 5 commits
339b243
65ed4f8
0db3d83
b694802
bda966d
cb3f9f2
6295b6a
5e8b4f4
2eca48a
e151027
09c9729
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2024 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "third_party/blink/renderer/modules/mediasource/source_buffer_write_head.h" | ||
|
||
#include "third_party/blink/renderer/modules/mediasource/source_buffer.h" | ||
#include "third_party/blink/renderer/platform/bindings/exception_state.h" | ||
|
||
#if !BUILDFLAG(USE_STARBOARD_MEDIA) | ||
#error "This file only works with Starboard media" | ||
#endif // !BUILDFLAG(USE_STARBOARD_MEDIA) | ||
|
||
namespace blink { | ||
|
||
// static | ||
double SourceBufferWriteHead::writeHead(SourceBuffer& source_buffer, | ||
ExceptionState& exception_state) { | ||
return source_buffer.writeHead(exception_state); | ||
} | ||
} // namespace blink |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2024 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_SOURCE_BUFFER_WRITE_HEAD_H_ | ||
#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_SOURCE_BUFFER_WRITE_HEAD_H_ | ||
|
||
#include "build/build_config.h" | ||
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" | ||
|
||
#if !BUILDFLAG(USE_STARBOARD_MEDIA) | ||
#error "This file only works with Starboard media" | ||
#endif // !BUILDFLAG(USE_STARBOARD_MEDIA) | ||
|
||
namespace blink { | ||
|
||
class ExceptionState; | ||
class SourceBuffer; | ||
|
||
class SourceBufferWriteHead { | ||
STATIC_ONLY(SourceBufferWriteHead); | ||
|
||
public: | ||
static double writeHead(SourceBuffer&, ExceptionState&); | ||
}; | ||
|
||
} // namespace blink | ||
|
||
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_SOURCE_BUFFER_WRITE_HEAD_H_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2024 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Non standard interface used for Cobalt only. | ||
// Returns the highest presentation timestamp written to the SbPlayer; | ||
// raises `InvalidStateError` if the SourceBuffer object has been removed | ||
// from the MediaSource object. | ||
|
||
[ | ||
ImplementedAs=SourceBufferWriteHead | ||
osagie98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] partial interface SourceBuffer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is an interface extension, could we put it in a blink/renderer/modules/cobalt or some such? That way it'd make it easier down the line to identify all Cobalt Web Platform extensions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, is that the practice we'll have going forward? I approached it how it would look if it were merged to Chrome. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm less sure about the right way to approach this change, because my understanding is that it's more likely to be upstreamed (and I think relatively soon?), so we actually wouldn't want it to be separate from the other changes. But maybe we want to always separate it out until it's actually accepted upstream as it may also change once it goes in upstream. I'll think about it and add it to go/cobalt-web-api-design There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Decided this should be in a cobalt-owned location in the discussion at https://docs.google.com/document/d/1RhlGcSINBxBkPeA45JAtkQHt9lrnkl7b1rYbQ2PFLCI/edit?resourcekey=0-OpkmEwqsdvkmlwC22Npjpw&tab=t.0#bookmark=id.pkppexmi8025 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can move this as soon as we have a defined location for these interface changes to go |
||
[RaisesException] readonly attribute double writeHead; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we consider extending media/filters/chunk_demuxer_unittest.cc for the new behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an existing bug to address this b/380001431, it's unblocked now so I'll be able to add tests for this and other ChunkDemuxer changes