| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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/video/video_capture_input.h" | 10 #include "webrtc/video/video_capture_input.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 bool EqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) { | 243 bool EqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) { |
| 244 if (frame1.native_handle() != NULL || frame2.native_handle() != NULL) | 244 if (frame1.native_handle() != NULL || frame2.native_handle() != NULL) |
| 245 return EqualTextureFrames(frame1, frame2); | 245 return EqualTextureFrames(frame1, frame2); |
| 246 return EqualBufferFrames(frame1, frame2); | 246 return EqualBufferFrames(frame1, frame2); |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool EqualTextureFrames(const VideoFrame& frame1, const VideoFrame& frame2) { | 249 bool EqualTextureFrames(const VideoFrame& frame1, const VideoFrame& frame2) { |
| 250 return ((frame1.native_handle() == frame2.native_handle()) && | 250 return ((frame1.native_handle() == frame2.native_handle()) && |
| 251 (frame1.width() == frame2.width()) && | 251 (frame1.width() == frame2.width()) && |
| 252 (frame1.height() == frame2.height()) && | 252 (frame1.height() == frame2.height())); |
| 253 (frame1.render_time_ms() == frame2.render_time_ms())); | |
| 254 } | 253 } |
| 255 | 254 |
| 256 bool EqualBufferFrames(const VideoFrame& frame1, const VideoFrame& frame2) { | 255 bool EqualBufferFrames(const VideoFrame& frame1, const VideoFrame& frame2) { |
| 257 return ((frame1.width() == frame2.width()) && | 256 return ((frame1.width() == frame2.width()) && |
| 258 (frame1.height() == frame2.height()) && | 257 (frame1.height() == frame2.height()) && |
| 259 (frame1.stride(kYPlane) == frame2.stride(kYPlane)) && | 258 (frame1.stride(kYPlane) == frame2.stride(kYPlane)) && |
| 260 (frame1.stride(kUPlane) == frame2.stride(kUPlane)) && | 259 (frame1.stride(kUPlane) == frame2.stride(kUPlane)) && |
| 261 (frame1.stride(kVPlane) == frame2.stride(kVPlane)) && | 260 (frame1.stride(kVPlane) == frame2.stride(kVPlane)) && |
| 262 (frame1.render_time_ms() == frame2.render_time_ms()) && | |
| 263 (frame1.allocated_size(kYPlane) == frame2.allocated_size(kYPlane)) && | 261 (frame1.allocated_size(kYPlane) == frame2.allocated_size(kYPlane)) && |
| 264 (frame1.allocated_size(kUPlane) == frame2.allocated_size(kUPlane)) && | 262 (frame1.allocated_size(kUPlane) == frame2.allocated_size(kUPlane)) && |
| 265 (frame1.allocated_size(kVPlane) == frame2.allocated_size(kVPlane)) && | 263 (frame1.allocated_size(kVPlane) == frame2.allocated_size(kVPlane)) && |
| 266 (memcmp(frame1.buffer(kYPlane), frame2.buffer(kYPlane), | 264 (memcmp(frame1.buffer(kYPlane), frame2.buffer(kYPlane), |
| 267 frame1.allocated_size(kYPlane)) == 0) && | 265 frame1.allocated_size(kYPlane)) == 0) && |
| 268 (memcmp(frame1.buffer(kUPlane), frame2.buffer(kUPlane), | 266 (memcmp(frame1.buffer(kUPlane), frame2.buffer(kUPlane), |
| 269 frame1.allocated_size(kUPlane)) == 0) && | 267 frame1.allocated_size(kUPlane)) == 0) && |
| 270 (memcmp(frame1.buffer(kVPlane), frame2.buffer(kVPlane), | 268 (memcmp(frame1.buffer(kVPlane), frame2.buffer(kVPlane), |
| 271 frame1.allocated_size(kVPlane)) == 0)); | 269 frame1.allocated_size(kVPlane)) == 0)); |
| 272 } | 270 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 289 const int kSizeY = width * height * 2; | 287 const int kSizeY = width * height * 2; |
| 290 uint8_t buffer[kSizeY]; | 288 uint8_t buffer[kSizeY]; |
| 291 memset(buffer, data, kSizeY); | 289 memset(buffer, data, kSizeY); |
| 292 frame->CreateFrame(buffer, buffer, buffer, width, height, width, width / 2, | 290 frame->CreateFrame(buffer, buffer, buffer, width, height, width, width / 2, |
| 293 width / 2); | 291 width / 2); |
| 294 frame->set_render_time_ms(data); | 292 frame->set_render_time_ms(data); |
| 295 return frame; | 293 return frame; |
| 296 } | 294 } |
| 297 | 295 |
| 298 } // namespace webrtc | 296 } // namespace webrtc |
| OLD | NEW |