aboutsummaryrefslogtreecommitdiff
path: root/call/flexfec_receive_stream_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'call/flexfec_receive_stream_impl.cc')
-rw-r--r--call/flexfec_receive_stream_impl.cc67
1 files changed, 35 insertions, 32 deletions
diff --git a/call/flexfec_receive_stream_impl.cc b/call/flexfec_receive_stream_impl.cc
index e629bca347..ab82a6d71a 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<FlexfecReceiver> 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<FlexfecReceiver> MaybeCreateFlexfecReceiver(
}
RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size());
return std::unique_ptr<FlexfecReceiver>(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<ModuleRtpRtcpImpl2> 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);
}
@@ -138,7 +138,6 @@ std::unique_ptr<ModuleRtpRtcpImpl2> CreateRtpRtcpModule(
FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl(
Clock* clock,
- RtpStreamReceiverControllerInterface* receiver_controller,
const Config& config,
RecoveredPacketReceiver* recovered_packet_receiver,
RtcpRttStats* rtt_stats,
@@ -155,28 +154,37 @@ FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl(
process_thread_(process_thread) {
RTC_LOG(LS_INFO) << "FlexfecReceiveStreamImpl: " << config_.ToString();
+ packet_sequence_checker_.Detach();
+
// RTCP reporting.
rtp_rtcp_->SetRTCPStatus(config_.rtcp_mode);
process_thread_->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE);
+}
+
+FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() {
+ RTC_LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString();
+ process_thread_->DeRegisterModule(rtp_rtcp_.get());
+}
+
+void FlexfecReceiveStreamImpl::RegisterWithTransport(
+ RtpStreamReceiverControllerInterface* receiver_controller) {
+ RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
+ RTC_DCHECK(!rtp_stream_receiver_);
+
+ if (!receiver_)
+ return;
- // Register with transport.
// TODO(nisse): OnRtpPacket in this class delegates all real work to
- // |receiver_|. So maybe we don't need to implement RtpPacketSinkInterface
+ // `receiver_`. So maybe we don't need to implement RtpPacketSinkInterface
// here at all, we'd then delete the OnRtpPacket method and instead register
- // |receiver_| as the RtpPacketSinkInterface for this stream.
- // TODO(nisse): Passing |this| from the constructor to the RtpDemuxer, before
- // the object is fully initialized, is risky. But it works in this case
- // because locking in our caller, Call::CreateFlexfecReceiveStream, ensures
- // that the demuxer doesn't call OnRtpPacket before this object is fully
- // constructed. Registering |receiver_| instead of |this| would solve this
- // problem too.
+ // `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);
}
-FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() {
- RTC_LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString();
- process_thread_->DeRegisterModule(rtp_rtcp_.get());
+void FlexfecReceiveStreamImpl::UnregisterFromTransport() {
+ RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
+ rtp_stream_receiver_.reset();
}
void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) {
@@ -186,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);
}
}
@@ -197,9 +205,4 @@ FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const {
return FlexfecReceiveStream::Stats();
}
-const FlexfecReceiveStream::Config& FlexfecReceiveStreamImpl::GetConfig()
- const {
- return config_;
-}
-
} // namespace webrtc