Index: chrome/renderer/media/cast_receiver_audio_valve.h |
diff --git a/chrome/renderer/media/cast_receiver_audio_valve.h b/chrome/renderer/media/cast_receiver_audio_valve.h |
index ebc1209ff25d241fecca24cc2efc692c9a196e77..76de3fc73a85007181e371406afd736f781d7fec 100644 |
--- a/chrome/renderer/media/cast_receiver_audio_valve.h |
+++ b/chrome/renderer/media/cast_receiver_audio_valve.h |
@@ -7,36 +7,46 @@ |
#include "base/synchronization/lock.h" |
#include "media/base/audio_capturer_source.h" |
+#include "media/base/audio_rechunker.h" |
namespace media { |
class AudioBus; |
} |
-// Forwards calls to |cb| until Stop is called. |
+// Forwards calls to |cb| until Stop is called. If the client requested a |
+// different buffer size than that provided by the Cast Receiver, AudioRechunker |
+// is used to rectify that. |
+// |
// Thread-safe. |
// All functions may block depending on contention. |
class CastReceiverAudioValve : |
- public media::AudioCapturerSource::CaptureCallback, |
public base::RefCountedThreadSafe<CastReceiverAudioValve> { |
public: |
- explicit CastReceiverAudioValve( |
- media::AudioCapturerSource::CaptureCallback* cb); |
+ CastReceiverAudioValve(const media::AudioParameters& params, |
+ media::AudioCapturerSource::CaptureCallback* cb); |
- // AudioCapturerSource::CaptureCallback implementation. |
- void Capture(const media::AudioBus* audio_source, |
- int audio_delay_milliseconds, |
- double volume, |
- bool key_pressed) override; |
- void OnCaptureError(const std::string& message) override; |
+ // Called on an unknown thread to provide more decoded audio data from the |
+ // Cast Receiver. |
+ void DeliverDecodedAudio(const media::AudioBus* audio_bus, |
+ base::TimeTicks playout_time); |
// When this returns, no more calls will be forwarded to |cb|. |
void Stop(); |
private: |
friend class base::RefCountedThreadSafe<CastReceiverAudioValve>; |
- ~CastReceiverAudioValve() override; |
+ |
+ ~CastReceiverAudioValve(); |
+ |
+ // Called by AudioRechunker zero or more times during the call to |
+ // Capture(). Delivers audio data in the required buffer size to |cb_|. |
+ void DeliverRechunkedAudio(const media::AudioBus& audio_bus, |
+ base::TimeDelta timestamp); |
+ |
media::AudioCapturerSource::CaptureCallback* cb_; |
base::Lock lock_; |
+ |
+ media::AudioRechunker rechunker_; |
}; |
#endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ |