| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 LOG(LS_ERROR) << "Failed to get block buffer data."; | 116 LOG(LS_ERROR) << "Failed to get block buffer data."; |
| 117 CFRelease(contiguous_buffer); | 117 CFRelease(contiguous_buffer); |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 size_t bytes_remaining = block_buffer_size; | 120 size_t bytes_remaining = block_buffer_size; |
| 121 while (bytes_remaining > 0) { | 121 while (bytes_remaining > 0) { |
| 122 // The size type here must match |nalu_header_size|, we expect 4 bytes. | 122 // The size type here must match |nalu_header_size|, we expect 4 bytes. |
| 123 // Read the length of the next packet of data. Must convert from big endian | 123 // Read the length of the next packet of data. Must convert from big endian |
| 124 // to host endian. | 124 // to host endian. |
| 125 RTC_DCHECK_GE(bytes_remaining, (size_t)nalu_header_size); | 125 RTC_DCHECK_GE(bytes_remaining, (size_t)nalu_header_size); |
| 126 uint32_t* uint32_data_ptr = reinterpret_cast<uint32*>(data_ptr); | 126 uint32_t* uint32_data_ptr = reinterpret_cast<uint32_t*>(data_ptr); |
| 127 uint32_t packet_size = CFSwapInt32BigToHost(*uint32_data_ptr); | 127 uint32_t packet_size = CFSwapInt32BigToHost(*uint32_data_ptr); |
| 128 // Update buffer. | 128 // Update buffer. |
| 129 annexb_buffer->AppendData(kAnnexBHeaderBytes, sizeof(kAnnexBHeaderBytes)); | 129 annexb_buffer->AppendData(kAnnexBHeaderBytes, sizeof(kAnnexBHeaderBytes)); |
| 130 annexb_buffer->AppendData(data_ptr + nalu_header_size, packet_size); | 130 annexb_buffer->AppendData(data_ptr + nalu_header_size, packet_size); |
| 131 // Update fragmentation. | 131 // Update fragmentation. |
| 132 frag_offsets.push_back(nalu_offset + sizeof(kAnnexBHeaderBytes)); | 132 frag_offsets.push_back(nalu_offset + sizeof(kAnnexBHeaderBytes)); |
| 133 frag_lengths.push_back(packet_size); | 133 frag_lengths.push_back(packet_size); |
| 134 nalu_offset += sizeof(kAnnexBHeaderBytes) + packet_size; | 134 nalu_offset += sizeof(kAnnexBHeaderBytes) + packet_size; |
| 135 | 135 |
| 136 size_t bytes_written = packet_size + nalu_header_size; | 136 size_t bytes_written = packet_size + nalu_header_size; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 return true; | 347 return true; |
| 348 } | 348 } |
| 349 | 349 |
| 350 size_t AvccBufferWriter::BytesRemaining() const { | 350 size_t AvccBufferWriter::BytesRemaining() const { |
| 351 return length_ - offset_; | 351 return length_ - offset_; |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace webrtc | 354 } // namespace webrtc |
| 355 | 355 |
| 356 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 356 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
| OLD | NEW |