diff options
Diffstat (limited to '0002-Revert-RTCInsertableStreams-Make-RTCEncodedVideoFram.patch')
-rw-r--r-- | 0002-Revert-RTCInsertableStreams-Make-RTCEncodedVideoFram.patch | 595 |
1 files changed, 0 insertions, 595 deletions
diff --git a/0002-Revert-RTCInsertableStreams-Make-RTCEncodedVideoFram.patch b/0002-Revert-RTCInsertableStreams-Make-RTCEncodedVideoFram.patch deleted file mode 100644 index 18bff6ecd5f8..000000000000 --- a/0002-Revert-RTCInsertableStreams-Make-RTCEncodedVideoFram.patch +++ /dev/null @@ -1,595 +0,0 @@ -From 23bf04c1127da00d17bfa72794602e59b484ae76 Mon Sep 17 00:00:00 2001 -From: Daniel Playfair Cal <daniel.playfair.cal@gmail.com> -Date: Fri, 17 Apr 2020 00:41:46 +1000 -Subject: [PATCH 2/8] Revert "[RTCInsertableStreams] Make RTCEncodedVideoFrame - serializable" - -This reverts commit 283079bc066cc19c0d0d186500697ca95ca03c3f. ---- - .../core/v8/serialization/serialization_tag.h | 1 - - .../serialization/serialized_script_value.h | 31 +------ - ...8_script_value_deserializer_for_modules.cc | 28 ------ - ...v8_script_value_deserializer_for_modules.h | 2 - - .../v8_script_value_serializer_for_modules.cc | 28 ------ - .../v8_script_value_serializer_for_modules.h | 2 - - .../renderer/modules/peerconnection/BUILD.gn | 2 - - .../peerconnection/rtc_encoded_video_frame.cc | 54 +++++------ - .../peerconnection/rtc_encoded_video_frame.h | 19 ++-- - .../rtc_encoded_video_frame_delegate.cc | 89 ------------------- - .../rtc_encoded_video_frame_delegate.h | 72 --------------- - .../rtc_encoded_video_underlying_sink.cc | 3 +- - .../rtc_encoded_video_underlying_sink_test.cc | 2 +- - 13 files changed, 34 insertions(+), 299 deletions(-) - delete mode 100644 third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.cc - delete mode 100644 third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h - -diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h b/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h -index cce273938fc2..05e37ce90847 100644 ---- a/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h -+++ b/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h -@@ -102,7 +102,6 @@ enum SerializationTag { - // namedCurve:uint32_t - kRTCCertificateTag = 'k', // length:uint32_t, pemPrivateKey:WebCoreString, - // pemCertificate:WebCoreString -- kRTCEncodedVideoFrameTag = 'V', // uint32_t -> transferred video frame ID - - // The following tags were used by the Shape Detection API implementation - // between M71 and M81. During these milestones, the API was always behind -diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h -index bbf10ef3135b..1a80aa3b2356 100644 ---- a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h -+++ b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h -@@ -269,41 +269,13 @@ class CORE_EXPORT SerializedScriptValue - - bool IsLockedToAgentCluster() const { - return !wasm_modules_.IsEmpty() || -- !shared_array_buffers_contents_.IsEmpty() || -- std::any_of(attachments_.begin(), attachments_.end(), -- [](const auto& entry) { -- return entry.value->IsLockedToAgentCluster(); -- }); -+ !shared_array_buffers_contents_.IsEmpty(); - } - - // Returns true after serializing script values that remote origins cannot - // access. - bool IsOriginCheckRequired() const; - -- // Derive from Attachments to define collections of objects to serialize in -- // modules. They can be registered using GetOrCreateAttachment(). -- class Attachment { -- public: -- virtual ~Attachment() = default; -- virtual bool IsLockedToAgentCluster() const = 0; -- }; -- -- template <typename T> -- T* GetOrCreateAttachment() { -- auto result = attachments_.insert(&T::kAttachmentKey, std::unique_ptr<T>()); -- if (!result.stored_value->value) -- result.stored_value->value = std::make_unique<T>(); -- return static_cast<T*>(result.stored_value->value.get()); -- } -- -- template <typename T> -- const T* GetAttachmentIfExists() const { -- auto it = attachments_.find(&T::kAttachmentKey); -- if (it == attachments_.end()) -- return nullptr; -- return static_cast<T*>(it->value.get()); -- } -- - private: - friend class ScriptValueSerializer; - friend class V8ScriptValueSerializer; -@@ -372,7 +344,6 @@ class CORE_EXPORT SerializedScriptValue - MojoScopedHandleArray mojo_handles_; - SharedArrayBufferContentsArray shared_array_buffers_contents_; - NativeFileSystemTokensArray native_file_system_tokens_; -- HashMap<const void* const*, std::unique_ptr<Attachment>> attachments_; - - bool has_registered_external_allocation_; - #if DCHECK_IS_ON() -diff --git a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc -index 684d40f0cee8..b5f07e85b7b2 100644 ---- a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc -+++ b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc -@@ -18,8 +18,6 @@ - #include "third_party/blink/renderer/modules/native_file_system/native_file_system_file_handle.h" - #include "third_party/blink/renderer/modules/peerconnection/rtc_certificate.h" - #include "third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h" --#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h" --#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h" - - namespace blink { - -@@ -67,8 +65,6 @@ ScriptWrappable* V8ScriptValueDeserializerForModules::ReadDOMObject( - return nullptr; - return MakeGarbageCollected<RTCCertificate>(std::move(certificate)); - } -- case kRTCEncodedVideoFrameTag: -- return ReadRTCEncodedVideoFrame(); - default: - break; - } -@@ -373,28 +369,4 @@ V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle( - } - } - --RTCEncodedVideoFrame* --V8ScriptValueDeserializerForModules::ReadRTCEncodedVideoFrame() { -- if (!RuntimeEnabledFeatures::RTCInsertableStreamsEnabled( -- ExecutionContext::From(GetScriptState()))) { -- return nullptr; -- } -- -- uint32_t index; -- if (!ReadUint32(&index)) -- return nullptr; -- -- const auto* attachment = -- GetSerializedScriptValue() -- ->GetAttachmentIfExists<RTCEncodedVideoFramesAttachment>(); -- if (!attachment) -- return nullptr; -- -- const auto& frames = attachment->EncodedVideoFrames(); -- if (index >= frames.size()) -- return nullptr; -- -- return MakeGarbageCollected<RTCEncodedVideoFrame>(frames[index]); --} -- - } // namespace blink -diff --git a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h -index 410fe5098096..15e5d35547b6 100644 ---- a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h -+++ b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h -@@ -12,7 +12,6 @@ namespace blink { - - class CryptoKey; - class NativeFileSystemHandle; --class RTCEncodedVideoFrame; - - // Extends V8ScriptValueSerializer with support for modules/ types. - class MODULES_EXPORT V8ScriptValueDeserializerForModules final -@@ -45,7 +44,6 @@ class MODULES_EXPORT V8ScriptValueDeserializerForModules final - } - CryptoKey* ReadCryptoKey(); - NativeFileSystemHandle* ReadNativeFileSystemHandle(SerializationTag tag); -- RTCEncodedVideoFrame* ReadRTCEncodedVideoFrame(); - }; - - } // namespace blink -diff --git a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc -index 6811770537b9..6f017cdd3eca 100644 ---- a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc -+++ b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc -@@ -18,9 +18,6 @@ - #include "third_party/blink/renderer/bindings/modules/v8/v8_landmark.h" - #include "third_party/blink/renderer/bindings/modules/v8/v8_point_2d.h" - #include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_certificate.h" --#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_encoded_video_frame.h" --#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h" --#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h" - #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" - - namespace blink { -@@ -77,17 +74,6 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject( - WriteUTF8String(pem.certificate().c_str()); - return true; - } -- if (wrapper_type_info == V8RTCEncodedVideoFrame::GetWrapperTypeInfo() && -- RuntimeEnabledFeatures::RTCInsertableStreamsEnabled( -- ExecutionContext::From(GetScriptState()))) { -- if (IsForStorage()) { -- exception_state.ThrowDOMException(DOMExceptionCode::kDataCloneError, -- "An RTCEncodedVideoFrame cannot be " -- "serialized for storage."); -- return false; -- } -- return WriteRTCEncodedVideoFrame(wrappable->ToImpl<RTCEncodedVideoFrame>()); -- } - return false; - } - -@@ -286,18 +272,4 @@ bool V8ScriptValueSerializerForModules::WriteNativeFileSystemHandle( - return true; - } - --bool V8ScriptValueSerializerForModules::WriteRTCEncodedVideoFrame( -- RTCEncodedVideoFrame* video_frame) { -- auto* attachment = -- GetSerializedScriptValue() -- ->GetOrCreateAttachment<RTCEncodedVideoFramesAttachment>(); -- auto& frames = attachment->EncodedVideoFrames(); -- frames.push_back(video_frame->Delegate()); -- const uint32_t index = static_cast<uint32_t>(frames.size() - 1); -- -- WriteTag(kRTCEncodedVideoFrameTag); -- WriteUint32(index); -- return true; --} -- - } // namespace blink -diff --git a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h -index 10ac32ca4f69..6405202e0cb0 100644 ---- a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h -+++ b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h -@@ -12,7 +12,6 @@ - namespace blink { - - class NativeFileSystemHandle; --class RTCEncodedVideoFrame; - class WebCryptoKey; - - // Extends V8ScriptValueSerializer with support for modules/ types. -@@ -33,7 +32,6 @@ class MODULES_EXPORT V8ScriptValueSerializerForModules final - bool WriteNativeFileSystemHandle( - SerializationTag tag, - NativeFileSystemHandle* native_file_system_handle); -- bool WriteRTCEncodedVideoFrame(RTCEncodedVideoFrame*); - }; - - } // namespace blink -diff --git a/third_party/blink/renderer/modules/peerconnection/BUILD.gn b/third_party/blink/renderer/modules/peerconnection/BUILD.gn -index 4f9144ed30e0..5cf4876a3628 100644 ---- a/third_party/blink/renderer/modules/peerconnection/BUILD.gn -+++ b/third_party/blink/renderer/modules/peerconnection/BUILD.gn -@@ -84,8 +84,6 @@ blink_modules_sources("peerconnection") { - "rtc_encoded_audio_underlying_source.h", - "rtc_encoded_video_frame.cc", - "rtc_encoded_video_frame.h", -- "rtc_encoded_video_frame_delegate.cc", -- "rtc_encoded_video_frame_delegate.h", - "rtc_encoded_video_underlying_sink.cc", - "rtc_encoded_video_underlying_sink.h", - "rtc_encoded_video_underlying_source.cc", -diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.cc -index 65593da51242..3f8676ddb290 100644 ---- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.cc -+++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.cc -@@ -4,47 +4,46 @@ - - #include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h" - --#include <utility> -- - #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" --#include "third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h" - #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" - #include "third_party/webrtc/api/frame_transformer_interface.h" - - namespace blink { - - RTCEncodedVideoFrame::RTCEncodedVideoFrame( -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> webrtc_frame) -- : delegate_(base::MakeRefCounted<RTCEncodedVideoFrameDelegate>( -- std::move(webrtc_frame))) {} -- --RTCEncodedVideoFrame::RTCEncodedVideoFrame( -- scoped_refptr<RTCEncodedVideoFrameDelegate> delegate) -+ std::unique_ptr<webrtc::TransformableVideoFrameInterface> delegate) - : delegate_(std::move(delegate)) {} - - String RTCEncodedVideoFrame::type() const { -- return delegate_->Type(); -+ if (!delegate_) -+ return "empty"; -+ -+ return delegate_->IsKeyFrame() ? "key" : "delta"; - } - - uint64_t RTCEncodedVideoFrame::timestamp() const { -- return delegate_->Timestamp(); -+ return delegate_ ? delegate_->GetTimestamp() : 0; - } - - DOMArrayBuffer* RTCEncodedVideoFrame::data() const { -- if (!frame_data_) -- frame_data_ = delegate_->CreateDataBuffer(); -+ if (delegate_ && !frame_data_) { -+ frame_data_ = DOMArrayBuffer::Create(delegate_->GetData().data(), -+ delegate_->GetData().size()); -+ } - return frame_data_; - } - - DOMArrayBuffer* RTCEncodedVideoFrame::additionalData() const { -- if (!additional_data_) -- additional_data_ = delegate_->CreateAdditionalDataBuffer(); -- -+ if (delegate_ && !additional_data_) { -+ auto additional_data = delegate_->GetAdditionalData(); -+ additional_data_ = -+ DOMArrayBuffer::Create(additional_data.data(), additional_data.size()); -+ } - return additional_data_; - } - - uint32_t RTCEncodedVideoFrame::synchronizationSource() const { -- return delegate_->Ssrc(); -+ return delegate_ ? delegate_->GetSsrc() : 0; - } - - void RTCEncodedVideoFrame::setData(DOMArrayBuffer* data) { -@@ -66,20 +65,15 @@ String RTCEncodedVideoFrame::toString() const { - return sb.ToString(); - } - --void RTCEncodedVideoFrame::SyncDelegate() const { -- delegate_->SetData(frame_data_); --} -- --scoped_refptr<RTCEncodedVideoFrameDelegate> RTCEncodedVideoFrame::Delegate() -- const { -- SyncDelegate(); -- return delegate_; --} -- - std::unique_ptr<webrtc::TransformableVideoFrameInterface> --RTCEncodedVideoFrame::PassWebRtcFrame() { -- SyncDelegate(); -- return delegate_->PassWebRtcFrame(); -+RTCEncodedVideoFrame::PassDelegate() { -+ // Sync the delegate data with |frame_data_| if necessary. -+ if (delegate_ && frame_data_) { -+ delegate_->SetData(rtc::ArrayView<const uint8_t>( -+ static_cast<const uint8_t*>(frame_data_->Data()), -+ frame_data_->ByteLengthAsSizeT())); -+ } -+ return std::move(delegate_); - } - - void RTCEncodedVideoFrame::Trace(Visitor* visitor) { -diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h -index 5e13b07e9c14..67024c262e6e 100644 ---- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h -+++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame.h -@@ -20,16 +20,13 @@ class TransformableVideoFrameInterface; - namespace blink { - - class DOMArrayBuffer; --class RTCEncodedVideoFrameDelegate; - - class MODULES_EXPORT RTCEncodedVideoFrame final : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - explicit RTCEncodedVideoFrame( -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> webrtc_frame); -- explicit RTCEncodedVideoFrame( -- scoped_refptr<RTCEncodedVideoFrameDelegate> delegate); -+ std::unique_ptr<webrtc::TransformableVideoFrameInterface> delegate); - - // rtc_encoded_video_frame.idl implementation. - String type() const; -@@ -41,19 +38,17 @@ class MODULES_EXPORT RTCEncodedVideoFrame final : public ScriptWrappable { - uint32_t synchronizationSource() const; - String toString() const; - -- scoped_refptr<RTCEncodedVideoFrameDelegate> Delegate() const; -- void SyncDelegate() const; -- -+ // Internal API -+ bool HasDelegate() { return !!delegate_; } - // Returns and transfers ownership of the internal WebRTC frame -- // backing this RTCEncodedVideoFrame, neutering all RTCEncodedVideoFrames -- // backed by that internal WebRTC frame. -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> PassWebRtcFrame(); -+ // backing this RTCEncodedVideoFrame, leaving the RTCEncodedVideoFrame -+ // without a delegate WebRTC frame. -+ std::unique_ptr<webrtc::TransformableVideoFrameInterface> PassDelegate(); - - void Trace(Visitor*) override; - - private: -- const scoped_refptr<RTCEncodedVideoFrameDelegate> delegate_; -- -+ std::unique_ptr<webrtc::TransformableVideoFrameInterface> delegate_; - // Exposes encoded frame data from |delegate_|. - mutable Member<DOMArrayBuffer> frame_data_; - // Exposes additional data from |delegate_|. -diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.cc -deleted file mode 100644 -index 6d2de5b2b773..000000000000 ---- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.cc -+++ /dev/null -@@ -1,89 +0,0 @@ --// Copyright 2020 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/peerconnection/rtc_encoded_video_frame_delegate.h" -- --#include <utility> -- --#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" --#include "third_party/webrtc/api/frame_transformer_interface.h" -- --namespace blink { -- --const void* const RTCEncodedVideoFramesAttachment::kAttachmentKey = nullptr; -- --RTCEncodedVideoFrameDelegate::RTCEncodedVideoFrameDelegate( -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> webrtc_frame) -- : webrtc_frame_(std::move(webrtc_frame)) {} -- --String RTCEncodedVideoFrameDelegate::Type() const { -- MutexLocker lock(mutex_); -- if (!webrtc_frame_) -- return "empty"; -- -- return webrtc_frame_->IsKeyFrame() ? "key" : "delta"; --} -- --uint64_t RTCEncodedVideoFrameDelegate::Timestamp() const { -- MutexLocker lock(mutex_); -- return webrtc_frame_ ? webrtc_frame_->GetTimestamp() : 0; --} -- --DOMArrayBuffer* RTCEncodedVideoFrameDelegate::CreateDataBuffer() const { -- ArrayBufferContents contents; -- { -- MutexLocker lock(mutex_); -- if (!webrtc_frame_) -- return nullptr; -- -- auto data = webrtc_frame_->GetData(); -- contents = -- ArrayBufferContents(data.size(), 1, ArrayBufferContents::kNotShared, -- ArrayBufferContents::kDontInitialize); -- if (UNLIKELY(!contents.Data())) -- OOM_CRASH(data.size()); -- memcpy(contents.Data(), data.data(), data.size()); -- } -- return DOMArrayBuffer::Create(std::move(contents)); --} -- --void RTCEncodedVideoFrameDelegate::SetData(const DOMArrayBuffer* data) { -- MutexLocker lock(mutex_); -- if (webrtc_frame_ && data) { -- webrtc_frame_->SetData(rtc::ArrayView<const uint8_t>( -- static_cast<const uint8_t*>(data->Data()), data->ByteLengthAsSizeT())); -- } --} -- --DOMArrayBuffer* RTCEncodedVideoFrameDelegate::CreateAdditionalDataBuffer() -- const { -- ArrayBufferContents contents; -- { -- MutexLocker lock(mutex_); -- if (!webrtc_frame_) -- return nullptr; -- -- auto additional_data = webrtc_frame_->GetAdditionalData(); -- contents = ArrayBufferContents(additional_data.size(), 1, -- ArrayBufferContents::kNotShared, -- ArrayBufferContents::kDontInitialize); -- if (UNLIKELY(!contents.Data())) -- OOM_CRASH(additional_data.size()); -- memcpy(contents.Data(), additional_data.data(), additional_data.size()); -- } -- return DOMArrayBuffer::Create(std::move(contents)); --} -- --uint32_t RTCEncodedVideoFrameDelegate::Ssrc() const { -- MutexLocker lock(mutex_); -- return webrtc_frame_ ? webrtc_frame_->GetSsrc() : 0; --} -- --std::unique_ptr<webrtc::TransformableVideoFrameInterface> --RTCEncodedVideoFrameDelegate::PassWebRtcFrame() { -- MutexLocker lock(mutex_); -- return std::move(webrtc_frame_); --} -- --} // namespace blink -diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h -deleted file mode 100644 -index 5bc300b6e82c..000000000000 ---- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_frame_delegate.h -+++ /dev/null -@@ -1,72 +0,0 @@ --// Copyright 2020 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_PEERCONNECTION_RTC_ENCODED_VIDEO_FRAME_DELEGATE_H_ --#define THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_ENCODED_VIDEO_FRAME_DELEGATE_H_ -- --#include <stdint.h> -- --#include <memory> -- --#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" --#include "third_party/blink/renderer/modules/modules_export.h" --#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" --#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" --#include "third_party/blink/renderer/platform/wtf/threading_primitives.h" --#include "third_party/webrtc/api/frame_transformer_interface.h" -- --namespace blink { -- --class DOMArrayBuffer; -- --// This class wraps a WebRTC video frame and allows making shallow --// copies. Its purpose is to support making RTCEncodedVideoFrames --// serializable in the same process. --class RTCEncodedVideoFrameDelegate -- : public WTF::ThreadSafeRefCounted<RTCEncodedVideoFrameDelegate> { -- public: -- explicit RTCEncodedVideoFrameDelegate( -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> webrtc_frame); -- -- String Type() const; -- uint64_t Timestamp() const; -- DOMArrayBuffer* CreateDataBuffer() const; -- void SetData(const DOMArrayBuffer* data); -- DOMArrayBuffer* CreateAdditionalDataBuffer() const; -- uint32_t Ssrc() const; -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> PassWebRtcFrame(); -- -- private: -- mutable Mutex mutex_; -- std::unique_ptr<webrtc::TransformableVideoFrameInterface> webrtc_frame_ -- GUARDED_BY(mutex_); --}; -- --class MODULES_EXPORT RTCEncodedVideoFramesAttachment -- : public SerializedScriptValue::Attachment { -- public: -- static const void* const kAttachmentKey; -- RTCEncodedVideoFramesAttachment() = default; -- ~RTCEncodedVideoFramesAttachment() override = default; -- -- bool IsLockedToAgentCluster() const override { -- return !encoded_video_frames_.IsEmpty(); -- } -- -- Vector<scoped_refptr<RTCEncodedVideoFrameDelegate>>& EncodedVideoFrames() { -- return encoded_video_frames_; -- } -- -- const Vector<scoped_refptr<RTCEncodedVideoFrameDelegate>>& -- EncodedVideoFrames() const { -- return encoded_video_frames_; -- } -- -- private: -- Vector<scoped_refptr<RTCEncodedVideoFrameDelegate>> encoded_video_frames_; --}; -- --} // namespace blink -- --#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_ENCODED_VIDEO_FRAME_DELEGATE_H_ -diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink.cc -index 4585483a1cb2..3762b10e6bc5 100644 ---- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink.cc -+++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink.cc -@@ -48,8 +48,7 @@ ScriptPromise RTCEncodedVideoUnderlyingSink::write( - return ScriptPromise(); - } - -- transformer_callback_.Run()->SendFrameToSink( -- encoded_frame->PassWebRtcFrame()); -+ transformer_callback_.Run()->SendFrameToSink(encoded_frame->PassDelegate()); - return ScriptPromise::CastUndefined(script_state); - } - -diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc -index ea8a67a9cc5f..3d0dfbdbbe3e 100644 ---- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc -+++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_sink_test.cc -@@ -68,7 +68,7 @@ class RTCEncodedVideoUnderlyingSinkTest : public testing::Test { - - ScriptValue CreateEncodedVideoFrameChunk(ScriptState* script_state) { - RTCEncodedVideoFrame* frame = MakeGarbageCollected<RTCEncodedVideoFrame>( -- std::unique_ptr<webrtc::TransformableVideoFrameInterface>()); -+ /*frame_delegate=*/nullptr); - return ScriptValue(script_state->GetIsolate(), - ToV8(frame, script_state->GetContext()->Global(), - script_state->GetIsolate())); --- -2.26.1 - |