Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.cc

Issue 2890223002: Update plot_webrtc_test_logs.py: (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 encode_callback_(new VideoProcessorEncodeCompleteCallback(this)), 132 encode_callback_(new VideoProcessorEncodeCompleteCallback(this)),
133 decode_callback_(new VideoProcessorDecodeCompleteCallback(this)), 133 decode_callback_(new VideoProcessorDecodeCompleteCallback(this)),
134 packet_manipulator_(packet_manipulator), 134 packet_manipulator_(packet_manipulator),
135 config_(config), 135 config_(config),
136 analysis_frame_reader_(analysis_frame_reader), 136 analysis_frame_reader_(analysis_frame_reader),
137 analysis_frame_writer_(analysis_frame_writer), 137 analysis_frame_writer_(analysis_frame_writer),
138 num_frames_(analysis_frame_reader->NumberOfFrames()), 138 num_frames_(analysis_frame_reader->NumberOfFrames()),
139 source_frame_writer_(source_frame_writer), 139 source_frame_writer_(source_frame_writer),
140 encoded_frame_writer_(encoded_frame_writer), 140 encoded_frame_writer_(encoded_frame_writer),
141 decoded_frame_writer_(decoded_frame_writer), 141 decoded_frame_writer_(decoded_frame_writer),
142 bit_rate_factor_(config.codec_settings->maxFramerate * 0.001 * 8),
142 initialized_(false), 143 initialized_(false),
143 last_encoded_frame_num_(-1), 144 last_encoded_frame_num_(-1),
144 last_decoded_frame_num_(-1), 145 last_decoded_frame_num_(-1),
145 first_key_frame_has_been_excluded_(false), 146 first_key_frame_has_been_excluded_(false),
146 last_decoded_frame_buffer_(0, analysis_frame_reader->FrameLength()), 147 last_decoded_frame_buffer_(0, analysis_frame_reader->FrameLength()),
147 stats_(stats), 148 stats_(stats),
148 num_dropped_frames_(0), 149 num_dropped_frames_(0),
149 num_spatial_resizes_(0), 150 num_spatial_resizes_(0) {
150 bit_rate_factor_(0.0) {
151 RTC_DCHECK(encoder); 151 RTC_DCHECK(encoder);
152 RTC_DCHECK(decoder); 152 RTC_DCHECK(decoder);
153 RTC_DCHECK(packet_manipulator); 153 RTC_DCHECK(packet_manipulator);
154 RTC_DCHECK(analysis_frame_reader); 154 RTC_DCHECK(analysis_frame_reader);
155 RTC_DCHECK(analysis_frame_writer); 155 RTC_DCHECK(analysis_frame_writer);
156 RTC_DCHECK(stats); 156 RTC_DCHECK(stats);
157 157
158 frame_infos_.reserve(num_frames_); 158 frame_infos_.reserve(num_frames_);
159 } 159 }
160 160
161 bool VideoProcessorImpl::Init() { 161 bool VideoProcessorImpl::Init() {
162 RTC_DCHECK(!initialized_) 162 RTC_DCHECK(!initialized_)
163 << "This VideoProcessor has already been initialized."; 163 << "This VideoProcessor has already been initialized.";
164 164
165 // Calculate a factor used for bit rate calculations.
166 bit_rate_factor_ = config_.codec_settings->maxFramerate * 0.001 * 8; // bits
167
168 // Setup required callbacks for the encoder/decoder. 165 // Setup required callbacks for the encoder/decoder.
169 RTC_CHECK_EQ(encoder_->RegisterEncodeCompleteCallback(encode_callback_.get()), 166 RTC_CHECK_EQ(encoder_->RegisterEncodeCompleteCallback(encode_callback_.get()),
170 WEBRTC_VIDEO_CODEC_OK) 167 WEBRTC_VIDEO_CODEC_OK)
171 << "Failed to register encode complete callback"; 168 << "Failed to register encode complete callback";
172 RTC_CHECK_EQ(decoder_->RegisterDecodeCompleteCallback(decode_callback_.get()), 169 RTC_CHECK_EQ(decoder_->RegisterDecodeCompleteCallback(decode_callback_.get()),
173 WEBRTC_VIDEO_CODEC_OK) 170 WEBRTC_VIDEO_CODEC_OK)
174 << "Failed to register decode complete callback"; 171 << "Failed to register decode complete callback";
175 172
176 // Initialize the encoder and decoder. 173 // Initialize the encoder and decoder.
177 uint32_t num_cores = 174 uint32_t num_cores =
(...skipping 10 matching lines...) Expand all
188 185
189 if (config_.verbose) { 186 if (config_.verbose) {
190 printf("Video Processor:\n"); 187 printf("Video Processor:\n");
191 printf(" #CPU cores used : %d\n", num_cores); 188 printf(" #CPU cores used : %d\n", num_cores);
192 printf(" Total # of frames: %d\n", num_frames_); 189 printf(" Total # of frames: %d\n", num_frames_);
193 printf(" Codec settings:\n"); 190 printf(" Codec settings:\n");
194 printf(" Encoder implementation name: %s\n", 191 printf(" Encoder implementation name: %s\n",
195 encoder_->ImplementationName()); 192 encoder_->ImplementationName());
196 printf(" Decoder implementation name: %s\n", 193 printf(" Decoder implementation name: %s\n",
197 decoder_->ImplementationName()); 194 decoder_->ImplementationName());
195 if (strcmp(encoder_->ImplementationName(),
196 decoder_->ImplementationName()) == 0) {
197 printf(" Codec implementation name: %s_%s\n",
198 CodecTypeToPayloadName(config_.codec_settings->codecType)
199 .value_or("Unknown"),
200 encoder_->ImplementationName());
201 }
198 PrintCodecSettings(config_.codec_settings); 202 PrintCodecSettings(config_.codec_settings);
199 } 203 }
200 204
201 initialized_ = true; 205 initialized_ = true;
202 206
203 return true; 207 return true;
204 } 208 }
205 209
206 VideoProcessorImpl::~VideoProcessorImpl() { 210 VideoProcessorImpl::~VideoProcessorImpl() {
207 encoder_->RegisterEncodeCompleteCallback(nullptr); 211 encoder_->RegisterEncodeCompleteCallback(nullptr);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 if (decoded_frame_writer_) { 497 if (decoded_frame_writer_) {
494 RTC_DCHECK_EQ(extracted_length, decoded_frame_writer_->FrameLength()); 498 RTC_DCHECK_EQ(extracted_length, decoded_frame_writer_->FrameLength());
495 RTC_CHECK(decoded_frame_writer_->WriteFrame(extracted_buffer.data())); 499 RTC_CHECK(decoded_frame_writer_->WriteFrame(extracted_buffer.data()));
496 } 500 }
497 501
498 last_decoded_frame_buffer_ = std::move(extracted_buffer); 502 last_decoded_frame_buffer_ = std::move(extracted_buffer);
499 } 503 }
500 504
501 } // namespace test 505 } // namespace test
502 } // namespace webrtc 506 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698