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

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

Issue 2707023008: Step #2: Add batch mode to VideoProcessor integration tests. (Closed)
Patch Set: Created 3 years, 10 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void VideoProcessorImpl::SetRates(int bit_rate, int frame_rate) { 194 void VideoProcessorImpl::SetRates(int bit_rate, int frame_rate) {
195 int set_rates_result = encoder_->SetRateAllocation( 195 int set_rates_result = encoder_->SetRateAllocation(
196 bitrate_allocator_->GetAllocation(bit_rate * 1000, frame_rate), 196 bitrate_allocator_->GetAllocation(bit_rate * 1000, frame_rate),
197 frame_rate); 197 frame_rate);
198 RTC_CHECK_GE(set_rates_result, 0) << "Failed to update encoder with new rate " 198 RTC_CHECK_GE(set_rates_result, 0) << "Failed to update encoder with new rate "
199 << bit_rate; 199 << bit_rate;
200 num_dropped_frames_ = 0; 200 num_dropped_frames_ = 0;
201 num_spatial_resizes_ = 0; 201 num_spatial_resizes_ = 0;
202 } 202 }
203 203
204 // TODO(brandtr): Update implementation of EncodedFrameSize and EncodedFrameType 204 size_t VideoProcessorImpl::EncodedFrameSize(int frame_number) {
205 // to support batch processing in the caller. 205 RTC_CHECK_LT(frame_number, frame_infos_.size());
206 size_t VideoProcessorImpl::EncodedFrameSize() { 206 return frame_infos_[frame_number].encoded_frame_size;
207 RTC_CHECK(!frame_infos_.empty());
208 return frame_infos_.back().encoded_frame_size;
209 } 207 }
210 208
211 FrameType VideoProcessorImpl::EncodedFrameType() { 209 FrameType VideoProcessorImpl::EncodedFrameType(int frame_number) {
212 RTC_CHECK(!frame_infos_.empty()); 210 RTC_CHECK_LT(frame_number, frame_infos_.size());
213 return frame_infos_.back().encoded_frame_type; 211 return frame_infos_[frame_number].encoded_frame_type;
214 } 212 }
215 213
216 int VideoProcessorImpl::NumberDroppedFrames() { 214 int VideoProcessorImpl::NumberDroppedFrames() {
217 return num_dropped_frames_; 215 return num_dropped_frames_;
218 } 216 }
219 217
220 int VideoProcessorImpl::NumberSpatialResizes() { 218 int VideoProcessorImpl::NumberSpatialResizes() {
221 return num_spatial_resizes_; 219 return num_spatial_resizes_;
222 } 220 }
223 221
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start, 488 int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start,
491 int64_t stop) { 489 int64_t stop) {
492 int64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec; 490 int64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec;
493 RTC_DCHECK_GE(encode_time, std::numeric_limits<int>::min()); 491 RTC_DCHECK_GE(encode_time, std::numeric_limits<int>::min());
494 RTC_DCHECK_LE(encode_time, std::numeric_limits<int>::max()); 492 RTC_DCHECK_LE(encode_time, std::numeric_limits<int>::max());
495 return static_cast<int>(encode_time); 493 return static_cast<int>(encode_time);
496 } 494 }
497 495
498 } // namespace test 496 } // namespace test
499 } // namespace webrtc 497 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698