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

Side by Side Diff: media/mojo/services/mojo_audio_output_stream_provider.cc

Issue 2697793002: Add mojo interface+impl for audio stream control. (Closed)
Patch Set: review. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/mojo/services/mojo_audio_output_stream_provider.h"
6
7 #include <utility>
8
9 namespace media {
10
11 MojoAudioOutputStreamProvider::MojoAudioOutputStreamProvider(
12 mojom::AudioOutputStreamProviderRequest request,
13 CreateDelegateCallback create_delegate_callback,
14 DeleterCallback deleter_callback)
15 : binding_(this, std::move(request)),
16 create_delegate_callback_(std::move(create_delegate_callback)),
17 deleter_callback_(base::Bind(std::move(deleter_callback), this)) {
18 DCHECK(thread_checker_.CalledOnValidThread());
19 binding_.set_connection_error_handler(deleter_callback_);
20 DCHECK(create_delegate_callback_);
21 DCHECK(deleter_callback_);
22 }
23
24 MojoAudioOutputStreamProvider::~MojoAudioOutputStreamProvider() {
25 DCHECK(thread_checker_.CalledOnValidThread());
26 }
27
28 void MojoAudioOutputStreamProvider::Acquire(
29 mojom::AudioOutputStreamRequest stream_request,
30 const AudioParameters& params,
31 const AcquireCallback& callback) {
32 DCHECK(thread_checker_.CalledOnValidThread());
33 if (audio_output_) {
34 LOG(ERROR) << "Output acquired twice.";
35 binding_.Unbind();
36 deleter_callback_.Run();
o1ka 2017/03/07 23:31:07 Add a comment that it's deleting |this|? (so that
Max Morin 2017/03/08 07:38:29 Done.
37 return;
38 }
39
40 audio_output_.emplace(
41 std::move(stream_request),
42 base::BindOnce(std::move(create_delegate_callback_), params),
43 std::move(callback), deleter_callback_);
44 }
45
46 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698