| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 header->fragmentationOffset[i] = frag_offsets[i]; | 147 header->fragmentationOffset[i] = frag_offsets[i]; |
| 148 header->fragmentationLength[i] = frag_lengths[i]; | 148 header->fragmentationLength[i] = frag_lengths[i]; |
| 149 header->fragmentationPlType[i] = 0; | 149 header->fragmentationPlType[i] = 0; |
| 150 header->fragmentationTimeDiff[i] = 0; | 150 header->fragmentationTimeDiff[i] = 0; |
| 151 } | 151 } |
| 152 *out_header = header.release(); | 152 *out_header = header.release(); |
| 153 CFRelease(contiguous_buffer); | 153 CFRelease(contiguous_buffer); |
| 154 return true; | 154 return true; |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool H264AnnexBBufferToCMSampleBuffer( | 157 bool H264AnnexBBufferToCMSampleBuffer(const uint8_t* annexb_buffer, |
| 158 const uint8_t* annexb_buffer, | 158 size_t annexb_buffer_size, |
| 159 size_t annexb_buffer_size, | 159 CMVideoFormatDescriptionRef video_format, |
| 160 CMVideoFormatDescriptionRef video_format, | 160 CMSampleBufferRef* out_sample_buffer) { |
| 161 CMSampleBufferRef* out_sample_buffer) { | |
| 162 RTC_DCHECK(annexb_buffer); | 161 RTC_DCHECK(annexb_buffer); |
| 163 RTC_DCHECK(out_sample_buffer); | 162 RTC_DCHECK(out_sample_buffer); |
| 164 *out_sample_buffer = nullptr; | 163 *out_sample_buffer = nullptr; |
| 165 | 164 |
| 166 // The buffer we receive via RTP has 00 00 00 01 start code artifically | 165 // The buffer we receive via RTP has 00 00 00 01 start code artifically |
| 167 // embedded by the RTP depacketizer. Extract NALU information. | 166 // embedded by the RTP depacketizer. Extract NALU information. |
| 168 // TODO(tkchin): handle potential case where sps and pps are delivered | 167 // TODO(tkchin): handle potential case where sps and pps are delivered |
| 169 // separately. | 168 // separately. |
| 170 uint8_t first_nalu_type = annexb_buffer[4] & 0x1f; | 169 uint8_t first_nalu_type = annexb_buffer[4] & 0x1f; |
| 171 bool is_first_nalu_type_sps = first_nalu_type == 0x7; | 170 bool is_first_nalu_type_sps = first_nalu_type == 0x7; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 return true; | 346 return true; |
| 348 } | 347 } |
| 349 | 348 |
| 350 size_t AvccBufferWriter::BytesRemaining() const { | 349 size_t AvccBufferWriter::BytesRemaining() const { |
| 351 return length_ - offset_; | 350 return length_ - offset_; |
| 352 } | 351 } |
| 353 | 352 |
| 354 } // namespace webrtc | 353 } // namespace webrtc |
| 355 | 354 |
| 356 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 355 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
| OLD | NEW |