| OLD | NEW |
| 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 |
| 11 #include "webrtc/video_frame.h" | 11 #include "webrtc/video_frame.h" |
| 12 | 12 |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 | 14 |
| 15 #include <algorithm> // swap | 15 #include <algorithm> // swap |
| 16 | 16 |
| 17 #include "webrtc/base/bind.h" | 17 #include "webrtc/base/bind.h" |
| 18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 // FFmpeg's decoder, used by H264DecoderImpl, requires up to 8 bytes padding due | 22 // FFmpeg's decoder, used by H264DecoderImpl, requires up to 8 bytes padding due |
| 23 // to optimized bitstream readers. See avcodec_decode_video2. | 23 // to optimized bitstream readers. See avcodec_decode_video2. |
| 24 const size_t EncodedImage::kBufferPaddingBytesH264 = 8; | 24 const size_t EncodedImage::kBufferPaddingBytesH264 = 8; |
| 25 | 25 |
| 26 int ExpectedSize(int plane_stride, int image_height, PlaneType type) { | |
| 27 if (type == kYPlane) | |
| 28 return plane_stride * image_height; | |
| 29 return plane_stride * ((image_height + 1) / 2); | |
| 30 } | |
| 31 | |
| 32 VideoFrame::VideoFrame() | 26 VideoFrame::VideoFrame() |
| 33 : video_frame_buffer_(nullptr), | 27 : video_frame_buffer_(nullptr), |
| 34 timestamp_(0), | 28 timestamp_(0), |
| 35 ntp_time_ms_(0), | 29 ntp_time_ms_(0), |
| 36 render_time_ms_(0), | 30 render_time_ms_(0), |
| 37 rotation_(kVideoRotation_0) {} | 31 rotation_(kVideoRotation_0) {} |
| 38 | 32 |
| 39 VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 33 VideoFrame::VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| 40 uint32_t timestamp, | 34 uint32_t timestamp, |
| 41 int64_t render_time_ms, | 35 int64_t render_time_ms, |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 case kVideoCodecULPFEC: | 181 case kVideoCodecULPFEC: |
| 188 case kVideoCodecGeneric: | 182 case kVideoCodecGeneric: |
| 189 case kVideoCodecUnknown: | 183 case kVideoCodecUnknown: |
| 190 return 0; | 184 return 0; |
| 191 } | 185 } |
| 192 RTC_NOTREACHED(); | 186 RTC_NOTREACHED(); |
| 193 return 0; | 187 return 0; |
| 194 } | 188 } |
| 195 | 189 |
| 196 } // namespace webrtc | 190 } // namespace webrtc |
| OLD | NEW |