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

Unified Diff: chrome/renderer/media/cast_receiver_audio_valve.h

Issue 1714593003: Introduce media::AudioPushFifo and a couple of use cases (and clean-ups). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Win compile issue. Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « no previous file | chrome/renderer/media/cast_receiver_audio_valve.cc » ('j') | chrome/renderer/media/cast_receiver_audio_valve.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698