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

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

Issue 3006063002: Reland of Use RtxReceiveStream. (Closed)
Patch Set: Address comments. Created 3 years, 3 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
« no previous file with comments | « 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/api/optional.h" 19 #include "webrtc/api/optional.h"
20 #include "webrtc/call/rtp_stream_receiver_controller_interface.h" 20 #include "webrtc/call/rtp_stream_receiver_controller_interface.h"
21 #include "webrtc/call/rtx_receive_stream.h"
21 #include "webrtc/common_types.h" 22 #include "webrtc/common_types.h"
22 #include "webrtc/common_video/h264/profile_level_id.h" 23 #include "webrtc/common_video/h264/profile_level_id.h"
23 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 24 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
26 #include "webrtc/modules/utility/include/process_thread.h" 27 #include "webrtc/modules/utility/include/process_thread.h"
27 #include "webrtc/modules/video_coding/frame_object.h" 28 #include "webrtc/modules/video_coding/frame_object.h"
28 #include "webrtc/modules/video_coding/include/video_coding.h" 29 #include "webrtc/modules/video_coding/include/video_coding.h"
29 #include "webrtc/modules/video_coding/jitter_estimator.h" 30 #include "webrtc/modules/video_coding/jitter_estimator.h"
30 #include "webrtc/modules/video_coding/timing.h" 31 #include "webrtc/modules/video_coding/timing.h"
31 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" 32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h"
32 #include "webrtc/rtc_base/checks.h" 33 #include "webrtc/rtc_base/checks.h"
33 #include "webrtc/rtc_base/location.h" 34 #include "webrtc/rtc_base/location.h"
34 #include "webrtc/rtc_base/logging.h" 35 #include "webrtc/rtc_base/logging.h"
36 #include "webrtc/rtc_base/ptr_util.h"
35 #include "webrtc/rtc_base/trace_event.h" 37 #include "webrtc/rtc_base/trace_event.h"
36 #include "webrtc/system_wrappers/include/clock.h" 38 #include "webrtc/system_wrappers/include/clock.h"
37 #include "webrtc/system_wrappers/include/field_trial.h" 39 #include "webrtc/system_wrappers/include/field_trial.h"
38 #include "webrtc/video/call_stats.h" 40 #include "webrtc/video/call_stats.h"
39 #include "webrtc/video/receive_statistics_proxy.h" 41 #include "webrtc/video/receive_statistics_proxy.h"
40 42
41 namespace webrtc { 43 namespace webrtc {
42 44
43 namespace { 45 namespace {
44 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) { 46 VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 : transport_adapter_(config.rtcp_send_transport), 83 : transport_adapter_(config.rtcp_send_transport),
82 config_(std::move(config)), 84 config_(std::move(config)),
83 num_cpu_cores_(num_cpu_cores), 85 num_cpu_cores_(num_cpu_cores),
84 process_thread_(process_thread), 86 process_thread_(process_thread),
85 clock_(Clock::GetRealTimeClock()), 87 clock_(Clock::GetRealTimeClock()),
86 decode_thread_(&DecodeThreadFunction, 88 decode_thread_(&DecodeThreadFunction,
87 this, 89 this,
88 "DecodingThread", 90 "DecodingThread",
89 rtc::kHighestPriority), 91 rtc::kHighestPriority),
90 call_stats_(call_stats), 92 call_stats_(call_stats),
93 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)),
91 timing_(new VCMTiming(clock_)), 94 timing_(new VCMTiming(clock_)),
92 video_receiver_(clock_, nullptr, this, timing_.get(), this, this), 95 video_receiver_(clock_, nullptr, this, timing_.get(), this, this),
93 stats_proxy_(&config_, clock_), 96 stats_proxy_(&config_, clock_),
94 rtp_video_stream_receiver_(&transport_adapter_, 97 rtp_video_stream_receiver_(&transport_adapter_,
95 call_stats_->rtcp_rtt_stats(), 98 call_stats_->rtcp_rtt_stats(),
96 packet_router, 99 packet_router,
97 &config_, 100 &config_,
101 rtp_receive_statistics_.get(),
98 &stats_proxy_, 102 &stats_proxy_,
99 process_thread_, 103 process_thread_,
100 this, // NackSender 104 this, // NackSender
101 this, // KeyFrameRequestSender 105 this, // KeyFrameRequestSender
102 this, // OnCompleteFrameCallback 106 this, // OnCompleteFrameCallback
103 timing_.get()), 107 timing_.get()),
104 rtp_stream_sync_(this) { 108 rtp_stream_sync_(this) {
105 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); 109 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
106 110
107 RTC_DCHECK(process_thread_); 111 RTC_DCHECK(process_thread_);
108 RTC_DCHECK(call_stats_); 112 RTC_DCHECK(call_stats_);
109 113
110 module_process_sequence_checker_.Detach(); 114 module_process_sequence_checker_.Detach();
111 115
112 RTC_DCHECK(!config_.decoders.empty()); 116 RTC_DCHECK(!config_.decoders.empty());
113 std::set<int> decoder_payload_types; 117 std::set<int> decoder_payload_types;
114 for (const Decoder& decoder : config_.decoders) { 118 for (const Decoder& decoder : config_.decoders) {
115 RTC_CHECK(decoder.decoder); 119 RTC_CHECK(decoder.decoder);
116 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == 120 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) ==
117 decoder_payload_types.end()) 121 decoder_payload_types.end())
118 << "Duplicate payload type (" << decoder.payload_type 122 << "Duplicate payload type (" << decoder.payload_type
119 << ") for different decoders."; 123 << ") for different decoders.";
120 decoder_payload_types.insert(decoder.payload_type); 124 decoder_payload_types.insert(decoder.payload_type);
121 } 125 }
122 126
123 video_receiver_.SetRenderDelay(config.render_delay_ms); 127 video_receiver_.SetRenderDelay(config_.render_delay_ms);
124 128
125 jitter_estimator_.reset(new VCMJitterEstimator(clock_)); 129 jitter_estimator_.reset(new VCMJitterEstimator(clock_));
126 frame_buffer_.reset(new video_coding::FrameBuffer( 130 frame_buffer_.reset(new video_coding::FrameBuffer(
127 clock_, jitter_estimator_.get(), timing_.get(), &stats_proxy_)); 131 clock_, jitter_estimator_.get(), timing_.get(), &stats_proxy_));
128 132
129 process_thread_->RegisterModule(&rtp_stream_sync_, RTC_FROM_HERE); 133 process_thread_->RegisterModule(&rtp_stream_sync_, RTC_FROM_HERE);
130 134
131 // Register with RtpStreamReceiverController. 135 // Register with RtpStreamReceiverController.
132 media_receiver_ = receiver_controller->CreateReceiver( 136 media_receiver_ = receiver_controller->CreateReceiver(
133 config_.rtp.remote_ssrc, &rtp_video_stream_receiver_); 137 config_.rtp.remote_ssrc, &rtp_video_stream_receiver_);
134 if (config.rtp.rtx_ssrc) { 138 if (config_.rtp.rtx_ssrc) {
139 rtx_receive_stream_ = rtc::MakeUnique<RtxReceiveStream>(
140 &rtp_video_stream_receiver_, config.rtp.rtx_associated_payload_types,
141 config_.rtp.remote_ssrc, rtp_receive_statistics_.get());
135 rtx_receiver_ = receiver_controller->CreateReceiver( 142 rtx_receiver_ = receiver_controller->CreateReceiver(
136 config_.rtp.rtx_ssrc, &rtp_video_stream_receiver_); 143 config_.rtp.rtx_ssrc, rtx_receive_stream_.get());
137 } 144 }
138 } 145 }
139 146
140 VideoReceiveStream::~VideoReceiveStream() { 147 VideoReceiveStream::~VideoReceiveStream() {
141 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_); 148 RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_);
142 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); 149 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
143 Stop(); 150 Stop();
144 151
145 process_thread_->DeRegisterModule(&rtp_stream_sync_); 152 process_thread_->DeRegisterModule(&rtp_stream_sync_);
146 } 153 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 if (stream_is_active && !receiving_keyframe) { 444 if (stream_is_active && !receiving_keyframe) {
438 LOG(LS_WARNING) << "No decodable frame in " << wait_ms 445 LOG(LS_WARNING) << "No decodable frame in " << wait_ms
439 << " ms, requesting keyframe."; 446 << " ms, requesting keyframe.";
440 RequestKeyFrame(); 447 RequestKeyFrame();
441 } 448 }
442 } 449 }
443 return true; 450 return true;
444 } 451 }
445 } // namespace internal 452 } // namespace internal
446 } // namespace webrtc 453 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698