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

Unified Diff: media/mojo/services/mojo_audio_output_provider.cc

Issue 2697793002: Add mojo interface+impl for audio stream control. (Closed)
Patch Set: Introduce provider Created 3 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: media/mojo/services/mojo_audio_output_provider.cc
diff --git a/media/mojo/services/mojo_audio_output_provider.cc b/media/mojo/services/mojo_audio_output_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..729625d20304792c93615c33df253a3e066d2b20
--- /dev/null
+++ b/media/mojo/services/mojo_audio_output_provider.cc
@@ -0,0 +1,37 @@
+// Copyright 2017 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.
+
+#include "media/mojo/services/mojo_audio_output_provider.h"
+
+#include <utility>
+
+namespace media {
+
+MojoAudioOutputProvider::MojoAudioOutputProvider(
+ AudioOutputProviderRequest request,
+ CreateDelegateCallback create_delegate_callback,
+ DeleterCallback deleter_callback)
+ : binding_(this, request),
+ create_delegate_callback_(std::move(create_delegate_callback)),
+ deleter_callback_(std::move(deleter_callback)) {
+ DCHECK(create_delegate_callback_);
+ DCHECK(deleter_callback_);
+}
+
+MojoAudioOutputProvider::~MojoAudioOutputProvider() {}
+
+void MojoAudioOutputProvider::Acquire(AudioOutputRequest request,
DaleCurtis 2017/03/06 17:56:12 Is it possible to setup the provider object to rep
Max Morin 2017/03/07 11:23:16 I don't think we want to skip the authorization ch
+ const AudioParameters& params,
+ AcquireCallback acquire_callback) {
+ if (audio_output_) {
+ LOG(ERROR) << "Output acquired twice.";
o1ka 2017/03/07 00:49:24 Shouldn't |acquire_callback| run here? Or an error
Max Morin 2017/03/07 11:23:16 Right, I changed this to unbinding the binder and
o1ka 2017/03/07 23:31:06 I mean - have you seen examples in mojo services i
Max Morin 2017/03/08 07:38:29 From what I gather from the spec (though I am no e
+ return;
+ }
+ audio_output_.emplace(std::move(request),
+ base::Bind(create_delegate_callback, params),
+ std::move(acquire_callback),
+ base::Bind(deleter_callback, base::Unretained(this)));
DaleCurtis 2017/03/06 17:56:12 hmm, is Unretained necessary here? You're binding
Max Morin 2017/03/07 11:23:16 It's actually not. I removed it.
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698