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 |
(...skipping 23 matching lines...) Expand all Loading... |
34 _missingFrame(false), | 34 _missingFrame(false), |
35 _codec(kVideoCodecUnknown), | 35 _codec(kVideoCodecUnknown), |
36 _fragmentation(), | 36 _fragmentation(), |
37 _rotation(kVideoRotation_0), | 37 _rotation(kVideoRotation_0), |
38 _rotation_set(false) { | 38 _rotation_set(false) { |
39 _codecSpecificInfo.codecType = kVideoCodecUnknown; | 39 _codecSpecificInfo.codecType = kVideoCodecUnknown; |
40 _buffer = NULL; | 40 _buffer = NULL; |
41 _size = 0; | 41 _size = 0; |
42 _length = 0; | 42 _length = 0; |
43 if (rhs._buffer != NULL) { | 43 if (rhs._buffer != NULL) { |
44 VerifyAndAllocate(rhs._length); | 44 VerifyAndAllocate(rhs._length + |
| 45 EncodedImage::GetBufferPaddingBytes(_codec)); |
45 memcpy(_buffer, rhs._buffer, rhs._length); | 46 memcpy(_buffer, rhs._buffer, rhs._length); |
46 } | 47 } |
47 } | 48 } |
48 | 49 |
49 VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs) | 50 VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs) |
50 : webrtc::EncodedImage(rhs), | 51 : webrtc::EncodedImage(rhs), |
51 _renderTimeMs(rhs._renderTimeMs), | 52 _renderTimeMs(rhs._renderTimeMs), |
52 _payloadType(rhs._payloadType), | 53 _payloadType(rhs._payloadType), |
53 _missingFrame(rhs._missingFrame), | 54 _missingFrame(rhs._missingFrame), |
54 _codecSpecificInfo(rhs._codecSpecificInfo), | 55 _codecSpecificInfo(rhs._codecSpecificInfo), |
55 _codec(rhs._codec), | 56 _codec(rhs._codec), |
56 _fragmentation(), | 57 _fragmentation(), |
57 _rotation(rhs._rotation), | 58 _rotation(rhs._rotation), |
58 _rotation_set(rhs._rotation_set) { | 59 _rotation_set(rhs._rotation_set) { |
59 _buffer = NULL; | 60 _buffer = NULL; |
60 _size = 0; | 61 _size = 0; |
61 _length = 0; | 62 _length = 0; |
62 if (rhs._buffer != NULL) { | 63 if (rhs._buffer != NULL) { |
63 VerifyAndAllocate(rhs._length); | 64 VerifyAndAllocate(rhs._length + |
| 65 EncodedImage::GetBufferPaddingBytes(_codec)); |
64 memcpy(_buffer, rhs._buffer, rhs._length); | 66 memcpy(_buffer, rhs._buffer, rhs._length); |
65 _length = rhs._length; | 67 _length = rhs._length; |
66 } | 68 } |
67 _fragmentation.CopyFrom(rhs._fragmentation); | 69 _fragmentation.CopyFrom(rhs._fragmentation); |
68 } | 70 } |
69 | 71 |
70 VCMEncodedFrame::~VCMEncodedFrame() { | 72 VCMEncodedFrame::~VCMEncodedFrame() { |
71 Free(); | 73 Free(); |
72 } | 74 } |
73 | 75 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // copy old data | 218 // copy old data |
217 memcpy(newBuffer, _buffer, _size); | 219 memcpy(newBuffer, _buffer, _size); |
218 delete[] _buffer; | 220 delete[] _buffer; |
219 } | 221 } |
220 _buffer = newBuffer; | 222 _buffer = newBuffer; |
221 _size = minimumSize; | 223 _size = minimumSize; |
222 } | 224 } |
223 } | 225 } |
224 | 226 |
225 } // namespace webrtc | 227 } // namespace webrtc |
OLD | NEW |