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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 case kVideoCodecULPFEC: | 183 case kVideoCodecULPFEC: |
190 case kVideoCodecGeneric: | 184 case kVideoCodecGeneric: |
191 case kVideoCodecUnknown: | 185 case kVideoCodecUnknown: |
192 return 0; | 186 return 0; |
193 } | 187 } |
194 RTC_NOTREACHED(); | 188 RTC_NOTREACHED(); |
195 return 0; | 189 return 0; |
196 } | 190 } |
197 | 191 |
198 } // namespace webrtc | 192 } // namespace webrtc |
OLD | NEW |