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 |
11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" | 11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <limits> | 15 #include <limits> |
16 #include <memory> | 16 #include <memory> |
17 #include <utility> | 17 #include <utility> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/timeutils.h" | 21 #include "webrtc/base/timeutils.h" |
22 #include "webrtc/modules/video_coding/include/video_codec_initializer.h" | 22 #include "webrtc/modules/video_coding/include/video_codec_initializer.h" |
23 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" | 23 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" |
24 #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h" | 24 #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h" |
25 #include "webrtc/system_wrappers/include/cpu_info.h" | 25 #include "webrtc/system_wrappers/include/cpu_info.h" |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 namespace test { | 28 namespace test { |
29 namespace { | |
30 std::string CodecTypeToString(VideoCodecType codec_type) { | |
31 switch (codec_type) { | |
32 case kVideoCodecVP8: | |
33 return "VP8"; | |
34 case kVideoCodecVP9: | |
35 return "VP9"; | |
36 case kVideoCodecH264: | |
37 return "H264"; | |
38 default: | |
39 RTC_NOTREACHED(); | |
40 return ""; | |
41 } | |
42 } | |
sprang_webrtc
2017/02/07 09:18:36
Maybe use CodecTypeToPayloadName() from webrtc/com
åsapersson
2017/02/07 09:39:34
Done.
| |
43 } // namespace | |
29 | 44 |
30 TestConfig::TestConfig() | 45 TestConfig::TestConfig() |
31 : name(""), | 46 : name(""), |
32 description(""), | 47 description(""), |
33 test_number(0), | 48 test_number(0), |
34 input_filename(""), | 49 input_filename(""), |
35 output_filename(""), | 50 output_filename(""), |
36 output_dir("out"), | 51 output_dir("out"), |
37 networking_config(), | 52 networking_config(), |
38 exclude_frame_types(kExcludeOnlyFirstKeyFrame), | 53 exclude_frame_types(kExcludeOnlyFirstKeyFrame), |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 fprintf(stderr, "Failed to initialize VideoDecoder, return code: %d\n", | 154 fprintf(stderr, "Failed to initialize VideoDecoder, return code: %d\n", |
140 init_result); | 155 init_result); |
141 return false; | 156 return false; |
142 } | 157 } |
143 | 158 |
144 if (config_.verbose) { | 159 if (config_.verbose) { |
145 printf("Video Processor:\n"); | 160 printf("Video Processor:\n"); |
146 printf(" #CPU cores used : %d\n", nbr_of_cores); | 161 printf(" #CPU cores used : %d\n", nbr_of_cores); |
147 printf(" Total # of frames: %d\n", frame_reader_->NumberOfFrames()); | 162 printf(" Total # of frames: %d\n", frame_reader_->NumberOfFrames()); |
148 printf(" Codec settings:\n"); | 163 printf(" Codec settings:\n"); |
149 printf(" Start bitrate : %d kbps\n", | 164 printf(" Start bitrate : %d kbps\n", |
150 config_.codec_settings->startBitrate); | 165 config_.codec_settings->startBitrate); |
151 printf(" Width : %d\n", config_.codec_settings->width); | 166 printf(" Width : %d\n", config_.codec_settings->width); |
152 printf(" Height : %d\n", config_.codec_settings->height); | 167 printf(" Height : %d\n", config_.codec_settings->height); |
168 printf(" Codec type : %s\n", | |
169 CodecTypeToString(config_.codec_settings->codecType).c_str()); | |
170 printf(" Encoder implementation name: %s\n", | |
171 encoder_->ImplementationName()); | |
172 printf(" Decoder implementation name: %s\n", | |
173 decoder_->ImplementationName()); | |
174 if (config_.codec_settings->codecType == kVideoCodecVP8) { | |
175 printf(" Denoising : %d\n", | |
176 config_.codec_settings->VP8()->denoisingOn); | |
177 printf(" Error concealment: %d\n", | |
178 config_.codec_settings->VP8()->errorConcealmentOn); | |
179 printf(" Frame dropping : %d\n", | |
180 config_.codec_settings->VP8()->frameDroppingOn); | |
181 printf(" Resilience : %d\n", | |
182 config_.codec_settings->VP8()->resilience); | |
183 } else if (config_.codec_settings->codecType == kVideoCodecVP9) { | |
184 printf(" Resilience : %d\n", | |
185 config_.codec_settings->VP9()->resilience); | |
186 } | |
153 } | 187 } |
154 initialized_ = true; | 188 initialized_ = true; |
155 return true; | 189 return true; |
156 } | 190 } |
157 | 191 |
158 VideoProcessorImpl::~VideoProcessorImpl() { | 192 VideoProcessorImpl::~VideoProcessorImpl() { |
159 delete[] last_successful_frame_buffer_; | 193 delete[] last_successful_frame_buffer_; |
160 encoder_->RegisterEncodeCompleteCallback(NULL); | 194 encoder_->RegisterEncodeCompleteCallback(NULL); |
161 delete encode_callback_; | 195 delete encode_callback_; |
162 decoder_->RegisterDecodeCompleteCallback(NULL); | 196 decoder_->RegisterDecodeCompleteCallback(NULL); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 } | 452 } |
419 int32_t VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded( | 453 int32_t VideoProcessorImpl::VideoProcessorDecodeCompleteCallback::Decoded( |
420 VideoFrame& image) { | 454 VideoFrame& image) { |
421 // Forward to parent class. | 455 // Forward to parent class. |
422 video_processor_->FrameDecoded(image); | 456 video_processor_->FrameDecoded(image); |
423 return 0; | 457 return 0; |
424 } | 458 } |
425 | 459 |
426 } // namespace test | 460 } // namespace test |
427 } // namespace webrtc | 461 } // namespace webrtc |
OLD | NEW |