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/capture/desktop_capture_device.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 LOG(ERROR) << log; | 213 LOG(ERROR) << log; |
214 client_->OnError(log); | 214 client_->OnError(log); |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 if (!client_) | 218 if (!client_) |
219 return; | 219 return; |
220 | 220 |
221 base::TimeDelta capture_time( | 221 base::TimeDelta capture_time( |
222 base::TimeDelta::FromMilliseconds(frame->capture_time_ms())); | 222 base::TimeDelta::FromMilliseconds(frame->capture_time_ms())); |
223 UMA_HISTOGRAM_TIMES( | 223 |
224 capturer_type_ == DesktopMediaID::TYPE_SCREEN ? kUmaScreenCaptureTime | 224 // The two UMA_ blocks must be put in its own scope since it creates a static |
225 : kUmaWindowCaptureTime, | 225 // variable which expected constant histogram name. |
226 capture_time); | 226 if (capturer_type_ == DesktopMediaID::TYPE_SCREEN) { |
| 227 UMA_HISTOGRAM_TIMES(kUmaScreenCaptureTime, capture_time); |
| 228 } else { |
| 229 UMA_HISTOGRAM_TIMES(kUmaWindowCaptureTime, capture_time); |
| 230 } |
227 | 231 |
228 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame); | 232 scoped_ptr<webrtc::DesktopFrame> owned_frame(frame); |
229 | 233 |
230 // On OSX We receive a 1x1 frame when the shared window is minimized. It | 234 // On OSX We receive a 1x1 frame when the shared window is minimized. It |
231 // cannot be subsampled to I420 and will be dropped downstream. So we replace | 235 // cannot be subsampled to I420 and will be dropped downstream. So we replace |
232 // it with a black frame to avoid the video appearing frozen at the last | 236 // it with a black frame to avoid the video appearing frozen at the last |
233 // frame. | 237 // frame. |
234 if (frame->size().width() == 1 || frame->size().height() == 1) { | 238 if (frame->size().width() == 1 || frame->size().height() == 1) { |
235 if (!black_frame_.get()) { | 239 if (!black_frame_.get()) { |
236 black_frame_.reset( | 240 black_frame_.reset( |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 #else | 477 #else |
474 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; | 478 base::MessageLoop::Type thread_type = base::MessageLoop::TYPE_DEFAULT; |
475 #endif | 479 #endif |
476 | 480 |
477 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); | 481 thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); |
478 | 482 |
479 core_.reset(new Core(thread_.message_loop_proxy(), capturer.Pass(), type)); | 483 core_.reset(new Core(thread_.message_loop_proxy(), capturer.Pass(), type)); |
480 } | 484 } |
481 | 485 |
482 } // namespace content | 486 } // namespace content |
OLD | NEW |