| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 LOG(LS_INFO) << "Scaling up framerate: " << fps_wanted; | 336 LOG(LS_INFO) << "Scaling up framerate: " << fps_wanted; |
| 337 sink_wants_.max_framerate_fps = fps_wanted; | 337 sink_wants_.max_framerate_fps = fps_wanted; |
| 338 source_->AddOrUpdateSink(video_stream_encoder_, | 338 source_->AddOrUpdateSink(video_stream_encoder_, |
| 339 GetActiveSinkWantsInternal()); | 339 GetActiveSinkWantsInternal()); |
| 340 return true; | 340 return true; |
| 341 } | 341 } |
| 342 | 342 |
| 343 private: | 343 private: |
| 344 rtc::VideoSinkWants GetActiveSinkWantsInternal() | 344 rtc::VideoSinkWants GetActiveSinkWantsInternal() |
| 345 EXCLUSIVE_LOCKS_REQUIRED(&crit_) { | 345 RTC_EXCLUSIVE_LOCKS_REQUIRED(&crit_) { |
| 346 rtc::VideoSinkWants wants = sink_wants_; | 346 rtc::VideoSinkWants wants = sink_wants_; |
| 347 // Clear any constraints from the current sink wants that don't apply to | 347 // Clear any constraints from the current sink wants that don't apply to |
| 348 // the used degradation_preference. | 348 // the used degradation_preference. |
| 349 switch (degradation_preference_) { | 349 switch (degradation_preference_) { |
| 350 case VideoSendStream::DegradationPreference::kBalanced: | 350 case VideoSendStream::DegradationPreference::kBalanced: |
| 351 break; | 351 break; |
| 352 case VideoSendStream::DegradationPreference::kMaintainFramerate: | 352 case VideoSendStream::DegradationPreference::kMaintainFramerate: |
| 353 wants.max_framerate_fps = std::numeric_limits<int>::max(); | 353 wants.max_framerate_fps = std::numeric_limits<int>::max(); |
| 354 break; | 354 break; |
| 355 case VideoSendStream::DegradationPreference::kMaintainResolution: | 355 case VideoSendStream::DegradationPreference::kMaintainResolution: |
| 356 wants.max_pixel_count = std::numeric_limits<int>::max(); | 356 wants.max_pixel_count = std::numeric_limits<int>::max(); |
| 357 wants.target_pixel_count.reset(); | 357 wants.target_pixel_count.reset(); |
| 358 break; | 358 break; |
| 359 case VideoSendStream::DegradationPreference::kDegradationDisabled: | 359 case VideoSendStream::DegradationPreference::kDegradationDisabled: |
| 360 wants.max_pixel_count = std::numeric_limits<int>::max(); | 360 wants.max_pixel_count = std::numeric_limits<int>::max(); |
| 361 wants.target_pixel_count.reset(); | 361 wants.target_pixel_count.reset(); |
| 362 wants.max_framerate_fps = std::numeric_limits<int>::max(); | 362 wants.max_framerate_fps = std::numeric_limits<int>::max(); |
| 363 } | 363 } |
| 364 return wants; | 364 return wants; |
| 365 } | 365 } |
| 366 | 366 |
| 367 rtc::CriticalSection crit_; | 367 rtc::CriticalSection crit_; |
| 368 rtc::SequencedTaskChecker main_checker_; | 368 rtc::SequencedTaskChecker main_checker_; |
| 369 VideoStreamEncoder* const video_stream_encoder_; | 369 VideoStreamEncoder* const video_stream_encoder_; |
| 370 rtc::VideoSinkWants sink_wants_ GUARDED_BY(&crit_); | 370 rtc::VideoSinkWants sink_wants_ RTC_GUARDED_BY(&crit_); |
| 371 VideoSendStream::DegradationPreference degradation_preference_ | 371 VideoSendStream::DegradationPreference degradation_preference_ |
| 372 GUARDED_BY(&crit_); | 372 RTC_GUARDED_BY(&crit_); |
| 373 rtc::VideoSourceInterface<VideoFrame>* source_ GUARDED_BY(&crit_); | 373 rtc::VideoSourceInterface<VideoFrame>* source_ RTC_GUARDED_BY(&crit_); |
| 374 | 374 |
| 375 RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy); | 375 RTC_DISALLOW_COPY_AND_ASSIGN(VideoSourceProxy); |
| 376 }; | 376 }; |
| 377 | 377 |
| 378 VideoStreamEncoder::VideoStreamEncoder(uint32_t number_of_cores, | 378 VideoStreamEncoder::VideoStreamEncoder(uint32_t number_of_cores, |
| 379 SendStatisticsProxy* stats_proxy, | 379 SendStatisticsProxy* stats_proxy, |
| 380 const VideoSendStream::Config::EncoderSettings& settings, | 380 const VideoSendStream::Config::EncoderSettings& settings, |
| 381 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, | 381 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, |
| 382 EncodedFrameObserver* encoder_timing, | 382 EncodedFrameObserver* encoder_timing, |
| 383 std::unique_ptr<OveruseFrameDetector> overuse_detector) | 383 std::unique_ptr<OveruseFrameDetector> overuse_detector) |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 std::string VideoStreamEncoder::AdaptCounter::ToString( | 1251 std::string VideoStreamEncoder::AdaptCounter::ToString( |
| 1252 const std::vector<int>& counters) const { | 1252 const std::vector<int>& counters) const { |
| 1253 std::stringstream ss; | 1253 std::stringstream ss; |
| 1254 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { | 1254 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { |
| 1255 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; | 1255 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; |
| 1256 } | 1256 } |
| 1257 return ss.str(); | 1257 return ss.str(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 } // namespace webrtc | 1260 } // namespace webrtc |
| OLD | NEW |