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

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

Issue 883293005: Cast: Basic cast_receiver API for chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra BUILD.gn line Created 5 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
« no previous file with comments | « chrome/renderer/media/DEPS ('k') | chrome/renderer/media/cast_receiver_audio_valve.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..4ac8a93b433a726fdf86d19e50277085fbce171e
--- /dev/null
+++ b/chrome/renderer/media/cast_receiver_audio_valve.h
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_
+#define CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_
+
+#include "base/synchronization/lock.h"
+#include "media/base/audio_capturer_source.h"
+
+namespace media {
+class AudioBus;
+}
+
+// Forwards calls to |cb| until Stop is called.
+// 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);
+
+ // AudioCapturerSource::CaptureCallback implementation.
+ void Capture(const media::AudioBus* audio_source,
+ int audio_delay_milliseconds,
+ double volume,
+ bool key_pressed) override;
+ void OnCaptureError() override;
+
+ // When this returns, no more calls will be forwarded to |cb|.
+ void Stop();
+
+ private:
+ friend class base::RefCountedThreadSafe<CastReceiverAudioValve>;
+ ~CastReceiverAudioValve() override;
+ media::AudioCapturerSource::CaptureCallback* cb_;
+ base::Lock lock_;
+};
+
+#endif // CHROME_RENDERER_MEDIA_CAST_RECEIVER_AUDIO_VALVE_H_
« no previous file with comments | « chrome/renderer/media/DEPS ('k') | chrome/renderer/media/cast_receiver_audio_valve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698