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

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

Issue 1186943003: Revert of Add support for the audio-output-device switching IPC mechanism to the renderer lower... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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_input.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 <string>
9 #include <vector> 8 #include <vector>
10
11 #include "base/basictypes.h" 9 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/logging.h" 10 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
15 #include "media/audio/audio_output_ipc.h"
16 #include "media/audio/audio_parameters.h" 12 #include "media/audio/audio_parameters.h"
17 #include "media/base/audio_bus.h" 13 #include "media/base/audio_bus.h"
18 #include "media/base/media_export.h" 14 #include "media/base/media_export.h"
19 #include "url/gurl.h"
20
21 namespace base {
22 class SingleThreadTaskRunner;
23 }
24 15
25 namespace media { 16 namespace media {
26 17
27 typedef base::Callback<void(SwitchOutputDeviceResult)> SwitchOutputDeviceCB;
28
29 // AudioRendererSink is an interface representing the end-point for 18 // AudioRendererSink is an interface representing the end-point for
30 // rendered audio. An implementation is expected to 19 // rendered audio. An implementation is expected to
31 // periodically call Render() on a callback object. 20 // periodically call Render() on a callback object.
32 21
33 class AudioRendererSink 22 class AudioRendererSink
34 : public base::RefCountedThreadSafe<media::AudioRendererSink> { 23 : public base::RefCountedThreadSafe<media::AudioRendererSink> {
35 public: 24 public:
36 class RenderCallback { 25 class RenderCallback {
37 public: 26 public:
38 // Attempts to completely fill all channels of |dest|, returns actual 27 // Attempts to completely fill all channels of |dest|, returns actual
(...skipping 21 matching lines...) Expand all
60 // Pauses playback. 49 // Pauses playback.
61 virtual void Pause() = 0; 50 virtual void Pause() = 0;
62 51
63 // Resumes playback after calling Pause(). 52 // Resumes playback after calling Pause().
64 virtual void Play() = 0; 53 virtual void Play() = 0;
65 54
66 // Sets the playback volume, with range [0.0, 1.0] inclusive. 55 // Sets the playback volume, with range [0.0, 1.0] inclusive.
67 // Returns |true| on success. 56 // Returns |true| on success.
68 virtual bool SetVolume(double volume) = 0; 57 virtual bool SetVolume(double volume) = 0;
69 58
70 // Attempts to switch the audio output device.
71 // Once the attempt is finished, |callback| is invoked with the
72 // result of the operation passed as a parameter. The result is a value from
73 // the media::SwitchOutputDeviceResult enum.
74 // There is no guarantee about the thread where |callback| will
75 // be invoked, so users are advised to use media::BindToCurrentLoop() to
76 // ensure that |callback| runs on the correct thread.
77 // Note also that copy constructors and destructors for arguments bound to
78 // |callback| may run on arbitrary threads as |callback| is moved across
79 // threads. It is advisable to bind arguments such that they are released by
80 // |callback| when it runs in order to avoid surprises.
81 virtual void SwitchOutputDevice(const std::string& device_id,
82 const GURL& security_origin,
83 const SwitchOutputDeviceCB& callback) = 0;
84
85 protected: 59 protected:
86 friend class base::RefCountedThreadSafe<AudioRendererSink>; 60 friend class base::RefCountedThreadSafe<AudioRendererSink>;
87 virtual ~AudioRendererSink() {} 61 virtual ~AudioRendererSink() {}
88 }; 62 };
89 63
90 } // namespace media 64 } // namespace media
91 65
92 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 66 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_
OLDNEW
« no previous file with comments | « media/base/audio_renderer_mixer_input.cc ('k') | media/base/fake_audio_renderer_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698