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

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

Issue 2407163002: Make sure VideoReceiveStream can be restarted (Closed)
Patch Set: Created 4 years, 2 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
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 VideoReceiveStream::VideoReceiveStream( 181 VideoReceiveStream::VideoReceiveStream(
182 int num_cpu_cores, 182 int num_cpu_cores,
183 CongestionController* congestion_controller, 183 CongestionController* congestion_controller,
184 VideoReceiveStream::Config config, 184 VideoReceiveStream::Config config,
185 webrtc::VoiceEngine* voice_engine, 185 webrtc::VoiceEngine* voice_engine,
186 ProcessThread* process_thread, 186 ProcessThread* process_thread,
187 CallStats* call_stats, 187 CallStats* call_stats,
188 VieRemb* remb) 188 VieRemb* remb)
189 : transport_adapter_(config.rtcp_send_transport), 189 : transport_adapter_(config.rtcp_send_transport),
190 config_(std::move(config)), 190 config_(std::move(config)),
191 num_cpu_cores_(num_cpu_cores),
191 process_thread_(process_thread), 192 process_thread_(process_thread),
192 clock_(Clock::GetRealTimeClock()), 193 clock_(Clock::GetRealTimeClock()),
193 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), 194 decode_thread_(DecodeThreadFunction, this, "DecodingThread"),
194 congestion_controller_(congestion_controller), 195 congestion_controller_(congestion_controller),
195 call_stats_(call_stats), 196 call_stats_(call_stats),
196 video_receiver_(clock_, nullptr, this, this, this), 197 video_receiver_(clock_, nullptr, this, this, this),
197 stats_proxy_(&config_, clock_), 198 stats_proxy_(&config_, clock_),
198 rtp_stream_receiver_( 199 rtp_stream_receiver_(
199 &video_receiver_, 200 &video_receiver_,
200 congestion_controller_->GetRemoteBitrateEstimator( 201 congestion_controller_->GetRemoteBitrateEstimator(
(...skipping 16 matching lines...) Expand all
217 218
218 RTC_DCHECK(!config_.decoders.empty()); 219 RTC_DCHECK(!config_.decoders.empty());
219 std::set<int> decoder_payload_types; 220 std::set<int> decoder_payload_types;
220 for (const Decoder& decoder : config_.decoders) { 221 for (const Decoder& decoder : config_.decoders) {
221 RTC_CHECK(decoder.decoder); 222 RTC_CHECK(decoder.decoder);
222 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == 223 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) ==
223 decoder_payload_types.end()) 224 decoder_payload_types.end())
224 << "Duplicate payload type (" << decoder.payload_type 225 << "Duplicate payload type (" << decoder.payload_type
225 << ") for different decoders."; 226 << ") for different decoders.";
226 decoder_payload_types.insert(decoder.payload_type); 227 decoder_payload_types.insert(decoder.payload_type);
227 video_receiver_.RegisterExternalDecoder(decoder.decoder,
228 decoder.payload_type);
229
230 VideoCodec codec = CreateDecoderVideoCodec(decoder);
231 RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec));
232 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec(
233 &codec, num_cpu_cores, false));
234 } 228 }
235 229
236 video_receiver_.SetRenderDelay(config.render_delay_ms); 230 video_receiver_.SetRenderDelay(config.render_delay_ms);
237 231
238 process_thread_->RegisterModule(&video_receiver_); 232 process_thread_->RegisterModule(&video_receiver_);
239 process_thread_->RegisterModule(&rtp_stream_sync_); 233 process_thread_->RegisterModule(&rtp_stream_sync_);
240 } 234 }
241 235
242 VideoReceiveStream::~VideoReceiveStream() { 236 VideoReceiveStream::~VideoReceiveStream() {
243 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); 237 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
(...skipping 30 matching lines...) Expand all
274 if (config_.disable_prerenderer_smoothing) { 268 if (config_.disable_prerenderer_smoothing) {
275 renderer = this; 269 renderer = this;
276 } else { 270 } else {
277 incoming_video_stream_.reset( 271 incoming_video_stream_.reset(
278 new IncomingVideoStream(config_.render_delay_ms, this)); 272 new IncomingVideoStream(config_.render_delay_ms, this));
279 renderer = incoming_video_stream_.get(); 273 renderer = incoming_video_stream_.get();
280 } 274 }
281 } 275 }
282 RTC_DCHECK(renderer != nullptr); 276 RTC_DCHECK(renderer != nullptr);
283 277
278 for (const Decoder& decoder : config_.decoders) {
279 video_receiver_.RegisterExternalDecoder(decoder.decoder,
280 decoder.payload_type);
281
282 VideoCodec codec = CreateDecoderVideoCodec(decoder);
283 RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec));
284 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec(
285 &codec, num_cpu_cores_, false));
286 }
287
284 video_stream_decoder_.reset(new VideoStreamDecoder( 288 video_stream_decoder_.reset(new VideoStreamDecoder(
285 &video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_, 289 &video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_,
286 rtp_stream_receiver_.IsRetransmissionsEnabled(), 290 rtp_stream_receiver_.IsRetransmissionsEnabled(),
287 rtp_stream_receiver_.IsFecEnabled(), &stats_proxy_, renderer, 291 rtp_stream_receiver_.IsFecEnabled(), &stats_proxy_, renderer,
288 config_.pre_render_callback)); 292 config_.pre_render_callback));
289 // Register the channel to receive stats updates. 293 // Register the channel to receive stats updates.
290 call_stats_->RegisterStatsObserver(video_stream_decoder_.get()); 294 call_stats_->RegisterStatsObserver(video_stream_decoder_.get());
291 // Start the decode thread 295 // Start the decode thread
292 decode_thread_.Start(); 296 decode_thread_.Start();
293 decode_thread_.SetPriority(rtc::kHighestPriority); 297 decode_thread_.SetPriority(rtc::kHighestPriority);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 RequestKeyFrame(); 414 RequestKeyFrame();
411 } 415 }
412 } 416 }
413 417
414 void VideoReceiveStream::RequestKeyFrame() { 418 void VideoReceiveStream::RequestKeyFrame() {
415 rtp_stream_receiver_.RequestKeyFrame(); 419 rtp_stream_receiver_.RequestKeyFrame();
416 } 420 }
417 421
418 } // namespace internal 422 } // namespace internal
419 } // namespace webrtc 423 } // 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