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

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

Issue 307933007: Cast: Log audio received events for audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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_sender/audio_sender.h" 5 #include "media/cast/audio_sender/audio_sender.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 "media/cast/audio_sender/audio_encoder.h" 10 #include "media/cast/audio_sender/audio_encoder.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 media::cast::transport::CastTransportAudioConfig transport_config; 50 media::cast::transport::CastTransportAudioConfig transport_config;
51 transport_config.codec = audio_config.codec; 51 transport_config.codec = audio_config.codec;
52 transport_config.rtp.config = audio_config.rtp_config; 52 transport_config.rtp.config = audio_config.rtp_config;
53 transport_config.frequency = audio_config.frequency; 53 transport_config.frequency = audio_config.frequency;
54 transport_config.channels = audio_config.channels; 54 transport_config.channels = audio_config.channels;
55 transport_config.rtp.max_outstanding_frames = 55 transport_config.rtp.max_outstanding_frames =
56 audio_config.rtp_config.max_delay_ms / 100 + 1; 56 audio_config.rtp_config.max_delay_ms / 100 + 1;
57 transport_sender_->InitializeAudio(transport_config); 57 transport_sender_->InitializeAudio(transport_config);
58
59 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
58 } 60 }
59 61
60 AudioSender::~AudioSender() {} 62 AudioSender::~AudioSender() {}
61 63
62 void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus, 64 void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus,
63 const base::TimeTicks& recorded_time) { 65 const base::TimeTicks& recorded_time) {
64 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 66 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
65 DCHECK(audio_encoder_.get()) << "Invalid internal state"; 67 DCHECK(audio_encoder_.get()) << "Invalid internal state";
66 audio_encoder_->InsertAudio(audio_bus.Pass(), recorded_time); 68 audio_encoder_->InsertAudio(audio_bus.Pass(), recorded_time);
67 } 69 }
(...skipping 13 matching lines...) Expand all
81 if (num_aggressive_rtcp_reports_sent_ < kNumAggressiveReportsSentAtStart) { 83 if (num_aggressive_rtcp_reports_sent_ < kNumAggressiveReportsSentAtStart) {
82 // SendRtcpReport() will schedule future reports to be made if this is the 84 // SendRtcpReport() will schedule future reports to be made if this is the
83 // last "aggressive report." 85 // last "aggressive report."
84 ++num_aggressive_rtcp_reports_sent_; 86 ++num_aggressive_rtcp_reports_sent_;
85 const bool is_last_aggressive_report = 87 const bool is_last_aggressive_report =
86 (num_aggressive_rtcp_reports_sent_ == kNumAggressiveReportsSentAtStart); 88 (num_aggressive_rtcp_reports_sent_ == kNumAggressiveReportsSentAtStart);
87 VLOG_IF(1, is_last_aggressive_report) << "Sending last aggressive report."; 89 VLOG_IF(1, is_last_aggressive_report) << "Sending last aggressive report.";
88 SendRtcpReport(is_last_aggressive_report); 90 SendRtcpReport(is_last_aggressive_report);
89 } 91 }
90 92
93 frame_id_to_rtp_timestamp_[audio_frame->frame_id & 0xff] =
94 audio_frame->rtp_timestamp;
91 transport_sender_->InsertCodedAudioFrame(*audio_frame); 95 transport_sender_->InsertCodedAudioFrame(*audio_frame);
92 } 96 }
93 97
94 void AudioSender::ResendPackets( 98 void AudioSender::ResendPackets(
95 const MissingFramesAndPacketsMap& missing_frames_and_packets) { 99 const MissingFramesAndPacketsMap& missing_frames_and_packets) {
96 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 100 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
97 transport_sender_->ResendPackets(true, missing_frames_and_packets); 101 transport_sender_->ResendPackets(true, missing_frames_and_packets);
98 } 102 }
99 103
100 void AudioSender::IncomingRtcpPacket(scoped_ptr<Packet> packet) { 104 void AudioSender::IncomingRtcpPacket(scoped_ptr<Packet> packet) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 VLOG(1) << "No longer a need to send reports aggressively (sent " 149 VLOG(1) << "No longer a need to send reports aggressively (sent "
146 << num_aggressive_rtcp_reports_sent_ << ")."; 150 << num_aggressive_rtcp_reports_sent_ << ").";
147 num_aggressive_rtcp_reports_sent_ = kNumAggressiveReportsSentAtStart; 151 num_aggressive_rtcp_reports_sent_ = kNumAggressiveReportsSentAtStart;
148 ScheduleNextRtcpReport(); 152 ScheduleNextRtcpReport();
149 } 153 }
150 } 154 }
151 155
152 if (!cast_feedback.missing_frames_and_packets_.empty()) { 156 if (!cast_feedback.missing_frames_and_packets_.empty()) {
153 ResendPackets(cast_feedback.missing_frames_and_packets_); 157 ResendPackets(cast_feedback.missing_frames_and_packets_);
154 } 158 }
155 VLOG(2) << "Received audio ACK " 159 uint32 acked_frame_id = static_cast<uint32>(cast_feedback.ack_frame_id_);
156 << static_cast<int>(cast_feedback.ack_frame_id_); 160 VLOG(2) << "Received audio ACK: " << acked_frame_id;
161 cast_environment_->Logging()->InsertFrameEvent(
162 cast_environment_->Clock()->NowTicks(),
163 FRAME_ACK_RECEIVED, AUDIO_EVENT,
164 frame_id_to_rtp_timestamp_[acked_frame_id & 0xff], acked_frame_id);
157 } 165 }
158 166
159 } // namespace cast 167 } // namespace cast
160 } // namespace media 168 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698