1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_
6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_
8 #include "base/synchronization/lock.h"
9 #include "media/base/audio_capturer_source.h"
15 // Forwards calls to |cb| until Stop is called.
17 // All functions may block depending on contention.
18 class CastReceiverAudioValve
:
19 public media::AudioCapturerSource::CaptureCallback
,
20 public base::RefCountedThreadSafe
<CastReceiverAudioValve
> {
22 explicit CastReceiverAudioValve(
23 media::AudioCapturerSource::CaptureCallback
* cb
);
25 // AudioCapturerSource::CaptureCallback implementation.
26 void Capture(const media::AudioBus
* audio_source
,
27 int audio_delay_milliseconds
,
29 bool key_pressed
) override
;
30 void OnCaptureError() override
;
32 // When this returns, no more calls will be forwarded to |cb|.
36 friend class base::RefCountedThreadSafe
<CastReceiverAudioValve
>;
37 ~CastReceiverAudioValve() override
;
38 media::AudioCapturerSource::CaptureCallback
* cb_
;
42 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_