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 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 | 122 |
123 FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl( | 123 FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl( |
124 const Config& config, | 124 const Config& config, |
125 RecoveredPacketReceiver* recovered_packet_receiver, | 125 RecoveredPacketReceiver* recovered_packet_receiver, |
126 RtcpRttStats* rtt_stats, | 126 RtcpRttStats* rtt_stats, |
127 ProcessThread* process_thread) | 127 ProcessThread* process_thread) |
128 : config_(config), | 128 : config_(config), |
| 129 rtp_config_(config.rtp_header_extensions, config.transport_cc), |
129 started_(false), | 130 started_(false), |
130 receiver_(MaybeCreateFlexfecReceiver(config_, recovered_packet_receiver)), | 131 receiver_(MaybeCreateFlexfecReceiver(config_, recovered_packet_receiver)), |
131 rtp_receive_statistics_( | 132 rtp_receive_statistics_( |
132 ReceiveStatistics::Create(Clock::GetRealTimeClock())), | 133 ReceiveStatistics::Create(Clock::GetRealTimeClock())), |
133 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), | 134 rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(), |
134 config_.rtcp_send_transport, | 135 config_.rtcp_send_transport, |
135 rtt_stats)), | 136 rtt_stats)), |
136 process_thread_(process_thread) { | 137 process_thread_(process_thread) { |
137 LOG(LS_INFO) << "FlexfecReceiveStreamImpl: " << config_.ToString(); | 138 LOG(LS_INFO) << "FlexfecReceiveStreamImpl: " << config_.ToString(); |
138 | 139 |
139 // RTCP reporting. | 140 // RTCP reporting. |
140 rtp_rtcp_->SetSendingMediaStatus(false); | 141 rtp_rtcp_->SetSendingMediaStatus(false); |
141 rtp_rtcp_->SetRTCPStatus(config_.rtcp_mode); | 142 rtp_rtcp_->SetRTCPStatus(config_.rtcp_mode); |
142 rtp_rtcp_->SetSSRC(config_.local_ssrc); | 143 rtp_rtcp_->SetSSRC(config_.local_ssrc); |
143 process_thread_->RegisterModule(rtp_rtcp_.get()); | 144 process_thread_->RegisterModule(rtp_rtcp_.get()); |
144 } | 145 } |
145 | 146 |
146 FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() { | 147 FlexfecReceiveStreamImpl::~FlexfecReceiveStreamImpl() { |
147 LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString(); | 148 LOG(LS_INFO) << "~FlexfecReceiveStreamImpl: " << config_.ToString(); |
148 Stop(); | 149 Stop(); |
149 process_thread_->DeRegisterModule(rtp_rtcp_.get()); | 150 process_thread_->DeRegisterModule(rtp_rtcp_.get()); |
150 } | 151 } |
151 | 152 |
152 bool FlexfecReceiveStreamImpl::AddAndProcessReceivedPacket( | 153 bool FlexfecReceiveStreamImpl::OnRtpPacket( |
153 const RtpPacketReceived& packet) { | 154 const RtpPacketReceived& packet) { |
154 { | 155 { |
155 rtc::CritScope cs(&crit_); | 156 rtc::CritScope cs(&crit_); |
156 if (!started_) | 157 if (!started_) |
157 return false; | 158 return false; |
158 } | 159 } |
159 | 160 |
160 if (!receiver_) | 161 if (!receiver_) |
161 return false; | 162 return false; |
162 | 163 |
163 if (!receiver_->AddAndProcessReceivedPacket(packet)) | 164 if (!receiver_->AddAndProcessReceivedPacket(packet)) |
164 return false; | 165 return false; |
165 | 166 |
166 // Do not report media packets in the RTCP RRs generated by |rtp_rtcp_|. | 167 // Do not report media packets in the RTCP RRs generated by |rtp_rtcp_|. |
167 if (packet.Ssrc() == config_.remote_ssrc) { | 168 if (packet.Ssrc() == config_.remote_ssrc) { |
168 RTPHeader header; | 169 RTPHeader header; |
169 packet.GetHeader(&header); | 170 packet.GetHeader(&header); |
170 // FlexFEC packets are never retransmitted. | 171 // FlexFEC packets are never retransmitted. |
171 const bool kNotRetransmitted = false; | 172 const bool kNotRetransmitted = false; |
172 rtp_receive_statistics_->IncomingPacket(header, packet.size(), | 173 rtp_receive_statistics_->IncomingPacket(header, packet.size(), |
173 kNotRetransmitted); | 174 kNotRetransmitted); |
174 } | 175 } |
175 | 176 |
176 return true; | 177 return true; |
177 } | 178 } |
178 | 179 |
| 180 const RtpPacketReceiver::RtpConfig& |
| 181 FlexfecReceiveStreamImpl::rtp_config() const { |
| 182 return rtp_config_; |
| 183 } |
| 184 |
179 void FlexfecReceiveStreamImpl::Start() { | 185 void FlexfecReceiveStreamImpl::Start() { |
180 rtc::CritScope cs(&crit_); | 186 rtc::CritScope cs(&crit_); |
181 started_ = true; | 187 started_ = true; |
182 } | 188 } |
183 | 189 |
184 void FlexfecReceiveStreamImpl::Stop() { | 190 void FlexfecReceiveStreamImpl::Stop() { |
185 rtc::CritScope cs(&crit_); | 191 rtc::CritScope cs(&crit_); |
186 started_ = false; | 192 started_ = false; |
187 } | 193 } |
188 | 194 |
189 // TODO(brandtr): Implement this member function when we have designed the | 195 // TODO(brandtr): Implement this member function when we have designed the |
190 // stats for FlexFEC. | 196 // stats for FlexFEC. |
191 FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const { | 197 FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const { |
192 return FlexfecReceiveStream::Stats(); | 198 return FlexfecReceiveStream::Stats(); |
193 } | 199 } |
194 | 200 |
195 } // namespace webrtc | 201 } // namespace webrtc |
OLD | NEW |