OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 void VideoCapturer::Construct() { | 116 void VideoCapturer::Construct() { |
117 ClearAspectRatio(); | 117 ClearAspectRatio(); |
118 enable_camera_list_ = false; | 118 enable_camera_list_ = false; |
119 square_pixel_aspect_ratio_ = false; | 119 square_pixel_aspect_ratio_ = false; |
120 capture_state_ = CS_STOPPED; | 120 capture_state_ = CS_STOPPED; |
121 SignalFrameCaptured.connect(this, &VideoCapturer::OnFrameCaptured); | 121 SignalFrameCaptured.connect(this, &VideoCapturer::OnFrameCaptured); |
122 scaled_width_ = 0; | 122 scaled_width_ = 0; |
123 scaled_height_ = 0; | 123 scaled_height_ = 0; |
124 screencast_max_pixels_ = 0; | |
125 muted_ = false; | 124 muted_ = false; |
126 black_frame_count_down_ = kNumBlackFramesOnMute; | 125 black_frame_count_down_ = kNumBlackFramesOnMute; |
127 enable_video_adapter_ = true; | 126 enable_video_adapter_ = true; |
128 adapt_frame_drops_ = 0; | 127 adapt_frame_drops_ = 0; |
129 previous_frame_time_ = 0.0; | 128 previous_frame_time_ = 0.0; |
130 #ifdef HAVE_WEBRTC_VIDEO | 129 #ifdef HAVE_WEBRTC_VIDEO |
131 // There are lots of video capturers out there that don't call | 130 // There are lots of video capturers out there that don't call |
132 // set_frame_factory. We can either go change all of them, or we | 131 // set_frame_factory. We can either go change all of them, or we |
133 // can set this default. | 132 // can set this default. |
134 // TODO(pthatcher): Remove this hack and require the frame factory | 133 // TODO(pthatcher): Remove this hack and require the frame factory |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 352 |
354 if (SignalVideoFrame.is_empty()) { | 353 if (SignalVideoFrame.is_empty()) { |
355 return; | 354 return; |
356 } | 355 } |
357 | 356 |
358 // Use a temporary buffer to scale | 357 // Use a temporary buffer to scale |
359 rtc::scoped_ptr<uint8_t[]> scale_buffer; | 358 rtc::scoped_ptr<uint8_t[]> scale_buffer; |
360 | 359 |
361 if (IsScreencast()) { | 360 if (IsScreencast()) { |
362 int scaled_width, scaled_height; | 361 int scaled_width, scaled_height; |
363 if (screencast_max_pixels_ > 0) { | 362 int desired_screencast_fps = capture_format_.get() ? |
364 ComputeScaleMaxPixels(captured_frame->width, captured_frame->height, | 363 VideoFormat::IntervalToFps(capture_format_->interval) : |
365 screencast_max_pixels_, &scaled_width, &scaled_height); | 364 kDefaultScreencastFps; |
366 } else { | 365 ComputeScale(captured_frame->width, captured_frame->height, |
367 int desired_screencast_fps = capture_format_.get() ? | 366 desired_screencast_fps, &scaled_width, &scaled_height); |
368 VideoFormat::IntervalToFps(capture_format_->interval) : | |
369 kDefaultScreencastFps; | |
370 ComputeScale(captured_frame->width, captured_frame->height, | |
371 desired_screencast_fps, &scaled_width, &scaled_height); | |
372 } | |
373 | 367 |
374 if (FOURCC_ARGB == captured_frame->fourcc && | 368 if (FOURCC_ARGB == captured_frame->fourcc && |
375 (scaled_width != captured_frame->width || | 369 (scaled_width != captured_frame->width || |
376 scaled_height != captured_frame->height)) { | 370 scaled_height != captured_frame->height)) { |
377 if (scaled_width != scaled_width_ || scaled_height != scaled_height_) { | 371 if (scaled_width != scaled_width_ || scaled_height != scaled_height_) { |
378 LOG(LS_INFO) << "Scaling Screencast from " | 372 LOG(LS_INFO) << "Scaling Screencast from " |
379 << captured_frame->width << "x" | 373 << captured_frame->width << "x" |
380 << captured_frame->height << " to " | 374 << captured_frame->height << " to " |
381 << scaled_width << "x" << scaled_height; | 375 << scaled_width << "x" << scaled_height; |
382 scaled_width_ = scaled_width; | 376 scaled_width_ = scaled_width; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 void VideoCapturer::GetVariableSnapshot( | 719 void VideoCapturer::GetVariableSnapshot( |
726 const rtc::RollingAccumulator<T>& data, | 720 const rtc::RollingAccumulator<T>& data, |
727 VariableInfo<T>* stats) { | 721 VariableInfo<T>* stats) { |
728 stats->max_val = data.ComputeMax(); | 722 stats->max_val = data.ComputeMax(); |
729 stats->mean = data.ComputeMean(); | 723 stats->mean = data.ComputeMean(); |
730 stats->min_val = data.ComputeMin(); | 724 stats->min_val = data.ComputeMin(); |
731 stats->variance = data.ComputeVariance(); | 725 stats->variance = data.ComputeVariance(); |
732 } | 726 } |
733 | 727 |
734 } // namespace cricket | 728 } // namespace cricket |
OLD | NEW |