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/modules/video_coding/include/video_coding_defines.h" | 11 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
12 #include "webrtc/modules/video_coding/encoded_frame.h" | 12 #include "webrtc/modules/video_coding/encoded_frame.h" |
13 #include "webrtc/modules/video_coding/generic_encoder.h" | 13 #include "webrtc/modules/video_coding/generic_encoder.h" |
14 #include "webrtc/modules/video_coding/jitter_buffer_common.h" | 14 #include "webrtc/modules/video_coding/jitter_buffer_common.h" |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 | 17 |
18 VCMEncodedFrame::VCMEncodedFrame() | 18 VCMEncodedFrame::VCMEncodedFrame() |
19 : webrtc::EncodedImage(), | 19 : webrtc::EncodedImage(), |
20 _renderTimeMs(-1), | 20 _renderTimeMs(-1), |
21 _payloadType(0), | 21 _payloadType(0), |
22 _missingFrame(false), | 22 _missingFrame(false), |
23 _codec(kVideoCodecUnknown), | 23 _codec(kVideoCodecUnknown), |
24 _fragmentation(), | 24 _fragmentation(), |
25 _rotation(kVideoRotation_0), | |
26 _rotation_set(false) { | 25 _rotation_set(false) { |
27 _codecSpecificInfo.codecType = kVideoCodecUnknown; | 26 _codecSpecificInfo.codecType = kVideoCodecUnknown; |
28 } | 27 } |
29 | 28 |
30 VCMEncodedFrame::VCMEncodedFrame(const webrtc::EncodedImage& rhs) | 29 VCMEncodedFrame::VCMEncodedFrame(const webrtc::EncodedImage& rhs) |
31 : webrtc::EncodedImage(rhs), | 30 : webrtc::EncodedImage(rhs), |
32 _renderTimeMs(-1), | 31 _renderTimeMs(-1), |
33 _payloadType(0), | 32 _payloadType(0), |
34 _missingFrame(false), | 33 _missingFrame(false), |
35 _codec(kVideoCodecUnknown), | 34 _codec(kVideoCodecUnknown), |
36 _fragmentation(), | 35 _fragmentation(), |
37 _rotation(kVideoRotation_0), | |
38 _rotation_set(false) { | 36 _rotation_set(false) { |
39 _codecSpecificInfo.codecType = kVideoCodecUnknown; | 37 _codecSpecificInfo.codecType = kVideoCodecUnknown; |
40 _buffer = NULL; | 38 _buffer = NULL; |
41 _size = 0; | 39 _size = 0; |
42 _length = 0; | 40 _length = 0; |
43 if (rhs._buffer != NULL) { | 41 if (rhs._buffer != NULL) { |
44 VerifyAndAllocate(rhs._length + | 42 VerifyAndAllocate(rhs._length + |
45 EncodedImage::GetBufferPaddingBytes(_codec)); | 43 EncodedImage::GetBufferPaddingBytes(_codec)); |
46 memcpy(_buffer, rhs._buffer, rhs._length); | 44 memcpy(_buffer, rhs._buffer, rhs._length); |
47 } | 45 } |
48 } | 46 } |
49 | 47 |
50 VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs) | 48 VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs) |
51 : webrtc::EncodedImage(rhs), | 49 : webrtc::EncodedImage(rhs), |
52 _renderTimeMs(rhs._renderTimeMs), | 50 _renderTimeMs(rhs._renderTimeMs), |
53 _payloadType(rhs._payloadType), | 51 _payloadType(rhs._payloadType), |
54 _missingFrame(rhs._missingFrame), | 52 _missingFrame(rhs._missingFrame), |
55 _codecSpecificInfo(rhs._codecSpecificInfo), | 53 _codecSpecificInfo(rhs._codecSpecificInfo), |
56 _codec(rhs._codec), | 54 _codec(rhs._codec), |
57 _fragmentation(), | 55 _fragmentation(), |
58 _rotation(rhs._rotation), | |
59 _rotation_set(rhs._rotation_set) { | 56 _rotation_set(rhs._rotation_set) { |
60 _buffer = NULL; | 57 _buffer = NULL; |
61 _size = 0; | 58 _size = 0; |
62 _length = 0; | 59 _length = 0; |
63 if (rhs._buffer != NULL) { | 60 if (rhs._buffer != NULL) { |
64 VerifyAndAllocate(rhs._length + | 61 VerifyAndAllocate(rhs._length + |
65 EncodedImage::GetBufferPaddingBytes(_codec)); | 62 EncodedImage::GetBufferPaddingBytes(_codec)); |
66 memcpy(_buffer, rhs._buffer, rhs._length); | 63 memcpy(_buffer, rhs._buffer, rhs._length); |
67 _length = rhs._length; | 64 _length = rhs._length; |
68 } | 65 } |
(...skipping 17 matching lines...) Expand all Loading... |
86 _timeStamp = 0; | 83 _timeStamp = 0; |
87 _payloadType = 0; | 84 _payloadType = 0; |
88 _frameType = kVideoFrameDelta; | 85 _frameType = kVideoFrameDelta; |
89 _encodedWidth = 0; | 86 _encodedWidth = 0; |
90 _encodedHeight = 0; | 87 _encodedHeight = 0; |
91 _completeFrame = false; | 88 _completeFrame = false; |
92 _missingFrame = false; | 89 _missingFrame = false; |
93 _length = 0; | 90 _length = 0; |
94 _codecSpecificInfo.codecType = kVideoCodecUnknown; | 91 _codecSpecificInfo.codecType = kVideoCodecUnknown; |
95 _codec = kVideoCodecUnknown; | 92 _codec = kVideoCodecUnknown; |
96 _rotation = kVideoRotation_0; | 93 rotation_ = kVideoRotation_0; |
97 _rotation_set = false; | 94 _rotation_set = false; |
98 } | 95 } |
99 | 96 |
100 void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) { | 97 void VCMEncodedFrame::CopyCodecSpecific(const RTPVideoHeader* header) { |
101 if (header) { | 98 if (header) { |
102 switch (header->codec) { | 99 switch (header->codec) { |
103 case kRtpVideoVp8: { | 100 case kRtpVideoVp8: { |
104 if (_codecSpecificInfo.codecType != kVideoCodecVP8) { | 101 if (_codecSpecificInfo.codecType != kVideoCodecVP8) { |
105 // This is the first packet for this frame. | 102 // This is the first packet for this frame. |
106 _codecSpecificInfo.codecSpecific.VP8.pictureId = -1; | 103 _codecSpecificInfo.codecSpecific.VP8.pictureId = -1; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // copy old data | 215 // copy old data |
219 memcpy(newBuffer, _buffer, _size); | 216 memcpy(newBuffer, _buffer, _size); |
220 delete[] _buffer; | 217 delete[] _buffer; |
221 } | 218 } |
222 _buffer = newBuffer; | 219 _buffer = newBuffer; |
223 _size = minimumSize; | 220 _size = minimumSize; |
224 } | 221 } |
225 } | 222 } |
226 | 223 |
227 } // namespace webrtc | 224 } // namespace webrtc |
OLD | NEW |