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

Unified Diff: components/copresence/mediums/audio/audio_manager.h

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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: components/copresence/mediums/audio/audio_manager.h
diff --git a/components/copresence/mediums/audio/audio_manager.h b/components/copresence/mediums/audio/audio_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..11caf760f2cc2c761ec12a51ecacd75abb802e6e
--- /dev/null
+++ b/components/copresence/mediums/audio/audio_manager.h
@@ -0,0 +1,54 @@
+// Copyright 2014 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 COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_
+#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "components/copresence/public/copresence_constants.h"
+
+namespace media {
+class AudioBusRefCounted;
+}
+
+namespace copresence {
+
+class AudioManager {
+ public:
+ typedef base::Callback<void(const std::string&,
+ AudioType,
+ const scoped_refptr<media::AudioBusRefCounted>&)>
+ SamplesCallback;
Daniel Erat 2014/10/22 16:34:35 it seems confusing to have one callback named "Dec
rkc 2014/10/22 18:21:47 Done.
+ typedef base::Callback<void(const std::string&,
+ AudioType,
+ const SamplesCallback&)> EncodeTokenCallback;
+ typedef base::Callback<void(AudioType, const std::string&)>
+ DecodeSamplesCallback;
+
+ virtual ~AudioManager() {}
+
+ // Initializes the object. Do not use this object before calling this method.
+ virtual void Initialize(const DecodeSamplesCallback& decode_cb,
+ const EncodeTokenCallback& encode_cb) = 0;
+
+ virtual void StartPlaying(AudioType type) = 0;
+ virtual void StopPlaying(AudioType type) = 0;
+
+ virtual void StartRecording(AudioType type) = 0;
+ virtual void StopRecording(AudioType type) = 0;
+
+ virtual void SetToken(AudioType type,
+ const std::string& url_unsafe_token) = 0;
+
+ virtual const std::string& GetToken(AudioType type) = 0;
Daniel Erat 2014/10/22 16:34:35 if the returned value is short, please just return
rkc 2014/10/22 18:21:47 Any particular reason for not returning a const re
Daniel Erat 2014/10/22 18:32:40 in general, i find that it's better not to impose
rkc 2014/10/22 19:28:46 So this code will be called 'fairly' often; consid
Daniel Erat 2014/10/22 21:50:15 my larger point was that specifying a reference re
+
+ virtual bool IsRecording(AudioType type) = 0;
+ virtual bool IsPlaying(AudioType type) = 0;
+};
+
+} // namespace copresence
+
+#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698