| 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 #include "content/browser/media/webrtc_internals.h" | 5 #include "content/browser/media/webrtc_internals.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "content/browser/media/webrtc_internals_ui_observer.h" | 9 #include "content/browser/media/webrtc_internals_ui_observer.h" |
| 10 #include "content/browser/web_contents/web_contents_view.h" | 10 #include "content/browser/web_contents/web_contents_view.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 dict->SetString("audio", audio_constraints); | 198 dict->SetString("audio", audio_constraints); |
| 199 if (video) | 199 if (video) |
| 200 dict->SetString("video", video_constraints); | 200 dict->SetString("video", video_constraints); |
| 201 | 201 |
| 202 get_user_media_requests_.Append(dict); | 202 get_user_media_requests_.Append(dict); |
| 203 | 203 |
| 204 if (observers_.might_have_observers()) | 204 if (observers_.might_have_observers()) |
| 205 SendUpdate("addGetUserMedia", dict); | 205 SendUpdate("addGetUserMedia", dict); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void WebRTCInternals::OnAddVideoStats(base::ProcessId pid, |
| 209 const std::string& video_id, |
| 210 float input_frame_rate, |
| 211 int number_of_dropped_frames) { |
| 212 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 213 |
| 214 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 215 dict->SetInteger("pid", static_cast<int>(pid)); |
| 216 dict->SetString("video_id", video_id); |
| 217 dict->SetDouble("input_frame_rate", input_frame_rate); |
| 218 dict->SetInteger("number_of_dropped_frames", number_of_dropped_frames); |
| 219 |
| 220 if (observers_.might_have_observers()) |
| 221 SendUpdate("addVideoStats", dict); |
| 222 } |
| 223 |
| 208 void WebRTCInternals::AddObserver(WebRTCInternalsUIObserver *observer) { | 224 void WebRTCInternals::AddObserver(WebRTCInternalsUIObserver *observer) { |
| 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 225 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 210 observers_.AddObserver(observer); | 226 observers_.AddObserver(observer); |
| 211 } | 227 } |
| 212 | 228 |
| 213 void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver *observer) { | 229 void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver *observer) { |
| 214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 215 observers_.RemoveObserver(observer); | 231 observers_.RemoveObserver(observer); |
| 216 | 232 |
| 217 // Disables the AEC recording if it is enabled and the last webrtc-internals | 233 // Disables the AEC recording if it is enabled and the last webrtc-internals |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { | 394 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { |
| 379 DVLOG(1) << ("Preventing the application from being suspended while one or " | 395 DVLOG(1) << ("Preventing the application from being suspended while one or " |
| 380 "more PeerConnections are active."); | 396 "more PeerConnections are active."); |
| 381 power_save_blocker_ = content::PowerSaveBlocker::Create( | 397 power_save_blocker_ = content::PowerSaveBlocker::Create( |
| 382 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 398 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 383 "WebRTC has active PeerConnections.").Pass(); | 399 "WebRTC has active PeerConnections.").Pass(); |
| 384 } | 400 } |
| 385 } | 401 } |
| 386 | 402 |
| 387 } // namespace content | 403 } // namespace content |
| OLD | NEW |