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

Side by Side Diff: media/audio/audio_output_resampler.cc

Issue 1487983002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/audio/audio_output_resampler.h" 5 #include "media/audio/audio_output_resampler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 11 matching lines...) Expand all
22 class OnMoreDataConverter 22 class OnMoreDataConverter
23 : public AudioOutputStream::AudioSourceCallback, 23 : public AudioOutputStream::AudioSourceCallback,
24 public AudioConverter::InputCallback { 24 public AudioConverter::InputCallback {
25 public: 25 public:
26 OnMoreDataConverter(const AudioParameters& input_params, 26 OnMoreDataConverter(const AudioParameters& input_params,
27 const AudioParameters& output_params); 27 const AudioParameters& output_params);
28 ~OnMoreDataConverter() override; 28 ~OnMoreDataConverter() override;
29 29
30 // AudioSourceCallback interface. 30 // AudioSourceCallback interface.
31 int OnMoreData(AudioBus* dest, uint32 total_bytes_delay) override; 31 int OnMoreData(AudioBus* dest, uint32 total_bytes_delay) override;
32 void OnSkippedData(uint32_t frames_skipped) override {}
32 void OnError(AudioOutputStream* stream) override; 33 void OnError(AudioOutputStream* stream) override;
33 34
34 // Sets |source_callback_|. If this is not a new object, then Stop() must be 35 // Sets |source_callback_|. If this is not a new object, then Stop() must be
35 // called before Start(). 36 // called before Start().
36 void Start(AudioOutputStream::AudioSourceCallback* callback); 37 void Start(AudioOutputStream::AudioSourceCallback* callback);
37 38
38 // Clears |source_callback_| and flushes the resampler. 39 // Clears |source_callback_| and flushes the resampler.
39 void Stop(); 40 void Stop();
40 41
41 bool started() const { return source_callback_ != nullptr; } 42 bool started() const { return source_callback_ != nullptr; }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 dest->ZeroFramesPartial(frames, dest->frames() - frames); 398 dest->ZeroFramesPartial(frames, dest->frames() - frames);
398 return frames > 0 ? 1 : 0; 399 return frames > 0 ? 1 : 0;
399 } 400 }
400 401
401 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { 402 void OnMoreDataConverter::OnError(AudioOutputStream* stream) {
402 error_occurred_ = true; 403 error_occurred_ = true;
403 source_callback_->OnError(stream); 404 source_callback_->OnError(stream);
404 } 405 }
405 406
406 } // namespace media 407 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698