Index: media/cast/audio_sender/audio_sender.cc |
diff --git a/media/cast/audio_sender/audio_sender.cc b/media/cast/audio_sender/audio_sender.cc |
index e966cfbd9805e33a73a6a20ba78aa35ead2c55c1..b61a260f0cc747dd7e75ecb311c46fc15fb06b06 100644 |
--- a/media/cast/audio_sender/audio_sender.cc |
+++ b/media/cast/audio_sender/audio_sender.cc |
@@ -41,7 +41,7 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, |
transport::CastTransportSender* const transport_sender) |
: cast_environment_(cast_environment), |
transport_sender_(transport_sender), |
- rtp_stats_(audio_config.frequency), |
+ rtp_timestamp_helper_(audio_config.frequency), |
rtcp_feedback_(new LocalRtcpAudioSenderFeedback(this)), |
rtcp_(cast_environment, |
rtcp_feedback_.get(), |
@@ -75,9 +75,6 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment, |
transport_config.rtp.max_outstanding_frames = |
audio_config.rtp_config.max_delay_ms / 100 + 1; |
transport_sender_->InitializeAudio(transport_config); |
- |
- transport_sender_->SubscribeAudioRtpStatsCallback( |
- base::Bind(&AudioSender::StoreStatistics, weak_factory_.GetWeakPtr())); |
} |
AudioSender::~AudioSender() {} |
@@ -101,6 +98,8 @@ void AudioSender::SendEncodedAudioFrame( |
scoped_ptr<transport::EncodedAudioFrame> audio_frame, |
const base::TimeTicks& recorded_time) { |
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
+ rtp_timestamp_helper_.StoreLatestTime(recorded_time, |
+ audio_frame->rtp_timestamp); |
InitializeTimers(); |
transport_sender_->InsertCodedAudioFrame(audio_frame.get(), recorded_time); |
} |
@@ -131,19 +130,14 @@ void AudioSender::ScheduleNextRtcpReport() { |
time_to_next); |
} |
-void AudioSender::StoreStatistics( |
- const transport::RtcpSenderInfo& sender_info, |
- base::TimeTicks time_sent, |
- uint32 rtp_timestamp) { |
- rtp_stats_.Store(sender_info, time_sent, rtp_timestamp); |
-} |
- |
void AudioSender::SendRtcpReport() { |
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
- // We don't send audio logging messages since all captured audio frames will |
- // be sent. |
- rtp_stats_.UpdateInfo(cast_environment_->Clock()->NowTicks()); |
- rtcp_.SendRtcpFromRtpSender(rtp_stats_.sender_info()); |
+ const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
+ uint32 now_as_rtp_timestamp = 0; |
+ if (rtp_timestamp_helper_.GetCurrentTimeAsRtpTimestamp( |
+ now, &now_as_rtp_timestamp)) { |
+ rtcp_.SendRtcpFromRtpSender(now, now_as_rtp_timestamp); |
+ } |
ScheduleNextRtcpReport(); |
} |