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

Side by Side Diff: media/cast/audio_receiver/audio_receiver.cc

Issue 192843002: Cast:Adding signaling and infrastructure for adjustable delay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/audio_receiver/audio_receiver.h ('k') | media/cast/cast_receiver_impl.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/audio_receiver/audio_receiver.h" 5 #include "media/cast/audio_receiver/audio_receiver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 incoming_payload_callback_.get())); 112 incoming_payload_callback_.get()));
113 rtp_audio_receiver_statistics_.reset( 113 rtp_audio_receiver_statistics_.reset(
114 new LocalRtpReceiverStatistics(rtp_receiver_.get())); 114 new LocalRtpReceiverStatistics(rtp_receiver_.get()));
115 base::TimeDelta rtcp_interval_delta = 115 base::TimeDelta rtcp_interval_delta =
116 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval); 116 base::TimeDelta::FromMilliseconds(audio_config.rtcp_interval);
117 rtcp_.reset(new Rtcp(cast_environment, NULL, NULL, packet_sender, NULL, 117 rtcp_.reset(new Rtcp(cast_environment, NULL, NULL, packet_sender, NULL,
118 rtp_audio_receiver_statistics_.get(), 118 rtp_audio_receiver_statistics_.get(),
119 audio_config.rtcp_mode, rtcp_interval_delta, 119 audio_config.rtcp_mode, rtcp_interval_delta,
120 audio_config.feedback_ssrc, audio_config.incoming_ssrc, 120 audio_config.feedback_ssrc, audio_config.incoming_ssrc,
121 audio_config.rtcp_c_name)); 121 audio_config.rtcp_c_name));
122 // Set the target delay that will be conveyed to the sender.
123 rtcp_->SetTargetDelay(target_delay_delta_);
122 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); 124 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
123 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); 125 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
124 } 126 }
125 127
126 AudioReceiver::~AudioReceiver() { 128 AudioReceiver::~AudioReceiver() {
127 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); 129 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_);
128 } 130 }
129 131
130 void AudioReceiver::InitializeTimers() { 132 void AudioReceiver::InitializeTimers() {
131 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 133 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 void AudioReceiver::IncomingPacket(scoped_ptr<Packet> packet) { 362 void AudioReceiver::IncomingPacket(scoped_ptr<Packet> packet) {
361 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 363 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
362 bool rtcp_packet = Rtcp::IsRtcpPacket(&packet->front(), packet->size()); 364 bool rtcp_packet = Rtcp::IsRtcpPacket(&packet->front(), packet->size());
363 if (!rtcp_packet) { 365 if (!rtcp_packet) {
364 rtp_receiver_->ReceivedPacket(&packet->front(), packet->size()); 366 rtp_receiver_->ReceivedPacket(&packet->front(), packet->size());
365 } else { 367 } else {
366 rtcp_->IncomingRtcpPacket(&packet->front(), packet->size()); 368 rtcp_->IncomingRtcpPacket(&packet->front(), packet->size());
367 } 369 }
368 } 370 }
369 371
372 void AudioReceiver::SetTargetDelay(base::TimeDelta target_delay) {
373 target_delay_delta_ = target_delay;
374 rtcp_->SetTargetDelay(target_delay_delta_);
375 }
376
370 void AudioReceiver::CastFeedback(const RtcpCastMessage& cast_message) { 377 void AudioReceiver::CastFeedback(const RtcpCastMessage& cast_message) {
371 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); 378 base::TimeTicks now = cast_environment_->Clock()->NowTicks();
372 RtpTimestamp rtp_timestamp = 379 RtpTimestamp rtp_timestamp =
373 frame_id_to_rtp_timestamp_[cast_message.ack_frame_id_ & 0xff]; 380 frame_id_to_rtp_timestamp_[cast_message.ack_frame_id_ & 0xff];
374 cast_environment_->Logging()->InsertFrameEvent( 381 cast_environment_->Logging()->InsertFrameEvent(
375 now, kAudioAckSent, rtp_timestamp, cast_message.ack_frame_id_); 382 now, kAudioAckSent, rtp_timestamp, cast_message.ack_frame_id_);
376 383
377 rtcp_->SendRtcpFromRtpReceiver(&cast_message, &event_subscriber_); 384 rtcp_->SendRtcpFromRtpReceiver(&cast_message, &event_subscriber_);
378 } 385 }
379 386
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 497 }
491 if (audio_decoder_) { 498 if (audio_decoder_) {
492 // Will only send a message if it is time. 499 // Will only send a message if it is time.
493 audio_decoder_->SendCastMessage(); 500 audio_decoder_->SendCastMessage();
494 } 501 }
495 ScheduleNextCastMessage(); 502 ScheduleNextCastMessage();
496 } 503 }
497 504
498 } // namespace cast 505 } // namespace cast
499 } // namespace media 506 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/audio_receiver/audio_receiver.h ('k') | media/cast/cast_receiver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698