| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | 6 #define CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
| 7 | 7 |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const std::string& audio_constraints, | 80 const std::string& audio_constraints, |
| 81 const std::string& video_constraints); | 81 const std::string& video_constraints); |
| 82 | 82 |
| 83 // Methods for adding or removing WebRTCInternalsUIObserver. | 83 // Methods for adding or removing WebRTCInternalsUIObserver. |
| 84 void AddObserver(WebRTCInternalsUIObserver *observer); | 84 void AddObserver(WebRTCInternalsUIObserver *observer); |
| 85 void RemoveObserver(WebRTCInternalsUIObserver *observer); | 85 void RemoveObserver(WebRTCInternalsUIObserver *observer); |
| 86 | 86 |
| 87 // Sends all update data to |observer|. | 87 // Sends all update data to |observer|. |
| 88 void UpdateObserver(WebRTCInternalsUIObserver* observer); | 88 void UpdateObserver(WebRTCInternalsUIObserver* observer); |
| 89 | 89 |
| 90 // Enables or disables AEC dump (diagnostic echo canceller recording). | 90 // Enables or disables diagnostic audio recordings for debugging purposes. |
| 91 void EnableAecDump(content::WebContents* web_contents); | 91 void EnableAudioDebugRecordings(content::WebContents* web_contents); |
| 92 void DisableAecDump(); | 92 void DisableAudioDebugRecordings(); |
| 93 | 93 |
| 94 bool aec_dump_enabled() { | 94 bool IsAudioDebugRecordingsEnabled() const; |
| 95 return aec_dump_enabled_; | 95 const base::FilePath& GetAudioDebugRecordingsFilePath() const; |
| 96 } | |
| 97 | |
| 98 base::FilePath aec_dump_file_path() { | |
| 99 return aec_dump_file_path_; | |
| 100 } | |
| 101 | 96 |
| 102 void ResetForTesting(); | 97 void ResetForTesting(); |
| 103 | 98 |
| 104 private: | 99 private: |
| 105 friend struct base::DefaultLazyInstanceTraits<WebRTCInternals>; | 100 friend struct base::DefaultLazyInstanceTraits<WebRTCInternals>; |
| 106 FRIEND_TEST_ALL_PREFIXES(WebRtcAecDumpBrowserTest, CallWithAecDump); | 101 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest, |
| 107 FRIEND_TEST_ALL_PREFIXES(WebRtcAecDumpBrowserTest, | 102 CallWithAudioDebugRecordings); |
| 108 CallWithAecDumpEnabledThenDisabled); | 103 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest, |
| 109 FRIEND_TEST_ALL_PREFIXES(WebRtcAecDumpBrowserTest, TwoCallsWithAecDump); | 104 CallWithAudioDebugRecordingsEnabledThenDisabled); |
| 105 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest, |
| 106 TwoCallsWithAudioDebugRecordings); |
| 110 FRIEND_TEST_ALL_PREFIXES(WebRtcInternalsTest, | 107 FRIEND_TEST_ALL_PREFIXES(WebRtcInternalsTest, |
| 111 AecRecordingFileSelectionCanceled); | 108 AudioDebugRecordingsFileSelectionCanceled); |
| 112 | 109 |
| 113 WebRTCInternals(); | 110 WebRTCInternals(); |
| 114 ~WebRTCInternals() override; | 111 ~WebRTCInternals() override; |
| 115 | 112 |
| 116 void SendUpdate(const std::string& command, base::Value* value); | 113 void SendUpdate(const std::string& command, base::Value* value); |
| 117 | 114 |
| 118 // RenderProcessHostObserver implementation. | 115 // RenderProcessHostObserver implementation. |
| 119 void RenderProcessHostDestroyed(RenderProcessHost* host) override; | 116 void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
| 120 | 117 |
| 121 // ui::SelectFileDialog::Listener implementation. | 118 // ui::SelectFileDialog::Listener implementation. |
| 122 void FileSelected(const base::FilePath& path, | 119 void FileSelected(const base::FilePath& path, |
| 123 int index, | 120 int index, |
| 124 void* unused_params) override; | 121 void* unused_params) override; |
| 125 void FileSelectionCanceled(void* params) override; | 122 void FileSelectionCanceled(void* params) override; |
| 126 | 123 |
| 127 // Called when a renderer exits (including crashes). | 124 // Called when a renderer exits (including crashes). |
| 128 void OnRendererExit(int render_process_id); | 125 void OnRendererExit(int render_process_id); |
| 129 | 126 |
| 130 #if defined(ENABLE_WEBRTC) | 127 #if defined(ENABLE_WEBRTC) |
| 131 // Enables AEC dump on all render process hosts using |aec_dump_file_path_|. | 128 // Enables diagnostic audio recordings on all render process hosts using |
| 132 void EnableAecDumpOnAllRenderProcessHosts(); | 129 // |audio_debug_recordings_file_path_|. |
| 130 void EnableAudioDebugRecordingsOnAllRenderProcessHosts(); |
| 133 #endif | 131 #endif |
| 134 | 132 |
| 135 // Called whenever an element is added to or removed from | 133 // Called whenever an element is added to or removed from |
| 136 // |peer_connection_data_| to impose/release a block on suspending the current | 134 // |peer_connection_data_| to impose/release a block on suspending the current |
| 137 // application for power-saving. | 135 // application for power-saving. |
| 138 void CreateOrReleasePowerSaveBlocker(); | 136 void CreateOrReleasePowerSaveBlocker(); |
| 139 | 137 |
| 140 base::ObserverList<WebRTCInternalsUIObserver> observers_; | 138 base::ObserverList<WebRTCInternalsUIObserver> observers_; |
| 141 | 139 |
| 142 // |peer_connection_data_| is a list containing all the PeerConnection | 140 // |peer_connection_data_| is a list containing all the PeerConnection |
| (...skipping 17 matching lines...) Expand all Loading... |
| 160 // "rid" -- the renderer id. | 158 // "rid" -- the renderer id. |
| 161 // "pid" -- proceddId of the renderer. | 159 // "pid" -- proceddId of the renderer. |
| 162 // "origin" -- the security origin of the request. | 160 // "origin" -- the security origin of the request. |
| 163 // "audio" -- the serialized audio constraints if audio is requested. | 161 // "audio" -- the serialized audio constraints if audio is requested. |
| 164 // "video" -- the serialized video constraints if video is requested. | 162 // "video" -- the serialized video constraints if video is requested. |
| 165 base::ListValue get_user_media_requests_; | 163 base::ListValue get_user_media_requests_; |
| 166 | 164 |
| 167 // For managing select file dialog. | 165 // For managing select file dialog. |
| 168 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 166 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 169 | 167 |
| 170 // AEC dump (diagnostic echo canceller recording) state. | 168 // Diagnostic audio recording state. |
| 171 bool aec_dump_enabled_; | 169 bool audio_debug_recordings_; |
| 172 base::FilePath aec_dump_file_path_; | 170 base::FilePath audio_debug_recordings_file_path_; |
| 173 | 171 |
| 174 // While |peer_connection_data_| is non-empty, hold an instance of | 172 // While |peer_connection_data_| is non-empty, hold an instance of |
| 175 // PowerSaveBlocker. This prevents the application from being suspended while | 173 // PowerSaveBlocker. This prevents the application from being suspended while |
| 176 // remoting. | 174 // remoting. |
| 177 scoped_ptr<PowerSaveBlocker> power_save_blocker_; | 175 scoped_ptr<PowerSaveBlocker> power_save_blocker_; |
| 178 | 176 |
| 179 // Set of render process hosts that |this| is registered as an observer on. | 177 // Set of render process hosts that |this| is registered as an observer on. |
| 180 base::hash_set<int> render_process_id_set_; | 178 base::hash_set<int> render_process_id_set_; |
| 181 }; | 179 }; |
| 182 | 180 |
| 183 } // namespace content | 181 } // namespace content |
| 184 | 182 |
| 185 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ | 183 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_INTERNALS_H_ |
| OLD | NEW |