зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1847074 - Vendor libwebrtc from 272b464e92
Upstream commit: https://webrtc.googlesource.com/src/+/272b464e92d08d5abe36af5542f53bd6a82252c5 Allow feeding a Receiver encoded videoframe into a Sender Transform Instead of crashing with a CHECK fail when an insertable stream of a Video RTPSender is given a frame from an RTPReceiver's insertable stream, construct a reasonable analogous sender frame and pass it through to be decoded. A small step towards removing the split we have between Sender and Receiver implementations of TransformableFrameInterface which just confuses users of the API. Counterpart to https://webrtc-review.googlesource.com/c/src/+/301181 in the opposite direction. Bug: chromium:1250638 Change-Id: If66da7d553f14979ff1c5b4e00bff715f58cfce0 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/303480 Reviewed-by: Stefan Holmer <stefan@webrtc.org> Commit-Queue: Tony Herre <herre@google.com> Reviewed-by: Palak Agarwal <agpalak@google.com> Cr-Commit-Position: refs/heads/main@{#39963}
This commit is contained in:
Родитель
40e94149e6
Коммит
5a0d3296dc
|
@ -23544,3 +23544,6 @@ df4bc33e11
|
|||
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
ea7f3d7230
|
||||
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
272b464e92
|
||||
|
|
|
@ -15718,3 +15718,5 @@ libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc
|
|||
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-08-10T17:32:31.343465.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-08-10T17:33:21.203937.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-08-10T17:34:10.535585.
|
||||
|
|
|
@ -165,21 +165,34 @@ void RTPSenderVideoFrameTransformerDelegate::OnTransformedFrame(
|
|||
void RTPSenderVideoFrameTransformerDelegate::SendVideo(
|
||||
std::unique_ptr<TransformableFrameInterface> transformed_frame) const {
|
||||
RTC_DCHECK_RUN_ON(transformation_queue_.get());
|
||||
RTC_CHECK_EQ(transformed_frame->GetDirection(),
|
||||
TransformableFrameInterface::Direction::kSender);
|
||||
MutexLock lock(&sender_lock_);
|
||||
if (!sender_)
|
||||
return;
|
||||
auto* transformed_video_frame =
|
||||
static_cast<TransformableVideoSenderFrame*>(transformed_frame.get());
|
||||
sender_->SendVideo(transformed_video_frame->GetPayloadType(),
|
||||
transformed_video_frame->GetCodecType(),
|
||||
transformed_video_frame->GetTimestamp(),
|
||||
transformed_video_frame->GetCaptureTimeMs(),
|
||||
transformed_video_frame->GetData(),
|
||||
transformed_video_frame->GetHeader(),
|
||||
transformed_video_frame->GetExpectedRetransmissionTimeMs(),
|
||||
transformed_video_frame->Metadata().GetCsrcs());
|
||||
if (transformed_frame->GetDirection() ==
|
||||
TransformableFrameInterface::Direction::kSender) {
|
||||
auto* transformed_video_frame =
|
||||
static_cast<TransformableVideoSenderFrame*>(transformed_frame.get());
|
||||
sender_->SendVideo(
|
||||
transformed_video_frame->GetPayloadType(),
|
||||
transformed_video_frame->GetCodecType(),
|
||||
transformed_video_frame->GetTimestamp(),
|
||||
transformed_video_frame->GetCaptureTimeMs(),
|
||||
transformed_video_frame->GetData(),
|
||||
transformed_video_frame->GetHeader(),
|
||||
transformed_video_frame->GetExpectedRetransmissionTimeMs(),
|
||||
transformed_video_frame->Metadata().GetCsrcs());
|
||||
} else {
|
||||
auto* transformed_video_frame =
|
||||
static_cast<TransformableVideoFrameInterface*>(transformed_frame.get());
|
||||
VideoFrameMetadata metadata = transformed_video_frame->Metadata();
|
||||
sender_->SendVideo(
|
||||
transformed_video_frame->GetPayloadType(), metadata.GetCodec(),
|
||||
transformed_video_frame->GetTimestamp(),
|
||||
/*capture_time_ms=*/0, transformed_video_frame->GetData(),
|
||||
RTPVideoHeader::FromMetadata(metadata),
|
||||
/*expected_retransmission_time_ms_=*/absl::nullopt,
|
||||
metadata.GetCsrcs());
|
||||
}
|
||||
}
|
||||
|
||||
void RTPSenderVideoFrameTransformerDelegate::SetVideoStructureUnderLock(
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "api/test/mock_transformable_video_frame.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
@ -22,6 +23,8 @@ namespace webrtc {
|
|||
namespace {
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::NiceMock;
|
||||
using ::testing::Return;
|
||||
using ::testing::SaveArg;
|
||||
using ::testing::WithoutArgs;
|
||||
|
||||
|
@ -217,5 +220,54 @@ TEST_F(RtpSenderVideoFrameTransformerDelegateTest, MetadataAfterSetMetadata) {
|
|||
EXPECT_EQ(metadata.GetCsrcs(), actual_metadata.GetCsrcs());
|
||||
}
|
||||
|
||||
TEST_F(RtpSenderVideoFrameTransformerDelegateTest,
|
||||
ReceiverFrameConvertedToSenderFrame) {
|
||||
auto delegate = rtc::make_ref_counted<RTPSenderVideoFrameTransformerDelegate>(
|
||||
&test_sender_, frame_transformer_,
|
||||
/*ssrc=*/1111, /*csrcs=*/std::vector<uint32_t>(),
|
||||
time_controller_.CreateTaskQueueFactory().get());
|
||||
|
||||
const uint8_t payload_type = 1;
|
||||
const uint32_t timestamp = 2;
|
||||
const std::vector<uint32_t> frame_csrcs = {123, 456, 789};
|
||||
|
||||
auto mock_receiver_frame =
|
||||
std::make_unique<NiceMock<MockTransformableVideoFrame>>();
|
||||
ON_CALL(*mock_receiver_frame, GetDirection)
|
||||
.WillByDefault(Return(TransformableFrameInterface::Direction::kReceiver));
|
||||
VideoFrameMetadata metadata;
|
||||
metadata.SetCodec(kVideoCodecVP8);
|
||||
metadata.SetRTPVideoHeaderCodecSpecifics(RTPVideoHeaderVP8());
|
||||
metadata.SetCsrcs(frame_csrcs);
|
||||
ON_CALL(*mock_receiver_frame, Metadata).WillByDefault(Return(metadata));
|
||||
rtc::ArrayView<const uint8_t> buffer =
|
||||
(rtc::ArrayView<const uint8_t>)*EncodedImageBuffer::Create(1);
|
||||
ON_CALL(*mock_receiver_frame, GetData).WillByDefault(Return(buffer));
|
||||
ON_CALL(*mock_receiver_frame, GetPayloadType)
|
||||
.WillByDefault(Return(payload_type));
|
||||
ON_CALL(*mock_receiver_frame, GetTimestamp).WillByDefault(Return(timestamp));
|
||||
|
||||
rtc::scoped_refptr<TransformedFrameCallback> callback;
|
||||
EXPECT_CALL(*frame_transformer_, RegisterTransformedFrameSinkCallback)
|
||||
.WillOnce(SaveArg<0>(&callback));
|
||||
delegate->Init();
|
||||
ASSERT_TRUE(callback);
|
||||
|
||||
rtc::Event event;
|
||||
EXPECT_CALL(test_sender_,
|
||||
SendVideo(payload_type, absl::make_optional(kVideoCodecVP8),
|
||||
timestamp, /*capture_time_ms=*/0, buffer, _,
|
||||
/*expected_retransmission_time_ms_=*/
|
||||
(absl::optional<int64_t>)absl::nullopt, frame_csrcs))
|
||||
.WillOnce(WithoutArgs([&] {
|
||||
event.Set();
|
||||
return true;
|
||||
}));
|
||||
|
||||
callback->OnTransformedFrame(std::move(mock_receiver_frame));
|
||||
|
||||
event.Wait(TimeDelta::Seconds(1));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -57,7 +57,7 @@ index c863db4ccf..adc53d2243 100644
|
|||
: 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 34b4af0ec9..71f7db6f70 100644
|
||||
index 7dfd7ca4ad..a96bb32716 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 {
|
||||
|
@ -120,7 +120,7 @@ index 34b4af0ec9..71f7db6f70 100644
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -215,7 +221,7 @@ std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame(
|
||||
@@ -228,7 +234,7 @@ std::unique_ptr<TransformableVideoFrameInterface> CloneSenderVideoFrame(
|
||||
encoded_image, new_header, original->GetPayloadType(), new_header.codec,
|
||||
original->GetTimestamp(),
|
||||
absl::nullopt, // expected_retransmission_time_ms
|
||||
|
|
|
@ -10,7 +10,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/91d9e8b6a5c430a73
|
|||
1 file changed, 9 insertions(+)
|
||||
|
||||
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 71f7db6f70..79ceae5209 100644
|
||||
index a96bb32716..cbdf78528d 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
|
||||
@@ -17,6 +17,7 @@
|
||||
|
@ -21,7 +21,7 @@ index 71f7db6f70..79ceae5209 100644
|
|||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
@@ -202,6 +203,14 @@ void RTPSenderVideoFrameTransformerDelegate::Reset() {
|
||||
@@ -215,6 +216,14 @@ void RTPSenderVideoFrameTransformerDelegate::Reset() {
|
||||
MutexLock lock(&sender_lock_);
|
||||
sender_ = nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче