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 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 VCMEncodedFrame::VCMEncodedFrame(const webrtc::EncodedImage& rhs) | 28 VCMEncodedFrame::VCMEncodedFrame(const webrtc::EncodedImage& rhs) |
29 : webrtc::EncodedImage(rhs), | 29 : webrtc::EncodedImage(rhs), |
30 _renderTimeMs(-1), | 30 _renderTimeMs(-1), |
31 _payloadType(0), | 31 _payloadType(0), |
32 _missingFrame(false), | 32 _missingFrame(false), |
33 _codec(kVideoCodecUnknown), | 33 _codec(kVideoCodecUnknown), |
34 _rotation_set(false) { | 34 _rotation_set(false) { |
35 _codecSpecificInfo.codecType = kVideoCodecUnknown; | 35 _codecSpecificInfo.codecType = kVideoCodecUnknown; |
36 _buffer = NULL; | 36 _buffer = nullptr; |
37 _size = 0; | 37 _size = 0; |
38 _length = 0; | 38 _length = 0; |
39 if (rhs._buffer != NULL) { | 39 if (rhs._buffer != nullptr) { |
40 VerifyAndAllocate(rhs._length + | 40 VerifyAndAllocate(rhs._length + |
41 EncodedImage::GetBufferPaddingBytes(_codec)); | 41 EncodedImage::GetBufferPaddingBytes(_codec)); |
42 memcpy(_buffer, rhs._buffer, rhs._length); | 42 memcpy(_buffer, rhs._buffer, rhs._length); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs) | 46 VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs) |
47 : webrtc::EncodedImage(rhs), | 47 : webrtc::EncodedImage(rhs), |
48 _renderTimeMs(rhs._renderTimeMs), | 48 _renderTimeMs(rhs._renderTimeMs), |
49 _payloadType(rhs._payloadType), | 49 _payloadType(rhs._payloadType), |
50 _missingFrame(rhs._missingFrame), | 50 _missingFrame(rhs._missingFrame), |
51 _codecSpecificInfo(rhs._codecSpecificInfo), | 51 _codecSpecificInfo(rhs._codecSpecificInfo), |
52 _codec(rhs._codec), | 52 _codec(rhs._codec), |
53 _rotation_set(rhs._rotation_set) { | 53 _rotation_set(rhs._rotation_set) { |
54 _buffer = NULL; | 54 _buffer = nullptr; |
55 _size = 0; | 55 _size = 0; |
56 _length = 0; | 56 _length = 0; |
57 if (rhs._buffer != NULL) { | 57 if (rhs._buffer != nullptr) { |
58 VerifyAndAllocate(rhs._length + | 58 VerifyAndAllocate(rhs._length + |
59 EncodedImage::GetBufferPaddingBytes(_codec)); | 59 EncodedImage::GetBufferPaddingBytes(_codec)); |
60 memcpy(_buffer, rhs._buffer, rhs._length); | 60 memcpy(_buffer, rhs._buffer, rhs._length); |
61 _length = rhs._length; | 61 _length = rhs._length; |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 VCMEncodedFrame::~VCMEncodedFrame() { | 65 VCMEncodedFrame::~VCMEncodedFrame() { |
66 Free(); | 66 Free(); |
67 } | 67 } |
68 | 68 |
69 void VCMEncodedFrame::Free() { | 69 void VCMEncodedFrame::Free() { |
70 Reset(); | 70 Reset(); |
71 if (_buffer != NULL) { | 71 if (_buffer != nullptr) { |
72 delete[] _buffer; | 72 delete[] _buffer; |
73 _buffer = NULL; | 73 _buffer = nullptr; |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void VCMEncodedFrame::Reset() { | 77 void VCMEncodedFrame::Reset() { |
78 _renderTimeMs = -1; | 78 _renderTimeMs = -1; |
79 _timeStamp = 0; | 79 _timeStamp = 0; |
80 _payloadType = 0; | 80 _payloadType = 0; |
81 _frameType = kVideoFrameDelta; | 81 _frameType = kVideoFrameDelta; |
82 _encodedWidth = 0; | 82 _encodedWidth = 0; |
83 _encodedHeight = 0; | 83 _encodedHeight = 0; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // copy old data | 207 // copy old data |
208 memcpy(newBuffer, _buffer, _size); | 208 memcpy(newBuffer, _buffer, _size); |
209 delete[] _buffer; | 209 delete[] _buffer; |
210 } | 210 } |
211 _buffer = newBuffer; | 211 _buffer = newBuffer; |
212 _size = minimumSize; | 212 _size = minimumSize; |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 } // namespace webrtc | 216 } // namespace webrtc |
OLD | NEW |