Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698