OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/call/flexfec_receive_stream_impl.h" | 11 #include "webrtc/call/flexfec_receive_stream_impl.h" |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/location.h" | 16 #include "webrtc/base/location.h" |
17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
18 #include "webrtc/call/rtp_stream_receiver_controller_interface.h" | |
18 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | 19 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
19 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 20 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
22 #include "webrtc/modules/utility/include/process_thread.h" | 23 #include "webrtc/modules/utility/include/process_thread.h" |
23 #include "webrtc/system_wrappers/include/clock.h" | 24 #include "webrtc/system_wrappers/include/clock.h" |
24 | 25 |
25 namespace webrtc { | 26 namespace webrtc { |
26 | 27 |
27 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const { | 28 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 configuration.receive_statistics = receive_statistics; | 116 configuration.receive_statistics = receive_statistics; |
116 configuration.outgoing_transport = rtcp_send_transport; | 117 configuration.outgoing_transport = rtcp_send_transport; |
117 configuration.rtt_stats = rtt_stats; | 118 configuration.rtt_stats = rtt_stats; |
118 std::unique_ptr<RtpRtcp> rtp_rtcp(RtpRtcp::CreateRtpRtcp(configuration)); | 119 std::unique_ptr<RtpRtcp> rtp_rtcp(RtpRtcp::CreateRtpRtcp(configuration)); |
119 return rtp_rtcp; | 120 return rtp_rtcp; |
120 } | 121 } |
121 | 122 |
122 } // namespace | 123 } // namespace |
123 | 124 |
124 FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl( | 125 FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl( |
126 RtpStreamReceiverControllerInterface* receiver_controller, | |
125 const Config& config, | 127 const Config& config, |
126 RecoveredPacketReceiver* recovered_packet_receiver, | 128 RecoveredPacketReceiver* recovered_packet_receiver, |
127 RtcpRttStats* rtt_stats, | 129 RtcpRttStats* rtt_stats, |
128 ProcessThread* process_thread) | 130 ProcessThread* process_thread) |
129 : config_(config), | 131 : config_(config), |
130 started_(false), | 132 started_(false), |
131 receiver_(MaybeCreateFlexfecReceiver(config_, recovered_packet_receiver)), | 133 receiver_(MaybeCreateFlexfecReceiver(config_, recovered_packet_receiver)), |
132 rtp_receive_statistics_( | 134 rtp_receive_statistics_( |
133 ReceiveStatistics::Create(Clock::GetRealTimeClock())), | 135 ReceiveStatistics::Create(Clock::GetRealTimeClock())), |
134 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), | 136 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), |
135 config_.rtcp_send_transport, | 137 config_.rtcp_send_transport, |
136 rtt_stats)), | 138 rtt_stats)), |
137 process_thread_(process_thread) { | 139 process_thread_(process_thread) { |
138 LOG(LS_INFO) << "FlexfecReceiveStreamImpl: " << config_.ToString(); | 140 LOG(LS_INFO) << "FlexfecReceiveStreamImpl: " << config_.ToString(); |
139 | 141 |
140 // RTCP reporting. | 142 // RTCP reporting. |
141 rtp_rtcp_->SetRTCPStatus(config_.rtcp_mode); | 143 rtp_rtcp_->SetRTCPStatus(config_.rtcp_mode); |
142 rtp_rtcp_->SetSSRC(config_.local_ssrc); | 144 rtp_rtcp_->SetSSRC(config_.local_ssrc); |
143 process_thread_->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE); | 145 process_thread_->RegisterModule(rtp_rtcp_.get(), RTC_FROM_HERE); |
146 | |
147 // Register with transport. | |
148 // TODO(nisse): OnRtpPacket in this class delegates all real work to | |
149 // |receiver_|. So maybe we don't need to implement RtpPacketSinkInterface | |
150 // here at all, we'd then delete the OnRtpPacket method and instead register | |
151 // |receiver_| as the RtpPacketSinkInterface for this stream. | |
152 // TODO(nisse): Passing |this| from the constructor to the RtpDemuxer, before | |
153 // the object is fully initialized, is risky. But it works in this case | |
154 // because locking in our caller, Call::CreateFlexfecReceiveStream, ensures | |
155 // that the demuxer doesn't call OnRtpPacket before this object is fully | |
156 // constructed. Registering |receiver_| instead of |this| would solve this | |
157 // problem too. | |
158 rtp_stream_receiver_ = | |
159 receiver_controller->CreateReceiver(config_.remote_ssrc, this); | |
nisse-webrtc
2017/06/20 13:35:35
This is another case of passing |this| before the
| |
160 for (uint32_t ssrc : config.protected_media_ssrcs) | |
161 receiver_controller->AddSink(ssrc, this); | |
144 } | 162 } |
145 | 163 |
146 FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() { | 164 FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() { |
147 LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString(); | 165 LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString(); |
148 Stop(); | 166 Stop(); |
149 process_thread_->DeRegisterModule(rtp_rtcp_.get()); | 167 process_thread_->DeRegisterModule(rtp_rtcp_.get()); |
150 } | 168 } |
151 | 169 |
152 void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) { | 170 void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) { |
153 { | 171 { |
(...skipping 28 matching lines...) Expand all Loading... | |
182 started_ = false; | 200 started_ = false; |
183 } | 201 } |
184 | 202 |
185 // TODO(brandtr): Implement this member function when we have designed the | 203 // TODO(brandtr): Implement this member function when we have designed the |
186 // stats for FlexFEC. | 204 // stats for FlexFEC. |
187 FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const { | 205 FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const { |
188 return FlexfecReceiveStream::Stats(); | 206 return FlexfecReceiveStream::Stats(); |
189 } | 207 } |
190 | 208 |
191 } // namespace webrtc | 209 } // namespace webrtc |
OLD | NEW |