OLD | NEW |
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 368 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
369 bool rtcp_packet = Rtcp::IsRtcpPacket(&packet->front(), packet->size()); | 369 bool rtcp_packet = Rtcp::IsRtcpPacket(&packet->front(), packet->size()); |
370 if (!rtcp_packet) { | 370 if (!rtcp_packet) { |
371 rtp_receiver_->ReceivedPacket(&packet->front(), packet->size()); | 371 rtp_receiver_->ReceivedPacket(&packet->front(), packet->size()); |
372 } else { | 372 } else { |
373 rtcp_->IncomingRtcpPacket(&packet->front(), packet->size()); | 373 rtcp_->IncomingRtcpPacket(&packet->front(), packet->size()); |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 void AudioReceiver::CastFeedback(const RtcpCastMessage& cast_message) { | 377 void AudioReceiver::CastFeedback(const RtcpCastMessage& cast_message) { |
378 RtcpReceiverLogMessage receiver_log; | |
379 event_subscriber_.GetReceiverLogMessageAndReset(&receiver_log); | |
380 | |
381 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); | 378 base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
382 cast_environment_->Logging()->InsertGenericEvent(now, kAudioAckSent, | 379 cast_environment_->Logging()->InsertGenericEvent(now, kAudioAckSent, |
383 cast_message.ack_frame_id_); | 380 cast_message.ack_frame_id_); |
384 | 381 |
385 rtcp_->SendRtcpFromRtpReceiver(&cast_message, &receiver_log); | 382 rtcp_->SendRtcpFromRtpReceiver(&cast_message, &event_subscriber_); |
386 } | 383 } |
387 | 384 |
388 base::TimeTicks AudioReceiver::GetPlayoutTime(base::TimeTicks now, | 385 base::TimeTicks AudioReceiver::GetPlayoutTime(base::TimeTicks now, |
389 uint32 rtp_timestamp) { | 386 uint32 rtp_timestamp) { |
390 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 387 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
391 // Senders time in ms when this frame was recorded. | 388 // Senders time in ms when this frame was recorded. |
392 // Note: the senders clock and our local clock might not be synced. | 389 // Note: the senders clock and our local clock might not be synced. |
393 base::TimeTicks rtp_timestamp_in_ticks; | 390 base::TimeTicks rtp_timestamp_in_ticks; |
394 base::TimeTicks playout_time; | 391 base::TimeTicks playout_time; |
395 if (time_offset_ == base::TimeDelta()) { | 392 if (time_offset_ == base::TimeDelta()) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 495 } |
499 if (audio_decoder_) { | 496 if (audio_decoder_) { |
500 // Will only send a message if it is time. | 497 // Will only send a message if it is time. |
501 audio_decoder_->SendCastMessage(); | 498 audio_decoder_->SendCastMessage(); |
502 } | 499 } |
503 ScheduleNextCastMessage(); | 500 ScheduleNextCastMessage(); |
504 } | 501 } |
505 | 502 |
506 } // namespace cast | 503 } // namespace cast |
507 } // namespace media | 504 } // namespace media |
OLD | NEW |