| 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 |
| 34 // When this returns, no more calls will be forwarded to |cb|. | 38 // When this returns, no more calls will be forwarded to |cb|. |
| 35 void Stop(); | 39 void Stop(); |
| 36 | 40 |
| 37 private: | 41 private: |
| 38 friend class base::RefCountedThreadSafe<CastReceiverAudioValve>; | 42 friend class base::RefCountedThreadSafe<CastReceiverAudioValve>; |
| 39 | 43 |
| 40 ~CastReceiverAudioValve(); | 44 ~CastReceiverAudioValve(); |
| 41 | 45 |
| 42 // Called by AudioPushFifo zero or more times during the call to Capture(). | 46 // Called by AudioPushFifo zero or more times during the call to Capture(). |
| 43 // Delivers audio data in the required buffer size to |cb_|. | 47 // Delivers audio data in the required buffer size to |cb_|. |
| 44 void DeliverRebufferedAudio(const media::AudioBus& audio_bus, | 48 void DeliverRebufferedAudio(const media::AudioBus& audio_bus, |
| 45 int frame_delay); | 49 int frame_delay); |
| 46 | 50 |
| 47 media::AudioCapturerSource::CaptureCallback* cb_; | 51 media::AudioCapturerSource::CaptureCallback* cb_; |
| 48 base::Lock lock_; | 52 base::Lock lock_; |
| 49 | 53 |
| 50 media::AudioPushFifo fifo_; | 54 media::AudioPushFifo fifo_; |
| 51 const int sample_rate_; | 55 const int sample_rate_; |
| 52 | 56 |
| 53 // Used to pass the current playout time between DeliverDecodedAudio() and | 57 // Used to pass the current playout time between DeliverDecodedAudio() and |
| 54 // DeviliverRebufferedAudio(). | 58 // DeviliverRebufferedAudio(). |
| 55 base::TimeTicks current_playout_time_; | 59 base::TimeTicks current_playout_time_; |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ | 62 #endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_ |
| OLD | NEW |