| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ |
| 6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ | 6 #define CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ |
| 7 | 7 |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/audio_capturer_source.h" | 10 #include "media/base/audio_capturer_source.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public base::RefCountedThreadSafe<CastReceiverAudioValve> { | 24 public base::RefCountedThreadSafe<CastReceiverAudioValve> { |
| 25 public: | 25 public: |
| 26 CastReceiverAudioValve(const media::AudioParameters& params, | 26 CastReceiverAudioValve(const media::AudioParameters& params, |
| 27 media::AudioCapturerSource::CaptureCallback* cb); | 27 media::AudioCapturerSource::CaptureCallback* cb); |
| 28 | 28 |
| 29 // Called on an unknown thread to provide more decoded audio data from the | 29 // Called on an unknown thread to provide more decoded audio data from the |
| 30 // Cast Receiver. | 30 // Cast Receiver. |
| 31 void DeliverDecodedAudio(const media::AudioBus* audio_bus, | 31 void DeliverDecodedAudio(const media::AudioBus* audio_bus, |
| 32 base::TimeTicks playout_time); | 32 base::TimeTicks playout_time); |
| 33 | 33 |
| 34 // Called to indicate that audio has started streaming and our capture | |
| 35 // callback should be notified. | |
| 36 void OnStarted(); | |
| 37 | |
| 38 // When this returns, no more calls will be forwarded to |cb|. | 34 // When this returns, no more calls will be forwarded to |cb|. |
| 39 void Stop(); | 35 void Stop(); |
| 40 | 36 |
| 41 private: | 37 private: |
| 42 friend class base::RefCountedThreadSafe<CastReceiverAudioValve>; | 38 friend class base::RefCountedThreadSafe<CastReceiverAudioValve>; |
| 43 | 39 |
| 44 ~CastReceiverAudioValve(); | 40 ~CastReceiverAudioValve(); |
| 45 | 41 |
| 46 // Called by AudioPushFifo zero or more times during the call to Capture(). | 42 // Called by AudioPushFifo zero or more times during the call to Capture(). |
| 47 // Delivers audio data in the required buffer size to |cb_|. | 43 // Delivers audio data in the required buffer size to |cb_|. |
| 48 void DeliverRebufferedAudio(const media::AudioBus& audio_bus, | 44 void DeliverRebufferedAudio(const media::AudioBus& audio_bus, |
| 49 int frame_delay); | 45 int frame_delay); |
| 50 | 46 |
| 51 media::AudioCapturerSource::CaptureCallback* cb_; | 47 media::AudioCapturerSource::CaptureCallback* cb_; |
| 52 base::Lock lock_; | 48 base::Lock lock_; |
| 53 | 49 |
| 54 media::AudioPushFifo fifo_; | 50 media::AudioPushFifo fifo_; |
| 55 const int sample_rate_; | 51 const int sample_rate_; |
| 56 | 52 |
| 57 // Used to pass the current playout time between DeliverDecodedAudio() and | 53 // Used to pass the current playout time between DeliverDecodedAudio() and |
| 58 // DeviliverRebufferedAudio(). | 54 // DeviliverRebufferedAudio(). |
| 59 base::TimeTicks current_playout_time_; | 55 base::TimeTicks current_playout_time_; |
| 60 }; | 56 }; |
| 61 | 57 |
| 62 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ | 58 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ |
| OLD | NEW |