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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ntp_time_ms_ = packet.ntp_time_ms_; | 98 ntp_time_ms_ = packet.ntp_time_ms_; |
99 _codec = packet.codec; | 99 _codec = packet.codec; |
100 if (packet.frameType != kEmptyFrame) { | 100 if (packet.frameType != kEmptyFrame) { |
101 // first media packet | 101 // first media packet |
102 SetState(kStateIncomplete); | 102 SetState(kStateIncomplete); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 uint32_t requiredSizeBytes = | 106 uint32_t requiredSizeBytes = |
107 Length() + packet.sizeBytes + | 107 Length() + packet.sizeBytes + |
108 (packet.insertStartCode ? kH264StartCodeLengthBytes : 0); | 108 (packet.insertStartCode ? kH264StartCodeLengthBytes : 0) + |
| 109 EncodedImage::GetBufferPaddingBytes(packet.codec); |
109 if (requiredSizeBytes >= _size) { | 110 if (requiredSizeBytes >= _size) { |
110 const uint8_t* prevBuffer = _buffer; | 111 const uint8_t* prevBuffer = _buffer; |
111 const uint32_t increments = | 112 const uint32_t increments = |
112 requiredSizeBytes / kBufferIncStepSizeBytes + | 113 requiredSizeBytes / kBufferIncStepSizeBytes + |
113 (requiredSizeBytes % kBufferIncStepSizeBytes > 0); | 114 (requiredSizeBytes % kBufferIncStepSizeBytes > 0); |
114 const uint32_t newSize = _size + increments * kBufferIncStepSizeBytes; | 115 const uint32_t newSize = _size + increments * kBufferIncStepSizeBytes; |
115 if (newSize > kMaxJBFrameSizeBytes) { | 116 if (newSize > kMaxJBFrameSizeBytes) { |
116 LOG(LS_ERROR) << "Failed to insert packet due to frame being too " | 117 LOG(LS_ERROR) << "Failed to insert packet due to frame being too " |
117 "big."; | 118 "big."; |
118 return kSizeError; | 119 return kSizeError; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 _length -= bytes_removed; | 262 _length -= bytes_removed; |
262 #endif | 263 #endif |
263 // Transfer frame information to EncodedFrame and create any codec | 264 // Transfer frame information to EncodedFrame and create any codec |
264 // specific information. | 265 // specific information. |
265 _frameType = _sessionInfo.FrameType(); | 266 _frameType = _sessionInfo.FrameType(); |
266 _completeFrame = _sessionInfo.complete(); | 267 _completeFrame = _sessionInfo.complete(); |
267 _missingFrame = !continuous; | 268 _missingFrame = !continuous; |
268 } | 269 } |
269 | 270 |
270 } // namespace webrtc | 271 } // namespace webrtc |
OLD | NEW |