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

Side by Side Diff: content/browser/media/audio_output_stream_impl.h

Issue 1930393002: Switch stream creation and closing in Chrome audio rendering from IPC to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + tests in progress Created 4 years, 7 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 2016 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 #ifndef CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_STREAM_IMPL_H_
6 #define CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_STREAM_IMPL_H_
7
8 #include "base/callback.h"
9 #include "content/browser/media/audio_output_impl.h"
10 #include "content/browser/renderer_host/media/audio_renderer_host.h"
11 #include "content/common/content_export.h"
12 #include "media/mojo/interfaces/audio_output.mojom.h"
13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
15
16 namespace content {
17
18 // This class implements AudioOutputStream Mojo interface. It will be used
19 // by the AudioOutputClient to perform operations on audio output streams.
20 // AudioOutputClient will perform operations remotely on the
21 // AudioOutputStreamPtr and Mojo will transfer them to AudioOutputStreamImpl.
22 // Owned by AudioOutputImpl.
23 class CONTENT_EXPORT AudioOutputStreamImpl
24 : public media::mojom::AudioOutputStream {
25 public:
26 AudioOutputStreamImpl(media::mojom::AudioOutputStreamRequest request,
27 int stream_id,
28 int renderer_frame_id,
29 AudioRendererHost* audio_renderer_host);
30
31 ~AudioOutputStreamImpl() override;
32
33 int get_stream_id() const { return stream_id_; }
34
35 private:
36 FRIEND_TEST_ALL_PREFIXES(AudioOutputStreamImplTest, Close);
37 // AudioOutputStream interface implementation.
38 void Close() override;
39
40 mojo::Binding<media::mojom::AudioOutputStream> binding_;
41 int stream_id_;
42 int renderer_frame_id_;
43 // AudioRendererHost is ref counted and AudioOutputImpl holds a reference to
44 // it. And because all AudioOutputStreamImpl instances will be owned by
45 // AudioOutputImpl too, it's safe to access AudioRendererHost from
46 // AudioOutputStreamImpl.
47 // The only issue that could happen is during AudioOutputStreamImpl
48 // destructor. AudioRendererHost cannot access from there.
49 AudioRendererHost* audio_renderer_host_;
50 };
51
52 class CONTENT_EXPORT AudioOutputStreamFactory {
53 public:
54 static AudioOutputStreamImpl* Factory(
55 media::mojom::AudioOutputStreamRequest request,
56 int stream_id,
57 int renderer_frame_id,
58 AudioRendererHost* audio_renderer_host);
59 };
60
61 } // namespace content
62
63 #endif // CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_STREAM_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698