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

Side by Side Diff: media/cast/receiver/frame_receiver.cc

Issue 1012573002: Remove rtcp_interval from cast_config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « media/cast/receiver/frame_receiver.h ('k') | media/cast/sender/audio_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/receiver/frame_receiver.h" 5 #include "media/cast/receiver/frame_receiver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/big_endian.h" 9 #include "base/big_endian.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 config.rtp_max_delay_ms * config.target_frame_rate / 1000), 43 config.rtp_max_delay_ms * config.target_frame_rate / 1000),
44 rtcp_(RtcpCastMessageCallback(), 44 rtcp_(RtcpCastMessageCallback(),
45 RtcpRttCallback(), 45 RtcpRttCallback(),
46 RtcpLogMessageCallback(), 46 RtcpLogMessageCallback(),
47 cast_environment_->Clock(), 47 cast_environment_->Clock(),
48 NULL, 48 NULL,
49 config.receiver_ssrc, 49 config.receiver_ssrc,
50 config.sender_ssrc), 50 config.sender_ssrc),
51 is_waiting_for_consecutive_frame_(false), 51 is_waiting_for_consecutive_frame_(false),
52 lip_sync_drift_(ClockDriftSmoother::GetDefaultTimeConstant()), 52 lip_sync_drift_(ClockDriftSmoother::GetDefaultTimeConstant()),
53 rtcp_interval_(base::TimeDelta::FromMilliseconds(config.rtcp_interval)),
54 weak_factory_(this) { 53 weak_factory_(this) {
55 transport_->AddValidSsrc(config.sender_ssrc); 54 transport_->AddValidSsrc(config.sender_ssrc);
56 DCHECK_GT(config.rtp_max_delay_ms, 0); 55 DCHECK_GT(config.rtp_max_delay_ms, 0);
57 DCHECK_GT(config.target_frame_rate, 0); 56 DCHECK_GT(config.target_frame_rate, 0);
58 decryptor_.Initialize(config.aes_key, config.aes_iv_mask); 57 decryptor_.Initialize(config.aes_key, config.aes_iv_mask);
59 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); 58 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
60 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); 59 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
61 } 60 }
62 61
63 FrameReceiver::~FrameReceiver() { 62 FrameReceiver::~FrameReceiver() {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 312 }
314 313
315 void FrameReceiver::SendNextCastMessage() { 314 void FrameReceiver::SendNextCastMessage() {
316 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 315 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
317 framer_.SendCastMessage(); // Will only send a message if it is time. 316 framer_.SendCastMessage(); // Will only send a message if it is time.
318 ScheduleNextCastMessage(); 317 ScheduleNextCastMessage();
319 } 318 }
320 319
321 void FrameReceiver::ScheduleNextRtcpReport() { 320 void FrameReceiver::ScheduleNextRtcpReport() {
322 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 321 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
323 base::TimeDelta time_to_next = rtcp_interval_;
324 time_to_next = std::max(
325 time_to_next, base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
326 322
327 cast_environment_->PostDelayedTask( 323 cast_environment_->PostDelayedTask(
328 CastEnvironment::MAIN, 324 CastEnvironment::MAIN, FROM_HERE,
329 FROM_HERE,
330 base::Bind(&FrameReceiver::SendNextRtcpReport, 325 base::Bind(&FrameReceiver::SendNextRtcpReport,
331 weak_factory_.GetWeakPtr()), 326 weak_factory_.GetWeakPtr()),
332 time_to_next); 327 base::TimeDelta::FromMilliseconds(kDefaultRtcpIntervalMs));
333 } 328 }
334 329
335 void FrameReceiver::SendNextRtcpReport() { 330 void FrameReceiver::SendNextRtcpReport() {
336 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 331 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
337 const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 332 const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
338 RtpReceiverStatistics stats = stats_.GetStatistics(); 333 RtpReceiverStatistics stats = stats_.GetStatistics();
339 transport_->SendRtcpFromRtpReceiver(rtcp_.GetLocalSsrc(), 334 transport_->SendRtcpFromRtpReceiver(rtcp_.GetLocalSsrc(),
340 rtcp_.GetRemoteSsrc(), 335 rtcp_.GetRemoteSsrc(),
341 rtcp_.ConvertToNTPAndSave(now), 336 rtcp_.ConvertToNTPAndSave(now),
342 NULL, 337 NULL,
343 base::TimeDelta(), 338 base::TimeDelta(),
344 NULL, 339 NULL,
345 &stats); 340 &stats);
346 ScheduleNextRtcpReport(); 341 ScheduleNextRtcpReport();
347 } 342 }
348 343
349 } // namespace cast 344 } // namespace cast
350 } // namespace media 345 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/frame_receiver.h ('k') | media/cast/sender/audio_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698