From 1c1f5404870d3a4c1407498e90701ff4f030f376 Mon Sep 17 00:00:00 2001 From: Tommi Date: Mon, 14 Jun 2021 10:54:20 +0200 Subject: [PATCH] Factor out common receive stream methods to a common interface. Also including common Rtp config members. Follow up changes will remove the ReceiveRtpConfig class in Call and copy of extension headers, instead use the config directly from the receive streams and not require stream recreation for changing the headers. Bug: webrtc:11993 Change-Id: I29ff3400d45d5bffddb3ad0a078403eb102afb65 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221983 Reviewed-by: Niels Moller Commit-Queue: Tommi Cr-Commit-Position: refs/heads/master@{#34283} --- call/BUILD.gn | 18 +++-- call/audio_receive_stream.h | 38 +--------- call/call.cc | 10 +-- call/call_unittest.cc | 12 ++-- call/flexfec_receive_stream.h | 17 ++--- call/flexfec_receive_stream_impl.cc | 28 ++++---- call/flexfec_receive_stream_unittest.cc | 10 +-- call/rampup_tests.cc | 12 ++-- call/receive_stream.h | 75 ++++++++++++++++++++ call/video_receive_stream.h | 43 ++--------- media/engine/fake_webrtc_call.h | 1 - media/engine/webrtc_video_engine.cc | 14 ++-- media/engine/webrtc_video_engine_unittest.cc | 16 ++--- test/call_test.cc | 6 +- test/scenario/video_stream.cc | 6 +- video/end_to_end_tests/config_tests.cc | 2 +- video/end_to_end_tests/fec_tests.cc | 2 +- video/end_to_end_tests/rtp_rtcp_tests.cc | 9 +-- video/video_quality_test.cc | 6 +- 19 files changed, 168 insertions(+), 157 deletions(-) create mode 100644 call/receive_stream.h diff --git a/call/BUILD.gn b/call/BUILD.gn index ffe3da5820..1e920b80b7 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -35,8 +35,10 @@ rtc_library("call_interfaces") { if (!build_with_mozilla) { sources += [ "audio_send_stream.cc" ] } + deps = [ ":audio_sender_interface", + ":receive_stream_interface", ":rtp_interfaces", ":video_stream_api", "../api:fec_controller_api", @@ -51,7 +53,6 @@ rtc_library("call_interfaces") { "../api/audio:audio_frame_processor", "../api/audio:audio_mixer_api", "../api/audio_codecs:audio_codecs_api", - "../api/crypto:frame_decryptor_interface", "../api/crypto:frame_encryptor_interface", "../api/crypto:options", "../api/neteq:neteq_api", @@ -59,7 +60,6 @@ rtc_library("call_interfaces") { "../api/transport:bitrate_settings", "../api/transport:network_control", "../api/transport:webrtc_key_value_config", - "../api/transport/rtp:rtp_source", "../modules/async_audio_processing", "../modules/audio_device", "../modules/audio_processing", @@ -321,6 +321,17 @@ rtc_library("call") { ] } +rtc_source_set("receive_stream_interface") { + sources = [ "receive_stream.h" ] + deps = [ + "../api:frame_transformer_interface", + "../api:rtp_parameters", + "../api:scoped_refptr", + "../api/crypto:frame_decryptor_interface", + "../api/transport/rtp:rtp_source", + ] +} + rtc_library("video_stream_api") { sources = [ "video_receive_stream.cc", @@ -329,6 +340,7 @@ rtc_library("video_stream_api") { "video_send_stream.h", ] deps = [ + ":receive_stream_interface", ":rtp_interfaces", "../api:frame_transformer_interface", "../api:rtp_headers", @@ -336,10 +348,8 @@ rtc_library("video_stream_api") { "../api:scoped_refptr", "../api:transport_api", "../api/adaptation:resource_adaptation_api", - "../api/crypto:frame_decryptor_interface", "../api/crypto:frame_encryptor_interface", "../api/crypto:options", - "../api/transport/rtp:rtp_source", "../api/video:recordable_encoded_frame", "../api/video:video_frame", "../api/video:video_rtp_headers", diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h index 2f67f7cc14..55e3fdb95c 100644 --- a/call/audio_receive_stream.h +++ b/call/audio_receive_stream.h @@ -20,17 +20,14 @@ #include "api/audio_codecs/audio_decoder_factory.h" #include "api/call/transport.h" #include "api/crypto/crypto_options.h" -#include "api/crypto/frame_decryptor_interface.h" -#include "api/frame_transformer_interface.h" #include "api/rtp_parameters.h" -#include "api/scoped_refptr.h" -#include "api/transport/rtp/rtp_source.h" +#include "call/receive_stream.h" #include "call/rtp_config.h" namespace webrtc { class AudioSinkInterface; -class AudioReceiveStream { +class AudioReceiveStream : public MediaReceiveStream { public: struct Stats { Stats(); @@ -106,29 +103,14 @@ class AudioReceiveStream { std::string ToString() const; // Receive-stream specific RTP settings. - struct Rtp { + struct Rtp : public RtpConfig { Rtp(); ~Rtp(); std::string ToString() const; - // Synchronization source (stream identifier) to be received. - uint32_t remote_ssrc = 0; - - // Sender SSRC used for sending RTCP (such as receiver reports). - uint32_t local_ssrc = 0; - - // Enable feedback for send side bandwidth estimation. - // See - // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions - // for details. - bool transport_cc = false; - // See NackConfig for description. NackConfig nack; - - // RTP header extensions used for the received stream. - std::vector extensions; } rtp; Transport* rtcp_send_transport = nullptr; @@ -171,21 +153,9 @@ class AudioReceiveStream { }; // Methods that support reconfiguring the stream post initialization. - virtual void SetDepacketizerToDecoderFrameTransformer( - rtc::scoped_refptr - frame_transformer) = 0; virtual void SetDecoderMap(std::map decoder_map) = 0; virtual void SetUseTransportCcAndNackHistory(bool use_transport_cc, int history_ms) = 0; - virtual void SetFrameDecryptor( - rtc::scoped_refptr frame_decryptor) = 0; - - // Starts stream activity. - // When a stream is active, it can receive, process and deliver packets. - virtual void Start() = 0; - // Stops stream activity. - // When a stream is stopped, it can't receive, process or deliver packets. - virtual void Stop() = 0; // Returns true if the stream has been started. virtual bool IsRunning() const = 0; @@ -215,8 +185,6 @@ class AudioReceiveStream { // Returns current value of base minimum delay in milliseconds. virtual int GetBaseMinimumPlayoutDelayMs() const = 0; - virtual std::vector GetSources() const = 0; - protected: virtual ~AudioReceiveStream() {} }; diff --git a/call/call.cc b/call/call.cc index 52f8f8daf5..ffe7a25e7f 100644 --- a/call/call.cc +++ b/call/call.cc @@ -103,7 +103,7 @@ bool UseSendSideBwe(const AudioReceiveStream::Config& config) { } bool UseSendSideBwe(const FlexfecReceiveStream::Config& config) { - return UseSendSideBwe(config.rtp_header_extensions, config.transport_cc); + return UseSendSideBwe(config.rtp.extensions, config.rtp.transport_cc); } const int* FindKeyByValue(const std::map& m, int v) { @@ -421,7 +421,7 @@ class Call final : public webrtc::Call, : extensions(config.rtp.extensions), use_send_side_bwe(UseSendSideBwe(config)) {} explicit ReceiveRtpConfig(const FlexfecReceiveStream::Config& config) - : extensions(config.rtp_header_extensions), + : extensions(config.rtp.extensions), use_send_side_bwe(UseSendSideBwe(config)) {} // Registered RTP header extensions for each stream. Note that RTP header @@ -1241,9 +1241,9 @@ FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( // thread. receive_stream->RegisterWithTransport(&video_receiver_controller_); - RTC_DCHECK(receive_rtp_config_.find(config.remote_ssrc) == + RTC_DCHECK(receive_rtp_config_.find(config.rtp.remote_ssrc) == receive_rtp_config_.end()); - receive_rtp_config_.emplace(config.remote_ssrc, ReceiveRtpConfig(config)); + receive_rtp_config_.emplace(config.rtp.remote_ssrc, ReceiveRtpConfig(config)); // TODO(brandtr): Store config in RtcEventLog here. @@ -1261,7 +1261,7 @@ void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) { RTC_DCHECK(receive_stream != nullptr); const FlexfecReceiveStream::Config& config = receive_stream->GetConfig(); - uint32_t ssrc = config.remote_ssrc; + uint32_t ssrc = config.rtp.remote_ssrc; receive_rtp_config_.erase(ssrc); // Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be diff --git a/call/call_unittest.cc b/call/call_unittest.cc index b06af1eecd..92a037f157 100644 --- a/call/call_unittest.cc +++ b/call/call_unittest.cc @@ -248,7 +248,7 @@ TEST(CallTest, CreateDestroy_FlexfecReceiveStream) { MockTransport rtcp_send_transport; FlexfecReceiveStream::Config config(&rtcp_send_transport); config.payload_type = 118; - config.remote_ssrc = 38837212; + config.rtp.remote_ssrc = 38837212; config.protected_media_ssrcs = {27273}; FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config); @@ -267,7 +267,7 @@ TEST(CallTest, CreateDestroy_FlexfecReceiveStreams) { for (int i = 0; i < 2; ++i) { for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) { - config.remote_ssrc = ssrc; + config.rtp.remote_ssrc = ssrc; config.protected_media_ssrcs = {ssrc + 1}; FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config); EXPECT_NE(stream, nullptr); @@ -295,22 +295,22 @@ TEST(CallTest, MultipleFlexfecReceiveStreamsProtectingSingleVideoStream) { FlexfecReceiveStream* stream; std::list streams; - config.remote_ssrc = 838383; + config.rtp.remote_ssrc = 838383; stream = call->CreateFlexfecReceiveStream(config); EXPECT_NE(stream, nullptr); streams.push_back(stream); - config.remote_ssrc = 424993; + config.rtp.remote_ssrc = 424993; stream = call->CreateFlexfecReceiveStream(config); EXPECT_NE(stream, nullptr); streams.push_back(stream); - config.remote_ssrc = 99383; + config.rtp.remote_ssrc = 99383; stream = call->CreateFlexfecReceiveStream(config); EXPECT_NE(stream, nullptr); streams.push_back(stream); - config.remote_ssrc = 5548; + config.rtp.remote_ssrc = 5548; stream = call->CreateFlexfecReceiveStream(config); EXPECT_NE(stream, nullptr); streams.push_back(stream); diff --git a/call/flexfec_receive_stream.h b/call/flexfec_receive_stream.h index 2f7438f9a4..0c9d5519e5 100644 --- a/call/flexfec_receive_stream.h +++ b/call/flexfec_receive_stream.h @@ -19,11 +19,13 @@ #include "api/call/transport.h" #include "api/rtp_headers.h" #include "api/rtp_parameters.h" +#include "call/receive_stream.h" #include "call/rtp_packet_sink_interface.h" namespace webrtc { -class FlexfecReceiveStream : public RtpPacketSinkInterface { +class FlexfecReceiveStream : public RtpPacketSinkInterface, + public ReceiveStream { public: ~FlexfecReceiveStream() override = default; @@ -48,8 +50,7 @@ class FlexfecReceiveStream : public RtpPacketSinkInterface { // Payload type for FlexFEC. int payload_type = -1; - // SSRC for FlexFEC stream to be received. - uint32_t remote_ssrc = 0; + RtpConfig rtp; // Vector containing a single element, corresponding to the SSRC of the // media stream being protected by this FlexFEC stream. The vector MUST have @@ -59,21 +60,11 @@ class FlexfecReceiveStream : public RtpPacketSinkInterface { // protection. std::vector protected_media_ssrcs; - // SSRC for RTCP reports to be sent. - uint32_t local_ssrc = 0; - // What RTCP mode to use in the reports. RtcpMode rtcp_mode = RtcpMode::kCompound; // Transport for outgoing RTCP packets. Transport* rtcp_send_transport = nullptr; - - // |transport_cc| is true whenever the send-side BWE RTCP feedback message - // has been negotiated. This is a prerequisite for enabling send-side BWE. - bool transport_cc = false; - - // RTP header extensions that have been negotiated for this track. - std::vector rtp_header_extensions; }; virtual Stats GetStats() const = 0; diff --git a/call/flexfec_receive_stream_impl.cc b/call/flexfec_receive_stream_impl.cc index 8a09108ce4..8368ff495f 100644 --- a/call/flexfec_receive_stream_impl.cc +++ b/call/flexfec_receive_stream_impl.cc @@ -44,21 +44,21 @@ std::string FlexfecReceiveStream::Config::ToString() const { char buf[1024]; rtc::SimpleStringBuilder ss(buf); ss << "{payload_type: " << payload_type; - ss << ", remote_ssrc: " << remote_ssrc; - ss << ", local_ssrc: " << local_ssrc; + ss << ", remote_ssrc: " << rtp.remote_ssrc; + ss << ", local_ssrc: " << rtp.local_ssrc; ss << ", protected_media_ssrcs: ["; size_t i = 0; for (; i + 1 < protected_media_ssrcs.size(); ++i) ss << protected_media_ssrcs[i] << ", "; if (!protected_media_ssrcs.empty()) ss << protected_media_ssrcs[i]; - ss << "], transport_cc: " << (transport_cc ? "on" : "off"); - ss << ", rtp_header_extensions: ["; + ss << "], transport_cc: " << (rtp.transport_cc ? "on" : "off"); + ss << ", rtp.extensions: ["; i = 0; - for (; i + 1 < rtp_header_extensions.size(); ++i) - ss << rtp_header_extensions[i].ToString() << ", "; - if (!rtp_header_extensions.empty()) - ss << rtp_header_extensions[i].ToString(); + for (; i + 1 < rtp.extensions.size(); ++i) + ss << rtp.extensions[i].ToString() << ", "; + if (!rtp.extensions.empty()) + ss << rtp.extensions[i].ToString(); ss << "]}"; return ss.str(); } @@ -68,7 +68,7 @@ bool FlexfecReceiveStream::Config::IsCompleteAndEnabled() const { if (payload_type < 0) return false; // Do we have the necessary SSRC information? - if (remote_ssrc == 0) + if (rtp.remote_ssrc == 0) return false; // TODO(brandtr): Update this check when we support multistream protection. if (protected_media_ssrcs.size() != 1u) @@ -91,7 +91,7 @@ std::unique_ptr MaybeCreateFlexfecReceiver( } RTC_DCHECK_GE(config.payload_type, 0); RTC_DCHECK_LE(config.payload_type, 127); - if (config.remote_ssrc == 0) { + if (config.rtp.remote_ssrc == 0) { RTC_LOG(LS_WARNING) << "Invalid FlexFEC SSRC given. " "This FlexfecReceiveStream will therefore be useless."; @@ -114,7 +114,7 @@ std::unique_ptr MaybeCreateFlexfecReceiver( } RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size()); return std::unique_ptr(new FlexfecReceiver( - clock, config.remote_ssrc, config.protected_media_ssrcs[0], + clock, config.rtp.remote_ssrc, config.protected_media_ssrcs[0], recovered_packet_receiver)); } @@ -130,7 +130,7 @@ std::unique_ptr CreateRtpRtcpModule( configuration.receive_statistics = receive_statistics; configuration.outgoing_transport = config.rtcp_send_transport; configuration.rtt_stats = rtt_stats; - configuration.local_media_ssrc = config.local_ssrc; + configuration.local_media_ssrc = config.rtp.local_ssrc; return ModuleRtpRtcpImpl2::Create(configuration); } @@ -179,7 +179,7 @@ void FlexfecReceiveStreamImpl::RegisterWithTransport( // here at all, we'd then delete the OnRtpPacket method and instead register // `receiver_` as the RtpPacketSinkInterface for this stream. rtp_stream_receiver_ = - receiver_controller->CreateReceiver(config_.remote_ssrc, this); + receiver_controller->CreateReceiver(config_.rtp.remote_ssrc, this); } void FlexfecReceiveStreamImpl::UnregisterFromTransport() { @@ -194,7 +194,7 @@ void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) { receiver_->OnRtpPacket(packet); // Do not report media packets in the RTCP RRs generated by |rtp_rtcp_|. - if (packet.Ssrc() == config_.remote_ssrc) { + if (packet.Ssrc() == config_.rtp.remote_ssrc) { rtp_receive_statistics_->OnRtpPacket(packet); } } diff --git a/call/flexfec_receive_stream_unittest.cc b/call/flexfec_receive_stream_unittest.cc index 80408c3e13..f4944d054f 100644 --- a/call/flexfec_receive_stream_unittest.cc +++ b/call/flexfec_receive_stream_unittest.cc @@ -45,7 +45,7 @@ FlexfecReceiveStream::Config CreateDefaultConfig( Transport* rtcp_send_transport) { FlexfecReceiveStream::Config config(rtcp_send_transport); config.payload_type = kFlexfecPlType; - config.remote_ssrc = ByteReader::ReadBigEndian(kFlexfecSsrc); + config.rtp.remote_ssrc = ByteReader::ReadBigEndian(kFlexfecSsrc); config.protected_media_ssrcs = { ByteReader::ReadBigEndian(kMediaSsrc)}; EXPECT_TRUE(config.IsCompleteAndEnabled()); @@ -64,16 +64,16 @@ TEST(FlexfecReceiveStreamConfigTest, IsCompleteAndEnabled) { MockTransport rtcp_send_transport; FlexfecReceiveStream::Config config(&rtcp_send_transport); - config.local_ssrc = 18374743; + config.rtp.local_ssrc = 18374743; config.rtcp_mode = RtcpMode::kCompound; - config.transport_cc = true; - config.rtp_header_extensions.emplace_back(TransportSequenceNumber::kUri, 7); + config.rtp.transport_cc = true; + config.rtp.extensions.emplace_back(TransportSequenceNumber::kUri, 7); EXPECT_FALSE(config.IsCompleteAndEnabled()); config.payload_type = 123; EXPECT_FALSE(config.IsCompleteAndEnabled()); - config.remote_ssrc = 238423838; + config.rtp.remote_ssrc = 238423838; EXPECT_FALSE(config.IsCompleteAndEnabled()); config.protected_media_ssrcs.push_back(138989393); diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc index 37e3e6c7f6..bf136a5df9 100644 --- a/call/rampup_tests.cc +++ b/call/rampup_tests.cc @@ -295,16 +295,16 @@ void RampUpTester::ModifyFlexfecConfigs( return; RTC_DCHECK_EQ(1, num_flexfec_streams_); (*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType; - (*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc; + (*receive_configs)[0].rtp.remote_ssrc = test::CallTest::kFlexfecSendSsrc; (*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]}; - (*receive_configs)[0].local_ssrc = video_ssrcs_[0]; + (*receive_configs)[0].rtp.local_ssrc = video_ssrcs_[0]; if (extension_type_ == RtpExtension::kAbsSendTimeUri) { - (*receive_configs)[0].transport_cc = false; - (*receive_configs)[0].rtp_header_extensions.push_back( + (*receive_configs)[0].rtp.transport_cc = false; + (*receive_configs)[0].rtp.extensions.push_back( RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId)); } else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) { - (*receive_configs)[0].transport_cc = true; - (*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension( + (*receive_configs)[0].rtp.transport_cc = true; + (*receive_configs)[0].rtp.extensions.push_back(RtpExtension( extension_type_.c_str(), kTransportSequenceNumberExtensionId)); } } diff --git a/call/receive_stream.h b/call/receive_stream.h new file mode 100644 index 0000000000..9f1f718dec --- /dev/null +++ b/call/receive_stream.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef CALL_RECEIVE_STREAM_H_ +#define CALL_RECEIVE_STREAM_H_ + +#include + +#include "api/crypto/frame_decryptor_interface.h" +#include "api/frame_transformer_interface.h" +#include "api/media_types.h" +#include "api/scoped_refptr.h" +#include "api/transport/rtp/rtp_source.h" + +namespace webrtc { + +// Common base interface for MediaReceiveStream based classes and +// FlexfecReceiveStream. +class ReceiveStream { + public: + // Receive-stream specific RTP settings. + struct RtpConfig { + // Synchronization source (stream identifier) to be received. + uint32_t remote_ssrc = 0; + + // Sender SSRC used for sending RTCP (such as receiver reports). + uint32_t local_ssrc = 0; + + // Enable feedback for send side bandwidth estimation. + // See + // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions + // for details. + bool transport_cc = false; + + // RTP header extensions used for the received stream. + std::vector extensions; + }; + + protected: + virtual ~ReceiveStream() {} +}; + +// Either an audio or video receive stream. +class MediaReceiveStream : public ReceiveStream { + public: + // Starts stream activity. + // When a stream is active, it can receive, process and deliver packets. + virtual void Start() = 0; + + // Stops stream activity. Must be called to match with a previous call to + // `Start()`. When a stream has been stopped, it won't receive, decode, + // process or deliver packets to downstream objects such as callback pointers + // set in the config struct. + virtual void Stop() = 0; + + virtual void SetDepacketizerToDecoderFrameTransformer( + rtc::scoped_refptr + frame_transformer) = 0; + + virtual void SetFrameDecryptor( + rtc::scoped_refptr frame_decryptor) = 0; + + virtual std::vector GetSources() const = 0; +}; + +} // namespace webrtc + +#endif // CALL_RECEIVE_STREAM_H_ diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h index 1bd8e946cc..f0112e6f7b 100644 --- a/call/video_receive_stream.h +++ b/call/video_receive_stream.h @@ -20,17 +20,15 @@ #include "api/call/transport.h" #include "api/crypto/crypto_options.h" -#include "api/crypto/frame_decryptor_interface.h" -#include "api/frame_transformer_interface.h" #include "api/rtp_headers.h" #include "api/rtp_parameters.h" -#include "api/transport/rtp/rtp_source.h" #include "api/video/recordable_encoded_frame.h" #include "api/video/video_content_type.h" #include "api/video/video_frame.h" #include "api/video/video_sink_interface.h" #include "api/video/video_timing.h" #include "api/video_codecs/sdp_video_format.h" +#include "call/receive_stream.h" #include "call/rtp_config.h" #include "common_video/frame_counts.h" #include "modules/rtp_rtcp/include/rtcp_statistics.h" @@ -41,7 +39,7 @@ namespace webrtc { class RtpPacketSinkInterface; class VideoDecoderFactory; -class VideoReceiveStream { +class VideoReceiveStream : public MediaReceiveStream { public: // Class for handling moving in/out recording state. struct RecordingState { @@ -169,17 +167,14 @@ class VideoReceiveStream { VideoDecoderFactory* decoder_factory = nullptr; // Receive-stream specific RTP settings. - struct Rtp { + struct Rtp : public RtpConfig { Rtp(); Rtp(const Rtp&); ~Rtp(); std::string ToString() const; - // Synchronization source (stream identifier) to be received. - uint32_t remote_ssrc = 0; - - // Sender SSRC used for sending RTCP (such as receiver reports). - uint32_t local_ssrc = 0; + // See NackConfig for description. + NackConfig nack; // See RtcpMode for description. RtcpMode rtcp_mode = RtcpMode::kCompound; @@ -191,15 +186,9 @@ class VideoReceiveStream { bool receiver_reference_time_report = false; } rtcp_xr; - // See draft-holmer-rmcat-transport-wide-cc-extensions for details. - bool transport_cc = false; - // See LntfConfig for description. LntfConfig lntf; - // See NackConfig for description. - NackConfig nack; - // Payload types for ULPFEC and RED, respectively. int ulpfec_payload_type = -1; int red_payload_type = -1; @@ -223,9 +212,6 @@ class VideoReceiveStream { // meta data is expected to be present in generic frame descriptor // RTP header extension). std::set raw_payload_types; - - // RTP header extensions used for the received stream. - std::vector extensions; } rtp; // Transport for outgoing packets (RTCP). @@ -262,18 +248,9 @@ class VideoReceiveStream { rtc::scoped_refptr frame_transformer; }; - // Starts stream activity. - // When a stream is active, it can receive, process and deliver packets. - virtual void Start() = 0; - // Stops stream activity. - // When a stream is stopped, it can't receive, process or deliver packets. - virtual void Stop() = 0; - // TODO(pbos): Add info on currently-received codec to Stats. virtual Stats GetStats() const = 0; - virtual std::vector GetSources() const = 0; - // Sets a base minimum for the playout delay. Base minimum delay sets lower // bound on minimum delay value determining lower bound on playout delay. // @@ -283,16 +260,6 @@ class VideoReceiveStream { // Returns current value of base minimum delay in milliseconds. virtual int GetBaseMinimumPlayoutDelayMs() const = 0; - // Allows a FrameDecryptor to be attached to a VideoReceiveStream after - // creation without resetting the decoder state. - virtual void SetFrameDecryptor( - rtc::scoped_refptr frame_decryptor) = 0; - - // Allows a frame transformer to be attached to a VideoReceiveStream after - // creation without resetting the decoder state. - virtual void SetDepacketizerToDecoderFrameTransformer( - rtc::scoped_refptr frame_transformer) = 0; - // Sets and returns recording state. The old state is moved out // of the video receive stream and returned to the caller, and |state| // is moved in. If the state's callback is set, it will be called with diff --git a/media/engine/fake_webrtc_call.h b/media/engine/fake_webrtc_call.h index 8df85d7564..a2273c4002 100644 --- a/media/engine/fake_webrtc_call.h +++ b/media/engine/fake_webrtc_call.h @@ -101,7 +101,6 @@ class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { } private: - // webrtc::AudioReceiveStream implementation. void Start() override { started_ = true; } void Stop() override { started_ = false; } bool IsRunning() const override { return started_; } diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc index 84f756c000..3bf081440e 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc @@ -1535,14 +1535,14 @@ void WebRtcVideoChannel::ConfigureReceiverRtp( // TODO(brandtr): Generalize when we add support for multistream protection. flexfec_config->payload_type = recv_flexfec_payload_type_; if (!IsDisabled(call_->trials(), "WebRTC-FlexFEC-03-Advertised") && - sp.GetFecFrSsrc(ssrc, &flexfec_config->remote_ssrc)) { + sp.GetFecFrSsrc(ssrc, &flexfec_config->rtp.remote_ssrc)) { flexfec_config->protected_media_ssrcs = {ssrc}; - flexfec_config->local_ssrc = config->rtp.local_ssrc; + flexfec_config->rtp.local_ssrc = config->rtp.local_ssrc; flexfec_config->rtcp_mode = config->rtp.rtcp_mode; // TODO(brandtr): We should be spec-compliant and set |transport_cc| here // based on the rtcp-fb for the FlexFEC codec, not the media codec. - flexfec_config->transport_cc = config->rtp.transport_cc; - flexfec_config->rtp_header_extensions = config->rtp.extensions; + flexfec_config->rtp.transport_cc = config->rtp.transport_cc; + flexfec_config->rtp.extensions = config->rtp.extensions; } } @@ -2933,7 +2933,7 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetLocalSsrc( } config_.rtp.local_ssrc = local_ssrc; - flexfec_config_.local_ssrc = local_ssrc; + flexfec_config_.rtp.local_ssrc = local_ssrc; RTC_LOG(LS_INFO) << "RecreateWebRtcVideoStream (recv) because of SetLocalSsrc; local_ssrc=" << local_ssrc; @@ -2966,7 +2966,7 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetFeedbackParameters( config_.rtp.rtcp_mode = rtcp_mode; // TODO(brandtr): We should be spec-compliant and set |transport_cc| here // based on the rtcp-fb for the FlexFEC codec, not the media codec. - flexfec_config_.transport_cc = config_.rtp.transport_cc; + flexfec_config_.rtp.transport_cc = config_.rtp.transport_cc; flexfec_config_.rtcp_mode = config_.rtp.rtcp_mode; RTC_LOG(LS_INFO) << "RecreateWebRtcVideoStream (recv) because of " "SetFeedbackParameters; nack=" @@ -2983,7 +2983,7 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetRecvParameters( } if (params.rtp_header_extensions) { config_.rtp.extensions = *params.rtp_header_extensions; - flexfec_config_.rtp_header_extensions = *params.rtp_header_extensions; + flexfec_config_.rtp.extensions = *params.rtp_header_extensions; video_needs_recreation = true; } if (params.flexfec_payload_type) { diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc index 336e1570b3..1e9fb6edfe 100644 --- a/media/engine/webrtc_video_engine_unittest.cc +++ b/media/engine/webrtc_video_engine_unittest.cc @@ -4167,7 +4167,7 @@ TEST_F(WebRtcVideoChannelFlexfecRecvTest, SetDefaultRecvCodecsWithSsrc) { const FakeFlexfecReceiveStream* stream = streams.front(); const webrtc::FlexfecReceiveStream::Config& config = stream->GetConfig(); EXPECT_EQ(GetEngineCodec("flexfec-03").id, config.payload_type); - EXPECT_EQ(kFlexfecSsrc, config.remote_ssrc); + EXPECT_EQ(kFlexfecSsrc, config.rtp.remote_ssrc); ASSERT_EQ(1U, config.protected_media_ssrcs.size()); EXPECT_EQ(kSsrcs1[0], config.protected_media_ssrcs[0]); @@ -4356,7 +4356,7 @@ TEST_F(WebRtcVideoChannelFlexfecRecvTest, SetRecvCodecsWithFec) { flexfec_stream->GetConfig(); EXPECT_EQ(GetEngineCodec("flexfec-03").id, flexfec_stream_config.payload_type); - EXPECT_EQ(kFlexfecSsrc, flexfec_stream_config.remote_ssrc); + EXPECT_EQ(kFlexfecSsrc, flexfec_stream_config.rtp.remote_ssrc); ASSERT_EQ(1U, flexfec_stream_config.protected_media_ssrcs.size()); EXPECT_EQ(kSsrcs1[0], flexfec_stream_config.protected_media_ssrcs[0]); const std::vector& video_streams = @@ -4365,17 +4365,17 @@ TEST_F(WebRtcVideoChannelFlexfecRecvTest, SetRecvCodecsWithFec) { const webrtc::VideoReceiveStream::Config& video_stream_config = video_stream->GetConfig(); EXPECT_EQ(video_stream_config.rtp.local_ssrc, - flexfec_stream_config.local_ssrc); + flexfec_stream_config.rtp.local_ssrc); EXPECT_EQ(video_stream_config.rtp.rtcp_mode, flexfec_stream_config.rtcp_mode); EXPECT_EQ(video_stream_config.rtcp_send_transport, flexfec_stream_config.rtcp_send_transport); // TODO(brandtr): Update this EXPECT when we set |transport_cc| in a // spec-compliant way. EXPECT_EQ(video_stream_config.rtp.transport_cc, - flexfec_stream_config.transport_cc); + flexfec_stream_config.rtp.transport_cc); EXPECT_EQ(video_stream_config.rtp.rtcp_mode, flexfec_stream_config.rtcp_mode); EXPECT_EQ(video_stream_config.rtp.extensions, - flexfec_stream_config.rtp_header_extensions); + flexfec_stream_config.rtp.extensions); } // We should not send FlexFEC, even if we advertise it, unless the right @@ -5126,7 +5126,7 @@ TEST_F(WebRtcVideoChannelFlexfecRecvTest, SetRecvParamsWithoutFecDisablesFec) { ASSERT_EQ(1U, streams.size()); const FakeFlexfecReceiveStream* stream = streams.front(); EXPECT_EQ(GetEngineCodec("flexfec-03").id, stream->GetConfig().payload_type); - EXPECT_EQ(kFlexfecSsrc, stream->GetConfig().remote_ssrc); + EXPECT_EQ(kFlexfecSsrc, stream->GetConfig().rtp.remote_ssrc); ASSERT_EQ(1U, stream->GetConfig().protected_media_ssrcs.size()); EXPECT_EQ(kSsrcs1[0], stream->GetConfig().protected_media_ssrcs[0]); @@ -5179,7 +5179,7 @@ TEST_F(WebRtcVideoChannelFlexfecSendRecvTest, const FakeFlexfecReceiveStream* stream_with_recv_params = streams.front(); EXPECT_EQ(GetEngineCodec("flexfec-03").id, stream_with_recv_params->GetConfig().payload_type); - EXPECT_EQ(kFlexfecSsrc, stream_with_recv_params->GetConfig().remote_ssrc); + EXPECT_EQ(kFlexfecSsrc, stream_with_recv_params->GetConfig().rtp.remote_ssrc); EXPECT_EQ(1U, stream_with_recv_params->GetConfig().protected_media_ssrcs.size()); EXPECT_EQ(kSsrcs1[0], @@ -5193,7 +5193,7 @@ TEST_F(WebRtcVideoChannelFlexfecSendRecvTest, const FakeFlexfecReceiveStream* stream_with_send_params = streams.front(); EXPECT_EQ(GetEngineCodec("flexfec-03").id, stream_with_send_params->GetConfig().payload_type); - EXPECT_EQ(kFlexfecSsrc, stream_with_send_params->GetConfig().remote_ssrc); + EXPECT_EQ(kFlexfecSsrc, stream_with_send_params->GetConfig().rtp.remote_ssrc); EXPECT_EQ(1U, stream_with_send_params->GetConfig().protected_media_ssrcs.size()); EXPECT_EQ(kSsrcs1[0], diff --git a/test/call_test.cc b/test/call_test.cc index 0ba947ce08..11230dae2f 100644 --- a/test/call_test.cc +++ b/test/call_test.cc @@ -409,7 +409,7 @@ void CallTest::CreateMatchingAudioAndFecConfigs( if (num_flexfec_streams_ == 1) { CreateMatchingFecConfig(rtcp_send_transport, *GetVideoSendConfig()); for (const RtpExtension& extension : GetVideoSendConfig()->rtp.extensions) - GetFlexFecConfig()->rtp_header_extensions.push_back(extension); + GetFlexFecConfig()->rtp.extensions.push_back(extension); } } @@ -444,9 +444,9 @@ void CallTest::CreateMatchingFecConfig( const VideoSendStream::Config& send_config) { FlexfecReceiveStream::Config config(transport); config.payload_type = send_config.rtp.flexfec.payload_type; - config.remote_ssrc = send_config.rtp.flexfec.ssrc; + config.rtp.remote_ssrc = send_config.rtp.flexfec.ssrc; config.protected_media_ssrcs = send_config.rtp.flexfec.protected_media_ssrcs; - config.local_ssrc = kReceiverLocalVideoSsrc; + config.rtp.local_ssrc = kReceiverLocalVideoSsrc; if (!video_receive_configs_.empty()) { video_receive_configs_[0].rtp.protected_by_flexfec = true; video_receive_configs_[0].rtp.packet_sink_ = this; diff --git a/test/scenario/video_stream.cc b/test/scenario/video_stream.cc index 709f0b71b5..96f6f5bc59 100644 --- a/test/scenario/video_stream.cc +++ b/test/scenario/video_stream.cc @@ -571,10 +571,10 @@ ReceiveVideoStream::ReceiveVideoStream(CallClient* receiver, RTC_DCHECK(num_streams == 1); FlexfecReceiveStream::Config flexfec(feedback_transport); flexfec.payload_type = CallTest::kFlexfecPayloadType; - flexfec.remote_ssrc = CallTest::kFlexfecSendSsrc; + flexfec.rtp.remote_ssrc = CallTest::kFlexfecSendSsrc; flexfec.protected_media_ssrcs = send_stream->rtx_ssrcs_; - flexfec.local_ssrc = recv_config.rtp.local_ssrc; - receiver_->ssrc_media_types_[flexfec.remote_ssrc] = MediaType::VIDEO; + flexfec.rtp.local_ssrc = recv_config.rtp.local_ssrc; + receiver_->ssrc_media_types_[flexfec.rtp.remote_ssrc] = MediaType::VIDEO; receiver_->SendTask([this, &flexfec] { flecfec_stream_ = receiver_->call_->CreateFlexfecReceiveStream(flexfec); diff --git a/video/end_to_end_tests/config_tests.cc b/video/end_to_end_tests/config_tests.cc index bf63e2a51f..1bd897cb34 100644 --- a/video/end_to_end_tests/config_tests.cc +++ b/video/end_to_end_tests/config_tests.cc @@ -104,7 +104,7 @@ TEST_F(ConfigEndToEndTest, VerifyDefaultFlexfecReceiveConfigParameters) { FlexfecReceiveStream::Config default_receive_config(&rtcp_send_transport); EXPECT_EQ(-1, default_receive_config.payload_type) << "Enabling FlexFEC requires rtpmap: flexfec negotiation."; - EXPECT_EQ(0U, default_receive_config.remote_ssrc) + EXPECT_EQ(0U, default_receive_config.rtp.remote_ssrc) << "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation."; EXPECT_TRUE(default_receive_config.protected_media_ssrcs.empty()) << "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation."; diff --git a/video/end_to_end_tests/fec_tests.cc b/video/end_to_end_tests/fec_tests.cc index 0d4ddac5a4..77ad9eb666 100644 --- a/video/end_to_end_tests/fec_tests.cc +++ b/video/end_to_end_tests/fec_tests.cc @@ -314,7 +314,7 @@ class FlexfecRenderObserver : public test::EndToEndTest, void ModifyFlexfecConfigs( std::vector* receive_configs) override { - (*receive_configs)[0].local_ssrc = kFlexfecLocalSsrc; + (*receive_configs)[0].rtp.local_ssrc = kFlexfecLocalSsrc; } void PerformTest() override { diff --git a/video/end_to_end_tests/rtp_rtcp_tests.cc b/video/end_to_end_tests/rtp_rtcp_tests.cc index d76a7f0ced..a698328dad 100644 --- a/video/end_to_end_tests/rtp_rtcp_tests.cc +++ b/video/end_to_end_tests/rtp_rtcp_tests.cc @@ -537,12 +537,13 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) { receive_transport.get()); flexfec_receive_config.payload_type = GetVideoSendConfig()->rtp.flexfec.payload_type; - flexfec_receive_config.remote_ssrc = GetVideoSendConfig()->rtp.flexfec.ssrc; + flexfec_receive_config.rtp.remote_ssrc = + GetVideoSendConfig()->rtp.flexfec.ssrc; flexfec_receive_config.protected_media_ssrcs = GetVideoSendConfig()->rtp.flexfec.protected_media_ssrcs; - flexfec_receive_config.local_ssrc = kReceiverLocalVideoSsrc; - flexfec_receive_config.transport_cc = true; - flexfec_receive_config.rtp_header_extensions.emplace_back( + flexfec_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc; + flexfec_receive_config.rtp.transport_cc = true; + flexfec_receive_config.rtp.extensions.emplace_back( RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberExtensionId); flexfec_receive_configs_.push_back(flexfec_receive_config); diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc index b87957f1c6..b77a4759a2 100644 --- a/video/video_quality_test.cc +++ b/video/video_quality_test.cc @@ -925,13 +925,13 @@ void VideoQualityTest::SetupVideo(Transport* send_transport, } CreateMatchingFecConfig(recv_transport, *GetVideoSendConfig()); - GetFlexFecConfig()->transport_cc = params_.call.send_side_bwe; + GetFlexFecConfig()->rtp.transport_cc = params_.call.send_side_bwe; if (params_.call.send_side_bwe) { - GetFlexFecConfig()->rtp_header_extensions.push_back( + GetFlexFecConfig()->rtp.extensions.push_back( RtpExtension(RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberExtensionId)); } else { - GetFlexFecConfig()->rtp_header_extensions.push_back( + GetFlexFecConfig()->rtp.extensions.push_back( RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeExtensionId)); } }