Commit b3bf7416 authored by hclam@chromium.org's avatar hclam@chromium.org

Cast: Log audio received events for audio

Audio ACK received events are important for simulation. Logging it now.

Review URL: https://codereview.chromium.org/307933007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274018 0039d316-1c4b-4281-b951-d872f2087c98
parent 45fb5bcc
...@@ -55,6 +55,8 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, ...@@ -55,6 +55,8 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
transport_config.rtp.max_outstanding_frames = transport_config.rtp.max_outstanding_frames =
audio_config.rtp_config.max_delay_ms / 100 + 1; audio_config.rtp_config.max_delay_ms / 100 + 1;
transport_sender_->InitializeAudio(transport_config); transport_sender_->InitializeAudio(transport_config);
memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
} }
AudioSender::~AudioSender() {} AudioSender::~AudioSender() {}
...@@ -88,6 +90,8 @@ void AudioSender::SendEncodedAudioFrame( ...@@ -88,6 +90,8 @@ void AudioSender::SendEncodedAudioFrame(
SendRtcpReport(is_last_aggressive_report); SendRtcpReport(is_last_aggressive_report);
} }
frame_id_to_rtp_timestamp_[audio_frame->frame_id & 0xff] =
audio_frame->rtp_timestamp;
transport_sender_->InsertCodedAudioFrame(*audio_frame); transport_sender_->InsertCodedAudioFrame(*audio_frame);
} }
...@@ -152,8 +156,12 @@ void AudioSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) { ...@@ -152,8 +156,12 @@ void AudioSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) {
if (!cast_feedback.missing_frames_and_packets_.empty()) { if (!cast_feedback.missing_frames_and_packets_.empty()) {
ResendPackets(cast_feedback.missing_frames_and_packets_); ResendPackets(cast_feedback.missing_frames_and_packets_);
} }
VLOG(2) << "Received audio ACK " uint32 acked_frame_id = static_cast<uint32>(cast_feedback.ack_frame_id_);
<< static_cast<int>(cast_feedback.ack_frame_id_); VLOG(2) << "Received audio ACK: " << acked_frame_id;
cast_environment_->Logging()->InsertFrameEvent(
cast_environment_->Clock()->NowTicks(),
FRAME_ACK_RECEIVED, AUDIO_EVENT,
frame_id_to_rtp_timestamp_[acked_frame_id & 0xff], acked_frame_id);
} }
} // namespace cast } // namespace cast
......
...@@ -66,6 +66,10 @@ class AudioSender : public RtcpSenderFeedback, ...@@ -66,6 +66,10 @@ class AudioSender : public RtcpSenderFeedback,
int num_aggressive_rtcp_reports_sent_; int num_aggressive_rtcp_reports_sent_;
CastInitializationStatus cast_initialization_cb_; CastInitializationStatus cast_initialization_cb_;
// Used to map the lower 8 bits of the frame id to a RTP timestamp. This is
// good enough as we only use it for logging.
RtpTimestamp frame_id_to_rtp_timestamp_[256];
// NOTE: Weak pointers must be invalidated before all other member variables. // NOTE: Weak pointers must be invalidated before all other member variables.
base::WeakPtrFactory<AudioSender> weak_factory_; base::WeakPtrFactory<AudioSender> weak_factory_;
......
...@@ -1332,7 +1332,10 @@ TEST_F(End2EndTest, AudioLogging) { ...@@ -1332,7 +1332,10 @@ TEST_F(End2EndTest, AudioLogging) {
map_it->second.counter[FRAME_DECODED]; map_it->second.counter[FRAME_DECODED];
EXPECT_GT(map_it->second.counter[FRAME_ACK_SENT], 0); EXPECT_GT(map_it->second.counter[FRAME_ACK_SENT], 0);
EXPECT_GT(map_it->second.counter[FRAME_ACK_RECEIVED], 0);
expected_event_count_for_frame += map_it->second.counter[FRAME_ACK_SENT]; expected_event_count_for_frame += map_it->second.counter[FRAME_ACK_SENT];
expected_event_count_for_frame +=
map_it->second.counter[FRAME_ACK_RECEIVED];
// Verify that there were no other events logged with respect to this frame. // Verify that there were no other events logged with respect to this frame.
// (i.e. Total event count = expected event count) // (i.e. Total event count = expected event count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment