Index: webrtc/test/frame_generator.cc |
diff --git a/webrtc/test/frame_generator.cc b/webrtc/test/frame_generator.cc |
index 27935e4b26be0a1575547012e6955e3c1d52fe11..80ce26f486e8d73f15812365435fa7d65d617cbd 100644 |
--- a/webrtc/test/frame_generator.cc |
+++ b/webrtc/test/frame_generator.cc |
@@ -160,6 +160,8 @@ class ScrollingImageFrameGenerator : public FrameGenerator { |
scroll_time_(scroll_time_ms), |
pause_time_(pause_time_ms), |
num_frames_(files.size()), |
+ target_width_(target_width), |
+ target_height_(target_height), |
current_frame_num_(num_frames_ - 1), |
current_source_frame_(nullptr), |
file_generator_(files, source_width, source_height, 1) { |
@@ -170,11 +172,6 @@ class ScrollingImageFrameGenerator : public FrameGenerator { |
RTC_DCHECK_GE(scroll_time_ms, 0); |
RTC_DCHECK_GE(pause_time_ms, 0); |
RTC_DCHECK_GT(scroll_time_ms + pause_time_ms, 0); |
- current_frame_.CreateEmptyFrame(static_cast<int>(target_width), |
- static_cast<int>(target_height), |
- static_cast<int>(target_width), |
- static_cast<int>((target_width + 1) / 2), |
- static_cast<int>((target_width + 1) / 2)); |
} |
virtual ~ScrollingImageFrameGenerator() {} |
@@ -208,12 +205,10 @@ class ScrollingImageFrameGenerator : public FrameGenerator { |
} |
void CropSourceToScrolledImage(double scroll_factor) { |
- const int kTargetWidth = current_frame_.width(); |
- const int kTargetHeight = current_frame_.height(); |
- int scroll_margin_x = current_source_frame_->width() - kTargetWidth; |
+ int scroll_margin_x = current_source_frame_->width() - target_width_; |
int pixels_scrolled_x = |
static_cast<int>(scroll_margin_x * scroll_factor + 0.5); |
- int scroll_margin_y = current_source_frame_->height() - kTargetHeight; |
+ int scroll_margin_y = current_source_frame_->height() - target_height_; |
int pixels_scrolled_y = |
static_cast<int>(scroll_margin_y * scroll_factor + 0.5); |
@@ -231,7 +226,7 @@ class ScrollingImageFrameGenerator : public FrameGenerator { |
¤t_source_frame_->video_frame_buffer()->DataY()[offset_y], |
¤t_source_frame_->video_frame_buffer()->DataU()[offset_u], |
¤t_source_frame_->video_frame_buffer()->DataV()[offset_v], |
- kTargetWidth, kTargetHeight, |
+ target_width_, target_height_, |
current_source_frame_->video_frame_buffer()->StrideY(), |
current_source_frame_->video_frame_buffer()->StrideU(), |
current_source_frame_->video_frame_buffer()->StrideV(), |
@@ -243,6 +238,9 @@ class ScrollingImageFrameGenerator : public FrameGenerator { |
const int64_t scroll_time_; |
const int64_t pause_time_; |
const size_t num_frames_; |
+ const int target_width_; |
+ const int target_height_; |
+ |
size_t current_frame_num_; |
VideoFrame* current_source_frame_; |
VideoFrame current_frame_; |