OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include "webrtc/test/frame_generator.h" | 10 #include "webrtc/test/frame_generator.h" |
11 | 11 |
12 #include <math.h> | 12 #include <math.h> |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include <memory> | 16 #include <memory> |
17 | 17 |
18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/keep_ref_until_done.h" |
19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
20 #include "webrtc/system_wrappers/include/clock.h" | 21 #include "webrtc/system_wrappers/include/clock.h" |
21 #include "webrtc/test/frame_utils.h" | 22 #include "webrtc/test/frame_utils.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 namespace test { | 25 namespace test { |
25 namespace { | 26 namespace { |
26 | 27 |
27 class ChromaGenerator : public FrameGenerator { | 28 class ChromaGenerator : public FrameGenerator { |
28 public: | 29 public: |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 int offset_y = (current_source_frame_->video_frame_buffer()->StrideY() * | 210 int offset_y = (current_source_frame_->video_frame_buffer()->StrideY() * |
210 pixels_scrolled_y) + | 211 pixels_scrolled_y) + |
211 pixels_scrolled_x; | 212 pixels_scrolled_x; |
212 int offset_u = (current_source_frame_->video_frame_buffer()->StrideU() * | 213 int offset_u = (current_source_frame_->video_frame_buffer()->StrideU() * |
213 (pixels_scrolled_y / 2)) + | 214 (pixels_scrolled_y / 2)) + |
214 (pixels_scrolled_x / 2); | 215 (pixels_scrolled_x / 2); |
215 int offset_v = (current_source_frame_->video_frame_buffer()->StrideV() * | 216 int offset_v = (current_source_frame_->video_frame_buffer()->StrideV() * |
216 (pixels_scrolled_y / 2)) + | 217 (pixels_scrolled_y / 2)) + |
217 (pixels_scrolled_x / 2); | 218 (pixels_scrolled_x / 2); |
218 | 219 |
219 current_frame_.CreateFrame( | 220 rtc::scoped_refptr<VideoFrameBuffer> frame_buffer( |
220 ¤t_source_frame_->video_frame_buffer()->DataY()[offset_y], | 221 current_source_frame_->video_frame_buffer()); |
221 ¤t_source_frame_->video_frame_buffer()->DataU()[offset_u], | 222 current_frame_ = webrtc::VideoFrame( |
222 ¤t_source_frame_->video_frame_buffer()->DataV()[offset_v], | 223 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( |
223 target_width_, target_height_, | 224 target_width_, target_height_, |
224 current_source_frame_->video_frame_buffer()->StrideY(), | 225 &frame_buffer->DataY()[offset_y], frame_buffer->StrideY(), |
225 current_source_frame_->video_frame_buffer()->StrideU(), | 226 &frame_buffer->DataU()[offset_u], frame_buffer->StrideU(), |
226 current_source_frame_->video_frame_buffer()->StrideV(), | 227 &frame_buffer->DataV()[offset_v], frame_buffer->StrideV(), |
227 kVideoRotation_0); | 228 KeepRefUntilDone(frame_buffer)), |
| 229 kVideoRotation_0, 0); |
228 } | 230 } |
229 | 231 |
230 Clock* const clock_; | 232 Clock* const clock_; |
231 const int64_t start_time_; | 233 const int64_t start_time_; |
232 const int64_t scroll_time_; | 234 const int64_t scroll_time_; |
233 const int64_t pause_time_; | 235 const int64_t pause_time_; |
234 const size_t num_frames_; | 236 const size_t num_frames_; |
235 const int target_width_; | 237 const int target_width_; |
236 const int target_height_; | 238 const int target_height_; |
237 | 239 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 files.push_back(file); | 304 files.push_back(file); |
303 } | 305 } |
304 | 306 |
305 return new ScrollingImageFrameGenerator( | 307 return new ScrollingImageFrameGenerator( |
306 clock, files, source_width, source_height, target_width, target_height, | 308 clock, files, source_width, source_height, target_width, target_height, |
307 scroll_time_ms, pause_time_ms); | 309 scroll_time_ms, pause_time_ms); |
308 } | 310 } |
309 | 311 |
310 } // namespace test | 312 } // namespace test |
311 } // namespace webrtc | 313 } // namespace webrtc |
OLD | NEW |