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

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

Issue 2452163004: Stop using VoEVideoSync in Call/VideoReceiveStream. (Closed)
Patch Set: Get rid of unnecessary Clock* Created 3 years, 11 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) 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" 24 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
25 #include "webrtc/modules/utility/include/process_thread.h" 27 #include "webrtc/modules/utility/include/process_thread.h"
26 #include "webrtc/modules/video_coding/frame_object.h" 28 #include "webrtc/modules/video_coding/frame_object.h"
27 #include "webrtc/modules/video_coding/include/video_coding.h" 29 #include "webrtc/modules/video_coding/include/video_coding.h"
28 #include "webrtc/modules/video_coding/jitter_estimator.h" 30 #include "webrtc/modules/video_coding/jitter_estimator.h"
29 #include "webrtc/modules/video_coding/timing.h" 31 #include "webrtc/modules/video_coding/timing.h"
30 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" 32 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h"
31 #include "webrtc/system_wrappers/include/clock.h" 33 #include "webrtc/system_wrappers/include/clock.h"
32 #include "webrtc/system_wrappers/include/field_trial.h" 34 #include "webrtc/system_wrappers/include/field_trial.h"
33 #include "webrtc/video/call_stats.h" 35 #include "webrtc/video/call_stats.h"
34 #include "webrtc/video/receive_statistics_proxy.h" 36 #include "webrtc/video/receive_statistics_proxy.h"
35 #include "webrtc/video_receive_stream.h" 37 #include "webrtc/video_receive_stream.h"
36 #include "webrtc/voice_engine/include/voe_video_sync.h"
37 38
38 namespace webrtc { 39 namespace webrtc {
39 40
40 static bool UseSendSideBwe(const VideoReceiveStream::Config& config) { 41 static bool UseSendSideBwe(const VideoReceiveStream::Config& config) {
41 if (!config.rtp.transport_cc) 42 if (!config.rtp.transport_cc)
42 return false; 43 return false;
43 for (const auto& extension : config.rtp.extensions) { 44 for (const auto& extension : config.rtp.extensions) {
44 if (extension.uri == RtpExtension::kTransportSequenceNumberUri) 45 if (extension.uri == RtpExtension::kTransportSequenceNumberUri)
45 return true; 46 return true;
46 } 47 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 185 }
185 } // namespace 186 } // namespace
186 187
187 namespace internal { 188 namespace internal {
188 189
189 VideoReceiveStream::VideoReceiveStream( 190 VideoReceiveStream::VideoReceiveStream(
190 int num_cpu_cores, 191 int num_cpu_cores,
191 CongestionController* congestion_controller, 192 CongestionController* congestion_controller,
192 PacketRouter* packet_router, 193 PacketRouter* packet_router,
193 VideoReceiveStream::Config config, 194 VideoReceiveStream::Config config,
194 webrtc::VoiceEngine* voice_engine,
195 ProcessThread* process_thread, 195 ProcessThread* process_thread,
196 CallStats* call_stats, 196 CallStats* call_stats,
197 VieRemb* remb) 197 VieRemb* remb)
198 : transport_adapter_(config.rtcp_send_transport), 198 : transport_adapter_(config.rtcp_send_transport),
199 config_(std::move(config)), 199 config_(std::move(config)),
200 num_cpu_cores_(num_cpu_cores), 200 num_cpu_cores_(num_cpu_cores),
201 process_thread_(process_thread), 201 process_thread_(process_thread),
202 clock_(Clock::GetRealTimeClock()), 202 clock_(Clock::GetRealTimeClock()),
203 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), 203 decode_thread_(DecodeThreadFunction, this, "DecodingThread"),
204 congestion_controller_(congestion_controller), 204 congestion_controller_(congestion_controller),
(...skipping 11 matching lines...) Expand all
216 packet_router, 216 packet_router,
217 remb, 217 remb,
218 &config_, 218 &config_,
219 &stats_proxy_, 219 &stats_proxy_,
220 process_thread_, 220 process_thread_,
221 congestion_controller_->GetRetransmissionRateLimiter(), 221 congestion_controller_->GetRetransmissionRateLimiter(),
222 this, // NackSender 222 this, // NackSender
223 this, // KeyFrameRequestSender 223 this, // KeyFrameRequestSender
224 this, // OnCompleteFrameCallback 224 this, // OnCompleteFrameCallback
225 timing_.get()), 225 timing_.get()),
226 rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_) { 226 rtp_stream_sync_(this) {
227 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); 227 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
228 228
229 RTC_DCHECK(process_thread_); 229 RTC_DCHECK(process_thread_);
230 RTC_DCHECK(congestion_controller_); 230 RTC_DCHECK(congestion_controller_);
231 RTC_DCHECK(call_stats_); 231 RTC_DCHECK(call_stats_);
232 232
233 RTC_DCHECK(!config_.decoders.empty()); 233 RTC_DCHECK(!config_.decoders.empty());
234 std::set<int> decoder_payload_types; 234 std::set<int> decoder_payload_types;
235 for (const Decoder& decoder : config_.decoders) { 235 for (const Decoder& decoder : config_.decoders) {
236 RTC_CHECK(decoder.decoder); 236 RTC_CHECK(decoder.decoder);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 for (const Decoder& decoder : config_.decoders) 350 for (const Decoder& decoder : config_.decoders)
351 video_receiver_.RegisterExternalDecoder(nullptr, decoder.payload_type); 351 video_receiver_.RegisterExternalDecoder(nullptr, decoder.payload_type);
352 } 352 }
353 353
354 call_stats_->DeregisterStatsObserver(video_stream_decoder_.get()); 354 call_stats_->DeregisterStatsObserver(video_stream_decoder_.get());
355 video_stream_decoder_.reset(); 355 video_stream_decoder_.reset();
356 incoming_video_stream_.reset(); 356 incoming_video_stream_.reset();
357 transport_adapter_.Disable(); 357 transport_adapter_.Disable();
358 } 358 }
359 359
360 void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine, 360 void VideoReceiveStream::SetSync(Syncable* audio_syncable) {
361 int audio_channel_id) { 361 rtp_stream_sync_.ConfigureSync(audio_syncable);
362 if (voice_engine && audio_channel_id != -1) {
363 VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine);
364 rtp_stream_sync_.ConfigureSync(audio_channel_id, voe_sync_interface);
365 voe_sync_interface->Release();
366 } else {
367 rtp_stream_sync_.ConfigureSync(-1, nullptr);
368 }
369 } 362 }
370 363
371 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const { 364 VideoReceiveStream::Stats VideoReceiveStream::GetStats() const {
372 return stats_proxy_.GetStats(); 365 return stats_proxy_.GetStats();
373 } 366 }
374 367
375 // TODO(tommi): This method grabs a lock 6 times. 368 // TODO(tommi): This method grabs a lock 6 times.
376 void VideoReceiveStream::OnFrame(const VideoFrame& video_frame) { 369 void VideoReceiveStream::OnFrame(const VideoFrame& video_frame) {
377 // TODO(tommi): OnDecodedFrame grabs a lock, incidentally the same lock 370 // TODO(tommi): OnDecodedFrame grabs a lock, incidentally the same lock
378 // that OnSyncOffsetUpdated() and OnRenderedFrame() below grab. 371 // that OnSyncOffsetUpdated() and OnRenderedFrame() below grab.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // Make a keyframe appear as early as possible in the logs, to give actually 466 // Make a keyframe appear as early as possible in the logs, to give actually
474 // decodable output. 467 // decodable output.
475 RequestKeyFrame(); 468 RequestKeyFrame();
476 } 469 }
477 } 470 }
478 471
479 void VideoReceiveStream::RequestKeyFrame() { 472 void VideoReceiveStream::RequestKeyFrame() {
480 rtp_stream_receiver_.RequestKeyFrame(); 473 rtp_stream_receiver_.RequestKeyFrame();
481 } 474 }
482 475
476 int VideoReceiveStream::id() const {
477 // TODO(solenberg): This appears to be what the current code does, but I
478 // believe we should be using remote_ssrc instead?
479 return config_.rtp.local_ssrc;
480 }
481
482 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
483 // Called on Call's module_process_thread_.
stefan-webrtc 2017/01/26 08:40:50 I wouldn't mind if thread checks were added here t
the sun 2017/01/30 15:43:12 Happy to oblige.
484 Syncable::Info info;
485
486 RtpReceiver* rtp_receiver = rtp_stream_receiver_.GetRtpReceiver();
487 RTC_DCHECK(rtp_receiver);
488 if (!rtp_receiver->Timestamp(&info.latest_receive_timestamp))
489 return rtc::Optional<Syncable::Info>();
490 if (!rtp_receiver->LastReceivedTimeMs(&info.latest_receive_time_ms))
491 return rtc::Optional<Syncable::Info>();
492
493 RtpRtcp* rtp_rtcp = rtp_stream_receiver_.rtp_rtcp();
494 RTC_DCHECK(rtp_rtcp);
495 if (rtp_rtcp->RemoteNTP(&info.ntp_secs, &info.ntp_frac, nullptr, nullptr,
496 &info.rtp_timestamp) != 0) {
497 return rtc::Optional<Syncable::Info>();
498 }
499
500 info.current_delay_ms = video_receiver_.Delay();
501 return rtc::Optional<Syncable::Info>(info);
502 }
503
504 uint32_t VideoReceiveStream::GetPlayoutTimestamp() const {
505 RTC_NOTREACHED();
506 }
507
508 void VideoReceiveStream::SetMinimumPlayoutDelay(int delay_ms) {
509 // Called on Call's module_process_thread_.
510 video_receiver_.SetMinimumPlayoutDelay(delay_ms);
511 }
512
483 } // namespace internal 513 } // namespace internal
484 } // namespace webrtc 514 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698