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

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: Replace RestartableAudioRendererSink with SwitchableAudioRendererSink in webmediaplayer_impl unit t… Created 4 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
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>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Same as AudioRendererSink except that Initialize() and Start() can be called 86 // Same as AudioRendererSink except that Initialize() and Start() can be called
87 // again after Stop(). 87 // again after Stop().
88 // TODO(sandersd): Fold back into AudioRendererSink once all subclasses support 88 // TODO(sandersd): Fold back into AudioRendererSink once all subclasses support
89 // this. 89 // this.
90 90
91 class RestartableAudioRendererSink : public AudioRendererSink { 91 class RestartableAudioRendererSink : public AudioRendererSink {
92 protected: 92 protected:
93 ~RestartableAudioRendererSink() override {} 93 ~RestartableAudioRendererSink() override {}
94 }; 94 };
95 95
96 class SwitchableAudioRendererSink : public RestartableAudioRendererSink {
97 public:
98 // Attempts to switch the audio output device.
99 // Once the attempt is finished, |callback| is invoked with the
100 // result of the operation passed as a parameter. The result is a value from
101 // the media::SwitchOutputDeviceResult enum.
Guido Urdaneta 2016/03/17 17:38:24 s/media::SwitchOutputDeviceResult/media::OutputDev
o1ka 2016/03/18 10:45:40 Done.
102 // There is no guarantee about the thread where |callback| will
103 // be invoked, so users are advised to use media::BindToCurrentLoop() to
104 // ensure that |callback| runs on the correct thread.
105 // Note also that copy constructors and destructors for arguments bound to
106 // |callback| may run on arbitrary threads as |callback| is moved across
107 // threads. It is advisable to bind arguments such that they are released by
108 // |callback| when it runs in order to avoid surprises.
109 virtual void SwitchOutputDevice(const std::string& device_id,
110 const url::Origin& security_origin,
111 const SwitchOutputDeviceCB& callback) = 0;
112
113 protected:
114 ~SwitchableAudioRendererSink() override {}
115 };
116
96 } // namespace media 117 } // namespace media
97 118
98 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 119 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698