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

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

Issue 1184473002: Add support for the audio-output-device switching IPC mechanism to the renderer lower layers (media… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build dependencies for audio_unittests 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>
8 #include <vector> 9 #include <vector>
10
9 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h"
10 #include "base/logging.h" 13 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "media/audio/audio_output_ipc.h"
12 #include "media/audio/audio_parameters.h" 16 #include "media/audio/audio_parameters.h"
13 #include "media/base/audio_bus.h" 17 #include "media/base/audio_bus.h"
14 #include "media/base/media_export.h" 18 #include "media/base/media_export.h"
19 #include "url/gurl.h"
20
21 namespace base {
22 class SingleThreadTaskRunner;
23 }
15 24
16 namespace media { 25 namespace media {
17 26
27 typedef base::Callback<void(SwitchOutputDeviceResult)> SwitchOutputDeviceCB;
28
18 // AudioRendererSink is an interface representing the end-point for 29 // AudioRendererSink is an interface representing the end-point for
19 // rendered audio. An implementation is expected to 30 // rendered audio. An implementation is expected to
20 // periodically call Render() on a callback object. 31 // periodically call Render() on a callback object.
21 32
22 class AudioRendererSink 33 class AudioRendererSink
23 : public base::RefCountedThreadSafe<media::AudioRendererSink> { 34 : public base::RefCountedThreadSafe<media::AudioRendererSink> {
24 public: 35 public:
25 class RenderCallback { 36 class RenderCallback {
26 public: 37 public:
27 // Attempts to completely fill all channels of |dest|, returns actual 38 // Attempts to completely fill all channels of |dest|, returns actual
(...skipping 21 matching lines...) Expand all
49 // Pauses playback. 60 // Pauses playback.
50 virtual void Pause() = 0; 61 virtual void Pause() = 0;
51 62
52 // Resumes playback after calling Pause(). 63 // Resumes playback after calling Pause().
53 virtual void Play() = 0; 64 virtual void Play() = 0;
54 65
55 // Sets the playback volume, with range [0.0, 1.0] inclusive. 66 // Sets the playback volume, with range [0.0, 1.0] inclusive.
56 // Returns |true| on success. 67 // Returns |true| on success.
57 virtual bool SetVolume(double volume) = 0; 68 virtual bool SetVolume(double volume) = 0;
58 69
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
59 protected: 85 protected:
60 friend class base::RefCountedThreadSafe<AudioRendererSink>; 86 friend class base::RefCountedThreadSafe<AudioRendererSink>;
61 virtual ~AudioRendererSink() {} 87 virtual ~AudioRendererSink() {}
62 }; 88 };
63 89
64 } // namespace media 90 } // namespace media
65 91
66 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ 92 #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