OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_RENDERER_H_ |
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_RENDERER_H_ | 6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_RENDERER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Sets the output volume. | 34 // Sets the output volume. |
35 virtual void SetVolume(float volume) = 0; | 35 virtual void SetVolume(float volume) = 0; |
36 | 36 |
37 // Returns a pointer to the internal output device. | 37 // Returns a pointer to the internal output device. |
38 // The pointer is not to be owned by the caller and is valid only during | 38 // The pointer is not to be owned by the caller and is valid only during |
39 // the lifetime of the MediaStreamAudioRenderer. | 39 // the lifetime of the MediaStreamAudioRenderer. |
40 // It can be null, which means that access to the output device is not | 40 // It can be null, which means that access to the output device is not |
41 // supported. | 41 // supported. |
42 virtual media::OutputDevice* GetOutputDevice() = 0; | 42 virtual media::OutputDevice* GetOutputDevice() = 0; |
43 | 43 |
| 44 // Attempts to switch the audio output device. |
| 45 // Once the attempt is finished, |callback| is invoked with the |
| 46 // result of the operation passed as a parameter. The result is a value from |
| 47 // the media::OutputDeviceStatus enum. |
| 48 // There is no guarantee about the thread where |callback| will |
| 49 // be invoked, so users are advised to use media::BindToCurrentLoop() to |
| 50 // ensure that |callback| runs on the correct thread. |
| 51 // Note also that copy constructors and destructors for arguments bound to |
| 52 // |callback| may run on arbitrary threads as |callback| is moved across |
| 53 // threads. It is advisable to bind arguments such that they are released by |
| 54 // |callback| when it runs in order to avoid surprises. |
| 55 virtual void SwitchOutputDevice( |
| 56 const std::string& device_id, |
| 57 const url::Origin& security_origin, |
| 58 const media::OutputDeviceStatusCB& callback) = 0; |
| 59 |
44 // Time stamp that reflects the current render time. Should not be updated | 60 // Time stamp that reflects the current render time. Should not be updated |
45 // when paused. | 61 // when paused. |
46 virtual base::TimeDelta GetCurrentRenderTime() const = 0; | 62 virtual base::TimeDelta GetCurrentRenderTime() const = 0; |
47 | 63 |
48 // Returns true if the implementation is a local renderer and false | 64 // Returns true if the implementation is a local renderer and false |
49 // otherwise. | 65 // otherwise. |
50 virtual bool IsLocalRenderer() const = 0; | 66 virtual bool IsLocalRenderer() const = 0; |
51 | 67 |
52 protected: | 68 protected: |
53 friend class base::RefCountedThreadSafe<MediaStreamAudioRenderer>; | 69 friend class base::RefCountedThreadSafe<MediaStreamAudioRenderer>; |
54 | 70 |
55 virtual ~MediaStreamAudioRenderer() {} | 71 virtual ~MediaStreamAudioRenderer() {} |
56 }; | 72 }; |
57 | 73 |
58 } // namespace content | 74 } // namespace content |
59 | 75 |
60 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_RENDERER_H_ | 76 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_AUDIO_RENDERER_H_ |
OLD | NEW |