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

Side by Side Diff: media/base/audio_renderer_sink.h

Issue 1809093003: Moving SwitchOutputDevice out of OutputDevice interface, eliminating OutputDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector>
12 11
13 #include "base/callback.h" 12 #include "base/callback.h"
14 #include "base/logging.h"
15 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
16 #include "media/audio/audio_output_ipc.h"
17 #include "media/audio/audio_parameters.h" 14 #include "media/audio/audio_parameters.h"
18 #include "media/base/audio_bus.h" 15 #include "media/base/audio_bus.h"
19 #include "media/base/media_export.h" 16 #include "media/base/output_device_info.h"
20 #include "media/base/output_device.h" 17 #include "url/origin.h"
21 #include "url/gurl.h"
22
23 namespace base {
24 class SingleThreadTaskRunner;
25 }
26 18
27 namespace media { 19 namespace media {
28 20
29 // AudioRendererSink is an interface representing the end-point for 21 // AudioRendererSink is an interface representing the end-point for
30 // rendered audio. An implementation is expected to 22 // rendered audio. An implementation is expected to
31 // periodically call Render() on a callback object. 23 // periodically call Render() on a callback object.
32 24
33 class AudioRendererSink 25 class AudioRendererSink
34 : public base::RefCountedThreadSafe<media::AudioRendererSink> { 26 : public base::RefCountedThreadSafe<media::AudioRendererSink> {
35 public: 27 public:
(...skipping 28 matching lines...) Expand all
64 // Pauses playback. 56 // Pauses playback.
65 virtual void Pause() = 0; 57 virtual void Pause() = 0;
66 58
67 // Resumes playback after calling Pause(). 59 // Resumes playback after calling Pause().
68 virtual void Play() = 0; 60 virtual void Play() = 0;
69 61
70 // Sets the playback volume, with range [0.0, 1.0] inclusive. 62 // Sets the playback volume, with range [0.0, 1.0] inclusive.
71 // Returns |true| on success. 63 // Returns |true| on success.
72 virtual bool SetVolume(double volume) = 0; 64 virtual bool SetVolume(double volume) = 0;
73 65
74 // Returns a pointer to the internal output device. 66 // Returns current output device information. If the information is not
75 // This pointer is not to be owned by the caller and is valid only during 67 // available yet, this method may block until it becomes available.
76 // the lifetime of the AudioRendererSink. 68 // If the sink is not associated with any output device, |device_status| of
77 // It can be null, which means that access to the output device is not 69 // OutputDeviceInfo should be set to OUTPUT_DEVICE_STATUS_ERROR_INTERNAL.
78 // supported. 70 // Must never be called on the IO thread.
79 virtual OutputDevice* GetOutputDevice() = 0; 71 virtual OutputDeviceInfo GetOutputDeviceInfo() = 0;
80 72
81 protected: 73 protected:
82 friend class base::RefCountedThreadSafe<AudioRendererSink>; 74 friend class base::RefCountedThreadSafe<AudioRendererSink>;
83 virtual ~AudioRendererSink() {} 75 virtual ~AudioRendererSink() {}
84 }; 76 };
85 77
86 // Same as AudioRendererSink except that Initialize() and Start() can be called 78 // Same as AudioRendererSink except that Initialize() and Start() can be called
87 // again after Stop(). 79 // again after Stop().
88 // TODO(sandersd): Fold back into AudioRendererSink once all subclasses support 80 // TODO(sandersd): Fold back into AudioRendererSink once all subclasses support
89 // this. 81 // this.
90 82
91 class RestartableAudioRendererSink : public AudioRendererSink { 83 class RestartableAudioRendererSink : public AudioRendererSink {
92 protected: 84 protected:
93 ~RestartableAudioRendererSink() override {} 85 ~RestartableAudioRendererSink() override {}
94 }; 86 };
95 87
88 class SwitchableAudioRendererSink : public RestartableAudioRendererSink {
89 public:
90 // Attempts to switch the audio output device associated with a sink.
91 // Once the attempt is finished, |callback| is invoked with the
92 // result of the operation passed as a parameter. The result is a value from
93 // the media::OutputDeviceStatus enum.
94 // There is no guarantee about the thread where |callback| will be invoked.
95 virtual void SwitchOutputDevice(const std::string& device_id,
96 const url::Origin& security_origin,
97 const OutputDeviceStatusCB& callback) = 0;
98
99 protected:
100 ~SwitchableAudioRendererSink() override {}
101 };
102
96 } // namespace media 103 } // namespace media
97 104
98 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 105 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_
OLDNEW
« no previous file with comments | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698