Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: webrtc/call/flexfec_receive_stream_impl.cc

Issue 2688473004: RtpPacketReceiver base class and OnRtpPacket, with a pre-parsed RTP packet. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698