-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MSE-in-Workers: srcObject part 3: serialize handle
Adds ability to serialize a MediaSourceHandleImpl, conditionally failing with DataCloneError if the handle is_serialized() already or if the handle is_used() (both of those are initialized to be false in the new instance created during deserialization.) Later changes will enable apps to attach the handle to a main thread HTMLMediaElement via the srcObject attribute; they will also include test updates. References: Full prototype CL: https://chromium-review.googlesource.com/c/chromium/src/+/3515334 MSE spec issue: w3c/media-source#175 MSE spec feature updates switching from worker MSE attachment via object URL to attachment via srcObject MediaSourceHandle: * w3c/media-source#305 * further clarifications in discussion at w3c/media-source#306 (comment) BUG=878133 Change-Id: I19cc8a450423964aef78e8e468776e8cd912503a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688599 Reviewed-by: Will Cassella <cassew@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org> Cr-Commit-Position: refs/heads/main@{#1012132} NOKEYCHECK=True GitOrigin-RevId: d5d391975da969d6242e5785c68609d6cd15fda3
- Loading branch information
1 parent
f31cbc6
commit 2d06ca3
Showing
11 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
blink/renderer/modules/mediasource/media_source_handle_attachment.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "third_party/blink/renderer/modules/mediasource/media_source_handle_attachment.h" | ||
|
||
namespace blink { | ||
|
||
const void* const MediaSourceHandleAttachment::kAttachmentKey = nullptr; | ||
|
||
} // namespace blink |
47 changes: 47 additions & 0 deletions
47
blink/renderer/modules/mediasource/media_source_handle_attachment.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_HANDLE_ATTACHMENT_H_ | ||
#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_HANDLE_ATTACHMENT_H_ | ||
|
||
#include "base/memory/scoped_refptr.h" | ||
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" | ||
#include "third_party/blink/renderer/core/html/media/media_source_attachment.h" | ||
#include "third_party/blink/renderer/modules/modules_export.h" | ||
|
||
namespace blink { | ||
|
||
// Used to serialize MediaSourceHandle | ||
class MODULES_EXPORT MediaSourceHandleAttachment | ||
: public SerializedScriptValue::Attachment { | ||
public: | ||
// Internals of a MediaSourceHandle that are included in serialization. | ||
struct HandleInternals { | ||
scoped_refptr<MediaSourceAttachment> attachment; | ||
String internal_blob_url; | ||
}; | ||
|
||
using MediaSourceHandleVector = Vector<HandleInternals>; | ||
|
||
static const void* const kAttachmentKey; | ||
MediaSourceHandleAttachment() = default; | ||
~MediaSourceHandleAttachment() override = default; | ||
|
||
bool IsLockedToAgentCluster() const override { | ||
return !attachments_.IsEmpty(); | ||
} | ||
|
||
size_t size() const { return attachments_.size(); } | ||
|
||
MediaSourceHandleVector& Attachments() { return attachments_; } | ||
|
||
const MediaSourceHandleVector& Attachments() const { return attachments_; } | ||
|
||
private: | ||
MediaSourceHandleVector attachments_; | ||
}; | ||
|
||
} // namespace blink | ||
|
||
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIASOURCE_MEDIA_SOURCE_HANDLE_ATTACHMENT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters