| Index: media/audio/mac/audio_auhal_mac.cc
|
| diff --git a/media/audio/mac/audio_auhal_mac.cc b/media/audio/mac/audio_auhal_mac.cc
|
| index 39c4610495392cac6faa92da8ffb1e55c6b05656..178cd75f67cc880a43974a969af2707d19677038 100644
|
| --- a/media/audio/mac/audio_auhal_mac.cc
|
| +++ b/media/audio/mac/audio_auhal_mac.cc
|
| @@ -204,7 +204,16 @@ OSStatus AUHALStream::Render(
|
| AudioBufferList* data) {
|
| TRACE_EVENT0("audio", "AUHALStream::Render");
|
|
|
| - UpdatePlayoutTimestamp(output_time_stamp);
|
| + UInt32 lost_frames = UpdatePlayoutTimestampAndStats(output_time_stamp);
|
| +
|
| + // Inform the source about any skipped (lost) frames. If we use a fifo this
|
| + // will be out of sync with the fifo pulls (different buffer sizes), so we do
|
| + // it here and not in ProvideInput().
|
| + if (lost_frames > 0) {
|
| + base::AutoLock auto_lock(source_lock_);
|
| + if (source_)
|
| + source_->OnSkippedData(lost_frames);
|
| + }
|
|
|
| // If the stream parameters change for any reason, we need to insert a FIFO
|
| // since the OnMoreData() pipeline can't handle frame size changes.
|
| @@ -346,10 +355,12 @@ double AUHALStream::GetPlayoutLatency(
|
| return (delay_frames + hardware_latency_frames_);
|
| }
|
|
|
| -void AUHALStream::UpdatePlayoutTimestamp(const AudioTimeStamp* timestamp) {
|
| +UInt32 AUHALStream::UpdatePlayoutTimestampAndStats(
|
| + const AudioTimeStamp* timestamp) {
|
| if ((timestamp->mFlags & kAudioTimeStampSampleTimeValid) == 0)
|
| return;
|
|
|
| + UInt32 lost_frames = 0;
|
| if (last_sample_time_) {
|
| DCHECK_NE(0U, last_number_of_frames_);
|
| UInt32 diff =
|
| @@ -358,7 +369,7 @@ void AUHALStream::UpdatePlayoutTimestamp(const AudioTimeStamp* timestamp) {
|
| DCHECK_GT(diff, last_number_of_frames_);
|
| // We're being asked to render samples post what we expected. Update the
|
| // glitch count etc and keep a record of the largest glitch.
|
| - auto lost_frames = diff - last_number_of_frames_;
|
| + lost_frames = diff - last_number_of_frames_;
|
| total_lost_frames_ += lost_frames;
|
| if (lost_frames > largest_glitch_frames_)
|
| largest_glitch_frames_ = lost_frames;
|
| @@ -368,6 +379,8 @@ void AUHALStream::UpdatePlayoutTimestamp(const AudioTimeStamp* timestamp) {
|
|
|
| // Store the last sample time for use next time we get called back.
|
| last_sample_time_ = timestamp->mSampleTime;
|
| +
|
| + return lost_frames;
|
| }
|
|
|
| void AUHALStream::ReportAndResetStats() {
|
|
|