OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... | |
39 AudioMirroringManager* mirroring_manager, | 39 AudioMirroringManager* mirroring_manager, |
40 MediaObserver* media_observer, | 40 MediaObserver* media_observer, |
41 int stream_id, | 41 int stream_id, |
42 int render_frame_id, | 42 int render_frame_id, |
43 int render_process_id, | 43 int render_process_id, |
44 const media::AudioParameters& params, | 44 const media::AudioParameters& params, |
45 const std::string& output_device_id); | 45 const std::string& output_device_id); |
46 | 46 |
47 ~AudioOutputDelegateImpl() override; | 47 ~AudioOutputDelegateImpl() override; |
48 | 48 |
49 // AudioOutputDelegate implementation. | |
Max Morin
2017/03/31 07:04:20
Save comment?
o1ka
2017/03/31 09:15:28
Done.
| |
50 scoped_refptr<media::AudioOutputController> GetController() const override; | |
51 int GetStreamId() const override; | 49 int GetStreamId() const override; |
52 void OnPlayStream() override; | 50 void OnPlayStream() override; |
53 void OnPauseStream() override; | 51 void OnPauseStream() override; |
54 void OnSetVolume(double volume) override; | 52 void OnSetVolume(double volume) override; |
55 | 53 |
56 private: | 54 private: |
57 class ControllerEventHandler; | 55 class ControllerEventHandler; |
56 friend class AudioOutputDelegateTest; | |
58 | 57 |
59 void SendCreatedNotification(); | 58 void SendCreatedNotification(); |
60 void OnError(); | 59 void OnError(); |
61 void UpdatePlayingState(bool playing); | 60 void UpdatePlayingState(bool playing); |
61 media::AudioOutputController* GetControllerForTesting() const; | |
62 | 62 |
63 // This is the event handler which |this| send notifications to. | 63 // This is the event handler which |this| send notifications to. |
64 EventHandler* subscriber_; | 64 EventHandler* subscriber_; |
65 std::unique_ptr<media::AudioLog> const audio_log_; | 65 std::unique_ptr<media::AudioLog> const audio_log_; |
66 // |controller_event_handler_| proxies events from controller to |this|. | 66 // |controller_event_handler_| proxies events from controller to |this|. |
67 // |controller_event_handler_|, |reader_| and |mirroring_manager_| will | 67 // |controller_event_handler_|, |reader_| and |mirroring_manager_| will |
68 // outlive |this|, see the destructor for details. | 68 // outlive |this|, see the destructor for details. |
69 std::unique_ptr<ControllerEventHandler> controller_event_handler_; | 69 std::unique_ptr<ControllerEventHandler> controller_event_handler_; |
70 std::unique_ptr<AudioSyncReader> reader_; | 70 std::unique_ptr<AudioSyncReader> reader_; |
71 AudioMirroringManager* mirroring_manager_; | 71 AudioMirroringManager* mirroring_manager_; |
72 scoped_refptr<media::AudioOutputController> controller_; | 72 scoped_refptr<media::AudioOutputController> controller_; |
73 const int stream_id_; | 73 const int stream_id_; |
74 const int render_frame_id_; | 74 const int render_frame_id_; |
75 const int render_process_id_; | 75 const int render_process_id_; |
76 | 76 |
77 // This flag ensures that we only send OnStreamStateChanged notifications | 77 // This flag ensures that we only send OnStreamStateChanged notifications |
78 // and (de)register with the stream monitor when the state actually changes. | 78 // and (de)register with the stream monitor when the state actually changes. |
79 bool playing_ = false; | 79 bool playing_ = false; |
80 base::WeakPtrFactory<AudioOutputDelegateImpl> weak_factory_; | 80 base::WeakPtrFactory<AudioOutputDelegateImpl> weak_factory_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(AudioOutputDelegateImpl); | 82 DISALLOW_COPY_AND_ASSIGN(AudioOutputDelegateImpl); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace content | 85 } // namespace content |
86 | 86 |
87 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ | 87 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ |
OLD | NEW |