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

Side by Side Diff: webrtc/video/video_receive_stream.cc

Issue 2669463006: Move RemoteBitrateEstimator::RemoveStream calls from receive streams to Call. (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
« webrtc/call/call.cc ('K') | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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/video/video_receive_stream.h" 11 #include "webrtc/video/video_receive_stream.h"
12 12
13 #include <stdlib.h> 13 #include <stdlib.h>
14 14
15 #include <set> 15 #include <set>
16 #include <string> 16 #include <string>
17 #include <utility> 17 #include <utility>
18 18
19 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/base/optional.h" 21 #include "webrtc/base/optional.h"
22 #include "webrtc/common_video/h264/profile_level_id.h" 22 #include "webrtc/common_video/h264/profile_level_id.h"
23 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 23 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
24 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
27 #include "webrtc/modules/utility/include/process_thread.h" 26 #include "webrtc/modules/utility/include/process_thread.h"
28 #include "webrtc/modules/video_coding/frame_object.h" 27 #include "webrtc/modules/video_coding/frame_object.h"
29 #include "webrtc/modules/video_coding/include/video_coding.h" 28 #include "webrtc/modules/video_coding/include/video_coding.h"
30 #include "webrtc/modules/video_coding/jitter_estimator.h" 29 #include "webrtc/modules/video_coding/jitter_estimator.h"
31 #include "webrtc/modules/video_coding/timing.h" 30 #include "webrtc/modules/video_coding/timing.h"
32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" 31 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h"
33 #include "webrtc/system_wrappers/include/clock.h" 32 #include "webrtc/system_wrappers/include/clock.h"
34 #include "webrtc/system_wrappers/include/field_trial.h" 33 #include "webrtc/system_wrappers/include/field_trial.h"
35 #include "webrtc/video/call_stats.h" 34 #include "webrtc/video/call_stats.h"
36 #include "webrtc/video/receive_statistics_proxy.h" 35 #include "webrtc/video/receive_statistics_proxy.h"
37 #include "webrtc/video_receive_stream.h" 36 #include "webrtc/video_receive_stream.h"
38 37
39 namespace webrtc { 38 namespace webrtc {
40 39
41 static bool UseSendSideBwe(const VideoReceiveStream::Config& config) {
42 if (!config.rtp.transport_cc)
43 return false;
44 for (const auto& extension : config.rtp.extensions) {
45 if (extension.uri == RtpExtension::kTransportSequenceNumberUri)
46 return true;
47 }
48 return false;
49 }
50
51 std::string VideoReceiveStream::Decoder::ToString() const { 40 std::string VideoReceiveStream::Decoder::ToString() const {
52 std::stringstream ss; 41 std::stringstream ss;
53 ss << "{decoder: " << (decoder ? "(VideoDecoder)" : "nullptr"); 42 ss << "{decoder: " << (decoder ? "(VideoDecoder)" : "nullptr");
54 ss << ", payload_type: " << payload_type; 43 ss << ", payload_type: " << payload_type;
55 ss << ", payload_name: " << payload_name; 44 ss << ", payload_name: " << payload_name;
56 ss << ", codec_params: {"; 45 ss << ", codec_params: {";
57 for (const auto& it : codec_params) 46 for (const auto& it : codec_params)
58 ss << it.first << ": " << it.second; 47 ss << it.first << ": " << it.second;
59 ss << '}'; 48 ss << '}';
60 ss << '}'; 49 ss << '}';
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 170
182 return codec; 171 return codec;
183 } 172 }
184 } // namespace 173 } // namespace
185 174
186 namespace internal { 175 namespace internal {
187 176
188 VideoReceiveStream::VideoReceiveStream( 177 VideoReceiveStream::VideoReceiveStream(
189 int num_cpu_cores, 178 int num_cpu_cores,
190 bool protected_by_flexfec, 179 bool protected_by_flexfec,
191 CongestionController* congestion_controller,
192 PacketRouter* packet_router, 180 PacketRouter* packet_router,
193 VideoReceiveStream::Config config, 181 VideoReceiveStream::Config config,
194 ProcessThread* process_thread, 182 ProcessThread* process_thread,
195 CallStats* call_stats, 183 CallStats* call_stats,
196 VieRemb* remb) 184 VieRemb* remb)
197 : transport_adapter_(config.rtcp_send_transport), 185 : transport_adapter_(config.rtcp_send_transport),
198 config_(std::move(config)), 186 config_(std::move(config)),
199 num_cpu_cores_(num_cpu_cores), 187 num_cpu_cores_(num_cpu_cores),
200 protected_by_flexfec_(protected_by_flexfec), 188 protected_by_flexfec_(protected_by_flexfec),
201 process_thread_(process_thread), 189 process_thread_(process_thread),
202 clock_(Clock::GetRealTimeClock()), 190 clock_(Clock::GetRealTimeClock()),
203 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), 191 decode_thread_(DecodeThreadFunction, this, "DecodingThread"),
204 congestion_controller_(congestion_controller),
205 call_stats_(call_stats), 192 call_stats_(call_stats),
206 timing_(new VCMTiming(clock_)), 193 timing_(new VCMTiming(clock_)),
207 video_receiver_(clock_, nullptr, this, timing_.get(), this, this), 194 video_receiver_(clock_, nullptr, this, timing_.get(), this, this),
208 stats_proxy_(&config_, clock_), 195 stats_proxy_(&config_, clock_),
209 rtp_stream_receiver_(&video_receiver_, 196 rtp_stream_receiver_(&video_receiver_,
210 congestion_controller_->GetRemoteBitrateEstimator(
211 UseSendSideBwe(config_)),
212 &transport_adapter_, 197 &transport_adapter_,
213 call_stats_->rtcp_rtt_stats(), 198 call_stats_->rtcp_rtt_stats(),
214 packet_router, 199 packet_router,
215 remb, 200 remb,
216 &config_, 201 &config_,
217 &stats_proxy_, 202 &stats_proxy_,
218 process_thread_, 203 process_thread_,
219 this, // NackSender 204 this, // NackSender
220 this, // KeyFrameRequestSender 205 this, // KeyFrameRequestSender
221 this, // OnCompleteFrameCallback 206 this, // OnCompleteFrameCallback
222 timing_.get()), 207 timing_.get()),
223 rtp_stream_sync_(this), 208 rtp_stream_sync_(this),
224 jitter_buffer_experiment_( 209 jitter_buffer_experiment_(
225 field_trial::FindFullName("WebRTC-NewVideoJitterBuffer") == 210 field_trial::FindFullName("WebRTC-NewVideoJitterBuffer") ==
226 "Enabled") { 211 "Enabled") {
227 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); 212 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
228 213
229 RTC_DCHECK(process_thread_); 214 RTC_DCHECK(process_thread_);
230 RTC_DCHECK(congestion_controller_);
231 RTC_DCHECK(call_stats_); 215 RTC_DCHECK(call_stats_);
232 216
233 module_process_thread_checker_.DetachFromThread(); 217 module_process_thread_checker_.DetachFromThread();
234 218
235 RTC_DCHECK(!config_.decoders.empty()); 219 RTC_DCHECK(!config_.decoders.empty());
236 std::set<int> decoder_payload_types; 220 std::set<int> decoder_payload_types;
237 for (const Decoder& decoder : config_.decoders) { 221 for (const Decoder& decoder : config_.decoders) {
238 RTC_CHECK(decoder.decoder); 222 RTC_CHECK(decoder.decoder);
239 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == 223 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) ==
240 decoder_payload_types.end()) 224 decoder_payload_types.end())
(...skipping 14 matching lines...) Expand all
255 process_thread_->RegisterModule(&rtp_stream_sync_); 239 process_thread_->RegisterModule(&rtp_stream_sync_);
256 } 240 }
257 241
258 VideoReceiveStream::~VideoReceiveStream() { 242 VideoReceiveStream::~VideoReceiveStream() {
259 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 243 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
260 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); 244 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
261 Stop(); 245 Stop();
262 246
263 process_thread_->DeRegisterModule(&rtp_stream_sync_); 247 process_thread_->DeRegisterModule(&rtp_stream_sync_);
264 process_thread_->DeRegisterModule(&video_receiver_); 248 process_thread_->DeRegisterModule(&video_receiver_);
265
266 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config_))
267 ->RemoveStream(rtp_stream_receiver_.GetRemoteSsrc());
268 } 249 }
269 250
270 void VideoReceiveStream::SignalNetworkState(NetworkState state) { 251 void VideoReceiveStream::SignalNetworkState(NetworkState state) {
271 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 252 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
272 rtp_stream_receiver_.SignalNetworkState(state); 253 rtp_stream_receiver_.SignalNetworkState(state);
273 } 254 }
274 255
275 256
276 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { 257 bool VideoReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
277 return rtp_stream_receiver_.DeliverRtcp(packet, length); 258 return rtp_stream_receiver_.DeliverRtcp(packet, length);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs 508 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
528 << " ms, requesting keyframe."; 509 << " ms, requesting keyframe.";
529 RequestKeyFrame(); 510 RequestKeyFrame();
530 } 511 }
531 } else { 512 } else {
532 video_receiver_.Decode(kMaxDecodeWaitTimeMs); 513 video_receiver_.Decode(kMaxDecodeWaitTimeMs);
533 } 514 }
534 } 515 }
535 } // namespace internal 516 } // namespace internal
536 } // namespace webrtc 517 } // namespace webrtc
OLDNEW
« webrtc/call/call.cc ('K') | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698