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

Unified Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.cc

Issue 2489843002: Revert of Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/test/videoprocessor.cc
diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
index 0449276b3fcb0b8e90f3ed660b4c702dd75ba190..8436eb00425e02f5cf2d7eb5911ccca7aac895f0 100644
--- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
+++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
@@ -10,18 +10,14 @@
#include "webrtc/modules/video_coding/codecs/test/videoprocessor.h"
+#include <assert.h>
#include <string.h>
#include <limits>
#include <memory>
-#include <utility>
#include <vector>
-#include "webrtc/base/checks.h"
#include "webrtc/base/timeutils.h"
-#include "webrtc/modules/video_coding/include/video_codec_initializer.h"
-#include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h"
-#include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h"
#include "webrtc/system_wrappers/include/cpu_info.h"
namespace webrtc {
@@ -39,7 +35,7 @@
frame_length_in_bytes(0),
use_single_core(false),
keyframe_interval(0),
- codec_settings(nullptr),
+ codec_settings(NULL),
verbose(true) {}
TestConfig::~TestConfig() {}
@@ -58,9 +54,8 @@
packet_manipulator_(packet_manipulator),
config_(config),
stats_(stats),
- encode_callback_(nullptr),
- decode_callback_(nullptr),
- last_successful_frame_buffer_(nullptr),
+ encode_callback_(NULL),
+ decode_callback_(NULL),
first_key_frame_has_been_excluded_(false),
last_frame_missing_(false),
initialized_(false),
@@ -70,23 +65,13 @@
num_dropped_frames_(0),
num_spatial_resizes_(0),
last_encoder_frame_width_(0),
- last_encoder_frame_height_(0),
- bit_rate_factor_(0.0),
- encode_start_ns_(0),
- decode_start_ns_(0) {
- std::unique_ptr<TemporalLayersFactory> tl_factory;
- if (config_.codec_settings->codecType == VideoCodecType::kVideoCodecVP8) {
- tl_factory.reset(new TemporalLayersFactory());
- config.codec_settings->VP8()->tl_factory = tl_factory.get();
- }
- bitrate_allocator_ = VideoCodecInitializer::CreateBitrateAllocator(
- *config.codec_settings, std::move(tl_factory));
- RTC_DCHECK(encoder);
- RTC_DCHECK(decoder);
- RTC_DCHECK(frame_reader);
- RTC_DCHECK(frame_writer);
- RTC_DCHECK(packet_manipulator);
- RTC_DCHECK(stats);
+ last_encoder_frame_height_(0) {
+ assert(encoder);
+ assert(decoder);
+ assert(frame_reader);
+ assert(frame_writer);
+ assert(packet_manipulator);
+ assert(stats);
}
bool VideoProcessorImpl::Init() {
@@ -164,10 +149,8 @@
}
void VideoProcessorImpl::SetRates(int bit_rate, int frame_rate) {
- int set_rates_result = encoder_->SetRateAllocation(
- bitrate_allocator_->GetAllocation(bit_rate * 1000, frame_rate),
- frame_rate);
- RTC_CHECK_GE(set_rates_result, 0);
+ int set_rates_result = encoder_->SetRates(bit_rate, frame_rate);
+ assert(set_rates_result >= 0);
if (set_rates_result < 0) {
fprintf(stderr,
"Failed to update encoder with new rate %d, "
@@ -195,7 +178,7 @@
}
bool VideoProcessorImpl::ProcessFrame(int frame_number) {
- RTC_DCHECK_GE(frame_number, 0);
+ assert(frame_number >= 0);
if (!initialized_) {
fprintf(stderr, "Attempting to use uninitialized VideoProcessor!\n");
return false;
@@ -289,7 +272,7 @@
exclude_this_frame = true;
break;
default:
- RTC_NOTREACHED();
+ assert(false);
}
}
@@ -358,11 +341,11 @@
CalcBufferSize(kI420, up_image->width(), up_image->height());
std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
int extracted_length = ExtractBuffer(up_image, length, image_buffer.get());
- RTC_DCHECK_GT(extracted_length, 0);
+ assert(extracted_length > 0);
// Update our copy of the last successful frame:
memcpy(last_successful_frame_buffer_, image_buffer.get(), extracted_length);
bool write_success = frame_writer_->WriteFrame(image_buffer.get());
- RTC_DCHECK(write_success);
+ assert(write_success);
if (!write_success) {
fprintf(stderr, "Failed to write frame %d to disk!", frame_number);
}
@@ -372,11 +355,11 @@
size_t length = CalcBufferSize(kI420, image.width(), image.height());
std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
int extracted_length = ExtractBuffer(image, length, image_buffer.get());
- RTC_DCHECK_GT(extracted_length, 0);
+ assert(extracted_length > 0);
memcpy(last_successful_frame_buffer_, image_buffer.get(), extracted_length);
bool write_success = frame_writer_->WriteFrame(image_buffer.get());
- RTC_DCHECK(write_success);
+ assert(write_success);
if (!write_success) {
fprintf(stderr, "Failed to write frame %d to disk!", frame_number);
}
@@ -386,8 +369,8 @@
int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start,
int64_t stop) {
uint64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec;
- RTC_DCHECK_LT(encode_time,
- static_cast<unsigned int>(std::numeric_limits<int>::max()));
+ assert(encode_time <
+ static_cast<unsigned int>(std::numeric_limits<int>::max()));
return static_cast<int>(encode_time);
}
@@ -398,7 +381,7 @@
case kExcludeAllKeyFrames:
return "ExcludeAllKeyFrames";
default:
- RTC_NOTREACHED();
+ assert(false);
return "Unknown";
}
}
@@ -416,7 +399,7 @@
case kVideoCodecUnknown:
return "Unknown";
default:
- RTC_NOTREACHED();
+ assert(false);
return "Unknown";
}
}

Powered by Google App Engine
This is Rietveld 408576698