| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
| 11 | 11 |
| 12 #include <algorithm> // std::max | 12 #include <algorithm> // std::max |
| 13 | 13 |
| 14 #include "webrtc/base/checks.h" | 14 #include "webrtc/base/checks.h" |
| 15 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
| 17 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 17 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 18 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 18 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| 19 #include "webrtc/modules/video_coding/encoded_frame.h" | 19 #include "webrtc/modules/video_coding/encoded_frame.h" |
| 20 #include "webrtc/modules/video_coding/utility/quality_scaler.h" | 20 #include "webrtc/modules/video_coding/utility/quality_scaler.h" |
| 21 #include "webrtc/modules/video_coding/video_coding_impl.h" | 21 #include "webrtc/modules/video_coding/video_coding_impl.h" |
| 22 #include "webrtc/system_wrappers/include/clock.h" | 22 #include "webrtc/system_wrappers/include/clock.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 namespace vcm { | 25 namespace vcm { |
| 26 | 26 |
| 27 VideoSender::VideoSender(Clock* clock, | 27 VideoSender::VideoSender(Clock* clock, |
| 28 EncodedImageCallback* post_encode_callback, | 28 EncodedImageCallback* post_encode_callback, |
| 29 VideoEncoderRateObserver* encoder_rate_observer, | |
| 30 VCMSendStatisticsCallback* send_stats_callback) | 29 VCMSendStatisticsCallback* send_stats_callback) |
| 31 : clock_(clock), | 30 : clock_(clock), |
| 32 _encoder(nullptr), | 31 _encoder(nullptr), |
| 33 _mediaOpt(clock_), | 32 _mediaOpt(clock_), |
| 34 _encodedFrameCallback(post_encode_callback, &_mediaOpt), | 33 _encodedFrameCallback(post_encode_callback, &_mediaOpt), |
| 35 send_stats_callback_(send_stats_callback), | 34 send_stats_callback_(send_stats_callback), |
| 36 _codecDataBase(encoder_rate_observer, &_encodedFrameCallback), | 35 _codecDataBase(&_encodedFrameCallback), |
| 37 frame_dropper_enabled_(true), | 36 frame_dropper_enabled_(true), |
| 38 _sendStatsTimer(1000, clock_), | 37 _sendStatsTimer(1000, clock_), |
| 39 current_codec_(), | 38 current_codec_(), |
| 40 encoder_params_({0, 0, 0, 0}), | 39 encoder_params_({0, 0, 0, 0}), |
| 41 encoder_has_internal_source_(false), | 40 encoder_has_internal_source_(false), |
| 42 next_frame_types_(1, kVideoFrameDelta) { | 41 next_frame_types_(1, kVideoFrameDelta) { |
| 43 _mediaOpt.Reset(); | 42 _mediaOpt.Reset(); |
| 44 // Allow VideoSender to be created on one thread but used on another, post | 43 // Allow VideoSender to be created on one thread but used on another, post |
| 45 // construction. This is currently how this class is being used by at least | 44 // construction. This is currently how this class is being used by at least |
| 46 // one external project (diffractor). | 45 // one external project (diffractor). |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 358 } |
| 360 | 359 |
| 361 int32_t VideoSender::EnableFrameDropper(bool enable) { | 360 int32_t VideoSender::EnableFrameDropper(bool enable) { |
| 362 rtc::CritScope lock(&encoder_crit_); | 361 rtc::CritScope lock(&encoder_crit_); |
| 363 frame_dropper_enabled_ = enable; | 362 frame_dropper_enabled_ = enable; |
| 364 _mediaOpt.EnableFrameDropper(enable); | 363 _mediaOpt.EnableFrameDropper(enable); |
| 365 return VCM_OK; | 364 return VCM_OK; |
| 366 } | 365 } |
| 367 } // namespace vcm | 366 } // namespace vcm |
| 368 } // namespace webrtc | 367 } // namespace webrtc |
| OLD | NEW |