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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 encode_callback_.reset(new VideoProcessorEncodeCompleteCallback(this)); | 117 encode_callback_.reset(new VideoProcessorEncodeCompleteCallback(this)); |
118 decode_callback_.reset(new VideoProcessorDecodeCompleteCallback(this)); | 118 decode_callback_.reset(new VideoProcessorDecodeCompleteCallback(this)); |
119 RTC_CHECK_EQ(encoder_->RegisterEncodeCompleteCallback(encode_callback_.get()), | 119 RTC_CHECK_EQ(encoder_->RegisterEncodeCompleteCallback(encode_callback_.get()), |
120 WEBRTC_VIDEO_CODEC_OK) | 120 WEBRTC_VIDEO_CODEC_OK) |
121 << "Failed to register encode complete callback"; | 121 << "Failed to register encode complete callback"; |
122 RTC_CHECK_EQ(decoder_->RegisterDecodeCompleteCallback(decode_callback_.get()), | 122 RTC_CHECK_EQ(decoder_->RegisterDecodeCompleteCallback(decode_callback_.get()), |
123 WEBRTC_VIDEO_CODEC_OK) | 123 WEBRTC_VIDEO_CODEC_OK) |
124 << "Failed to register decode complete callback"; | 124 << "Failed to register decode complete callback"; |
125 | 125 |
126 // Init the encoder and decoder. | 126 // Init the encoder and decoder. |
127 uint32_t num_cores = 1; | 127 uint32_t num_cores = |
128 if (!config_.use_single_core) { | 128 config_.use_single_core ? 1 : CpuInfo::DetectNumberOfCores(); |
129 num_cores = CpuInfo::DetectNumberOfCores(); | |
130 } | |
131 RTC_CHECK_EQ( | 129 RTC_CHECK_EQ( |
132 encoder_->InitEncode(config_.codec_settings, num_cores, | 130 encoder_->InitEncode(config_.codec_settings, num_cores, |
133 config_.networking_config.max_payload_size_in_bytes), | 131 config_.networking_config.max_payload_size_in_bytes), |
134 WEBRTC_VIDEO_CODEC_OK) | 132 WEBRTC_VIDEO_CODEC_OK) |
135 << "Failed to initialize VideoEncoder"; | 133 << "Failed to initialize VideoEncoder"; |
136 | 134 |
137 RTC_CHECK_EQ(decoder_->InitDecode(config_.codec_settings, num_cores), | 135 RTC_CHECK_EQ(decoder_->InitDecode(config_.codec_settings, num_cores), |
138 WEBRTC_VIDEO_CODEC_OK) | 136 WEBRTC_VIDEO_CODEC_OK) |
139 << "Failed to initialize VideoDecoder"; | 137 << "Failed to initialize VideoDecoder"; |
140 | 138 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start, | 421 int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start, |
424 int64_t stop) { | 422 int64_t stop) { |
425 int64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec; | 423 int64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec; |
426 RTC_DCHECK_GE(encode_time, std::numeric_limits<int>::min()); | 424 RTC_DCHECK_GE(encode_time, std::numeric_limits<int>::min()); |
427 RTC_DCHECK_LE(encode_time, std::numeric_limits<int>::max()); | 425 RTC_DCHECK_LE(encode_time, std::numeric_limits<int>::max()); |
428 return static_cast<int>(encode_time); | 426 return static_cast<int>(encode_time); |
429 } | 427 } |
430 | 428 |
431 } // namespace test | 429 } // namespace test |
432 } // namespace webrtc | 430 } // namespace webrtc |
OLD | NEW |