diff options
Diffstat (limited to 'third_party/libwebrtc/moz-patch-stack/0087.patch')
-rw-r--r-- | third_party/libwebrtc/moz-patch-stack/0087.patch | 186 |
1 files changed, 29 insertions, 157 deletions
diff --git a/third_party/libwebrtc/moz-patch-stack/0087.patch b/third_party/libwebrtc/moz-patch-stack/0087.patch index 241fb871b6..d6aca49a9b 100644 --- a/third_party/libwebrtc/moz-patch-stack/0087.patch +++ b/third_party/libwebrtc/moz-patch-stack/0087.patch @@ -1,166 +1,38 @@ -From: Michael Froman <mjfroman@mac.com> -Date: Thu, 27 Jul 2023 12:42:44 -0500 -Subject: Bug 1838080: Store the rid in TransformableVideoSenderFrame. - r=ng,webrtc-reviewers +From: Byron Campen <docfaraday@gmail.com> +Date: Thu, 20 Jul 2023 14:24:00 +0000 +Subject: Bug 1838080: Ensure that last ref to transformation_queue_ is not + released on itself. r=pehrsons,webrtc-reviewers -This is necessary to reliably detect what rid a given keyframe is for, for the -purposes of resolving promises from RTCRtpScriptTransformer.generateKeyFrame. - -Differential Revision: https://phabricator.services.mozilla.com/D180737 -Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/2f1a0ba74bf71cfa0bc4e77714b8a5276a70cc36 +Differential Revision: https://phabricator.services.mozilla.com/D181699 +Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/91d9e8b6a5c430a73561ffd2330865f04fcb1a6d --- - api/frame_transformer_interface.h | 1 + - modules/rtp_rtcp/source/rtp_sender.h | 4 ++++ - modules/rtp_rtcp/source/rtp_sender_video.cc | 1 + - ...rtp_sender_video_frame_transformer_delegate.cc | 15 +++++++++++---- - .../rtp_sender_video_frame_transformer_delegate.h | 2 ++ - ..._stream_receiver_frame_transformer_delegate.cc | 5 +++++ - 6 files changed, 24 insertions(+), 4 deletions(-) + .../rtp_sender_video_frame_transformer_delegate.cc | 9 +++++++++ + 1 file changed, 9 insertions(+) -diff --git a/api/frame_transformer_interface.h b/api/frame_transformer_interface.h -index 9024988db6..d1ea15a54e 100644 ---- a/api/frame_transformer_interface.h -+++ b/api/frame_transformer_interface.h -@@ -65,6 +65,7 @@ class TransformableVideoFrameInterface : public TransformableFrameInterface { - public: - virtual ~TransformableVideoFrameInterface() = default; - virtual bool IsKeyFrame() const = 0; -+ virtual const std::string& GetRid() const = 0; - - virtual VideoFrameMetadata Metadata() const = 0; - -diff --git a/modules/rtp_rtcp/source/rtp_sender.h b/modules/rtp_rtcp/source/rtp_sender.h -index a398f16d46..8136730e4c 100644 ---- a/modules/rtp_rtcp/source/rtp_sender.h -+++ b/modules/rtp_rtcp/source/rtp_sender.h -@@ -140,6 +140,10 @@ class RTPSender { - - uint32_t SSRC() const RTC_LOCKS_EXCLUDED(send_mutex_) { return ssrc_; } - -+ const std::string& Rid() const RTC_LOCKS_EXCLUDED(send_mutex_) { -+ return rid_; -+ } -+ - absl::optional<uint32_t> FlexfecSsrc() const RTC_LOCKS_EXCLUDED(send_mutex_) { - return flexfec_ssrc_; - } -diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc -index ebca7aaa75..ede8fdc3d6 100644 ---- a/modules/rtp_rtcp/source/rtp_sender_video.cc -+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc -@@ -158,6 +158,7 @@ RTPSenderVideo::RTPSenderVideo(const Config& config) - this, - config.frame_transformer, - rtp_sender_->SSRC(), -+ rtp_sender_->Rid(), - config.task_queue_factory) - : nullptr) { - if (frame_transformer_delegate_) diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc -index d255ef4aa9..f24c91ae35 100644 +index ff15840529..ae9eb6b4bd 100644 --- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc +++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc -@@ -31,7 +31,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface { - uint32_t rtp_timestamp, - TimeDelta expected_retransmission_time, - uint32_t ssrc, -- std::vector<uint32_t> csrcs) -+ std::vector<uint32_t> csrcs, -+ const std::string& rid) - : encoded_data_(encoded_image.GetEncodedData()), - pre_transform_payload_size_(encoded_image.size()), - header_(video_header), -@@ -43,7 +44,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface { - capture_time_identifier_(encoded_image.CaptureTimeIdentifier()), - expected_retransmission_time_(expected_retransmission_time), - ssrc_(ssrc), -- csrcs_(csrcs) { -+ csrcs_(csrcs), -+ rid_(rid) { - RTC_DCHECK_GE(payload_type_, 0); - RTC_DCHECK_LE(payload_type_, 127); +@@ -18,6 +18,7 @@ + #include "api/task_queue/task_queue_factory.h" + #include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h" + #include "rtc_base/checks.h" ++#include "rtc_base/event.h" + #include "rtc_base/logging.h" + + namespace webrtc { +@@ -257,6 +258,14 @@ void RTPSenderVideoFrameTransformerDelegate::Reset() { + MutexLock lock(&sender_lock_); + sender_ = nullptr; } -@@ -106,6 +108,8 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface { - return mime_type + CodecTypeToPayloadString(*codec_type_); - } - -+ const std::string& GetRid() const override { return rid_; } -+ - private: - rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data_; - const size_t pre_transform_payload_size_; -@@ -120,6 +124,7 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface { - - uint32_t ssrc_; - std::vector<uint32_t> csrcs_; -+ const std::string rid_; - }; - } // namespace - -@@ -127,10 +132,12 @@ RTPSenderVideoFrameTransformerDelegate::RTPSenderVideoFrameTransformerDelegate( - RTPVideoFrameSenderInterface* sender, - rtc::scoped_refptr<FrameTransformerInterface> frame_transformer, - uint32_t ssrc, -+ const std::string& rid, - TaskQueueFactory* task_queue_factory) - : sender_(sender), - frame_transformer_(std::move(frame_transformer)), - ssrc_(ssrc), -+ rid_(rid), - transformation_queue_(task_queue_factory->CreateTaskQueue( - "video_frame_transformer", - TaskQueueFactory::Priority::NORMAL)) {} -@@ -150,7 +157,7 @@ bool RTPSenderVideoFrameTransformerDelegate::TransformFrame( - frame_transformer_->Transform(std::make_unique<TransformableVideoSenderFrame>( - encoded_image, video_header, payload_type, codec_type, rtp_timestamp, - expected_retransmission_time, ssrc_, -- /*csrcs=*/std::vector<uint32_t>())); -+ /*csrcs=*/std::vector<uint32_t>(), rid_)); - return true; - } - -@@ -244,7 +251,7 @@ std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame( - encoded_image, new_header, original->GetPayloadType(), new_header.codec, - original->GetTimestamp(), - /*expected_retransmission_time=*/TimeDelta::PlusInfinity(), -- original->GetSsrc(), metadata.GetCsrcs()); -+ original->GetSsrc(), metadata.GetCsrcs(), original->GetRid()); ++ // Wait until all pending tasks are executed, to ensure that the last ref ++ // standing is not on the transformation queue. ++ rtc::Event flush; ++ transformation_queue_->PostTask([this, &flush]() { ++ RTC_DCHECK_RUN_ON(transformation_queue_.get()); ++ flush.Set(); ++ }); ++ flush.Wait(rtc::Event::kForever); } - } // namespace webrtc -diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h -index a333db235a..3379ead364 100644 ---- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h -+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h -@@ -58,6 +58,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback { - RTPVideoFrameSenderInterface* sender, - rtc::scoped_refptr<FrameTransformerInterface> frame_transformer, - uint32_t ssrc, -+ const std::string& rid, - TaskQueueFactory* send_transport_queue); - - void Init(); -@@ -104,6 +105,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback { - RTPVideoFrameSenderInterface* sender_ RTC_GUARDED_BY(sender_lock_); - rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_; - const uint32_t ssrc_; -+ const std::string rid_; - // Used when the encoded frames arrives without a current task queue. This can - // happen if a hardware encoder was used. - std::unique_ptr<TaskQueueBase, TaskQueueDeleter> transformation_queue_; -diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc -index 6f9aa6ae09..94c9249e16 100644 ---- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc -+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc -@@ -57,6 +57,11 @@ class TransformableVideoReceiverFrame - return frame_->FrameType() == VideoFrameType::kVideoFrameKey; - } - -+ const std::string& GetRid() const override { -+ static const std::string empty; -+ return empty; -+ } -+ - VideoFrameMetadata Metadata() const override { return metadata_; } - - void SetMetadata(const VideoFrameMetadata& metadata) override { + std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame( |