| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 void OnPlayStream() override; | 64 void OnPlayStream() override; |
| 65 void OnPauseStream() override; | 65 void OnPauseStream() override; |
| 66 void OnSetVolume(double volume) override; | 66 void OnSetVolume(double volume) override; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 class ControllerEventHandler; | 69 class ControllerEventHandler; |
| 70 friend class AudioOutputDelegateTest; | 70 friend class AudioOutputDelegateTest; |
| 71 | 71 |
| 72 void SendCreatedNotification(); | 72 void SendCreatedNotification(); |
| 73 void OnError(); | 73 void OnError(); |
| 74 void DoLog(const std::string& msg); |
| 74 void UpdatePlayingState(bool playing); | 75 void UpdatePlayingState(bool playing); |
| 75 media::AudioOutputController* GetControllerForTesting() const; | 76 media::AudioOutputController* GetControllerForTesting() const; |
| 76 | 77 |
| 77 // This is the event handler which |this| send notifications to. | 78 // This is the event handler which |this| send notifications to. |
| 78 EventHandler* subscriber_; | 79 EventHandler* subscriber_; |
| 79 std::unique_ptr<media::AudioLog> const audio_log_; | 80 std::unique_ptr<media::AudioLog> const audio_log_; |
| 80 // |controller_event_handler_| proxies events from controller to |this|. | 81 // |controller_event_handler_| proxies events from controller to |this|. |
| 81 // |controller_event_handler_|, |reader_| and |mirroring_manager_| will | 82 // |controller_event_handler_|, |reader_| and |mirroring_manager_| will |
| 82 // outlive |this|, see the destructor for details. | 83 // outlive |this|, see the destructor for details. |
| 83 std::unique_ptr<ControllerEventHandler> controller_event_handler_; | 84 std::unique_ptr<ControllerEventHandler> controller_event_handler_; |
| 84 std::unique_ptr<AudioSyncReader> reader_; | 85 std::unique_ptr<AudioSyncReader> reader_; |
| 85 AudioMirroringManager* mirroring_manager_; | 86 AudioMirroringManager* mirroring_manager_; |
| 86 scoped_refptr<media::AudioOutputController> controller_; | 87 scoped_refptr<media::AudioOutputController> controller_; |
| 87 const int stream_id_; | 88 const int stream_id_; |
| 88 const int render_frame_id_; | 89 const int render_frame_id_; |
| 89 const int render_process_id_; | 90 const int render_process_id_; |
| 90 | 91 |
| 91 // This flag ensures that we only send OnStreamStateChanged notifications | 92 // This flag ensures that we only send OnStreamStateChanged notifications |
| 92 // and (de)register with the stream monitor when the state actually changes. | 93 // and (de)register with the stream monitor when the state actually changes. |
| 93 bool playing_ = false; | 94 bool playing_ = false; |
| 94 base::WeakPtrFactory<AudioOutputDelegateImpl> weak_factory_; | 95 base::WeakPtrFactory<AudioOutputDelegateImpl> weak_factory_; |
| 95 | 96 |
| 96 DISALLOW_COPY_AND_ASSIGN(AudioOutputDelegateImpl); | 97 DISALLOW_COPY_AND_ASSIGN(AudioOutputDelegateImpl); |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 } // namespace content | 100 } // namespace content |
| 100 | 101 |
| 101 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ | 102 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_IMPL_H_ |
| OLD | NEW |