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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // fragmentation information of |frag_header|. The |encoded_image->_buffer| may | 66 // fragmentation information of |frag_header|. The |encoded_image->_buffer| may |
67 // be deleted and reallocated if a bigger buffer is required. | 67 // be deleted and reallocated if a bigger buffer is required. |
68 // | 68 // |
69 // After OpenH264 encoding, the encoded bytes are stored in |info| spread out | 69 // After OpenH264 encoding, the encoded bytes are stored in |info| spread out |
70 // over a number of layers and "NAL units". Each NAL unit is a fragment starting | 70 // over a number of layers and "NAL units". Each NAL unit is a fragment starting |
71 // with the four-byte start code {0,0,0,1}. All of this data (including the | 71 // with the four-byte start code {0,0,0,1}. All of this data (including the |
72 // start codes) is copied to the |encoded_image->_buffer| and the |frag_header| | 72 // start codes) is copied to the |encoded_image->_buffer| and the |frag_header| |
73 // is updated to point to each fragment, with offsets and lengths set as to | 73 // is updated to point to each fragment, with offsets and lengths set as to |
74 // exclude the start codes. | 74 // exclude the start codes. |
75 static void RtpFragmentize(EncodedImage* encoded_image, | 75 static void RtpFragmentize(EncodedImage* encoded_image, |
76 rtc::scoped_ptr<uint8_t[]>* encoded_image_buffer, | 76 std::unique_ptr<uint8_t[]>* encoded_image_buffer, |
77 const VideoFrame& frame, | 77 const VideoFrame& frame, |
78 SFrameBSInfo* info, | 78 SFrameBSInfo* info, |
79 RTPFragmentationHeader* frag_header) { | 79 RTPFragmentationHeader* frag_header) { |
80 // Calculate minimum buffer size required to hold encoded data. | 80 // Calculate minimum buffer size required to hold encoded data. |
81 size_t required_size = 0; | 81 size_t required_size = 0; |
82 size_t fragments_count = 0; | 82 size_t fragments_count = 0; |
83 for (int layer = 0; layer < info->iLayerNum; ++layer) { | 83 for (int layer = 0; layer < info->iLayerNum; ++layer) { |
84 const SLayerBSInfo& layerInfo = info->sLayerInfo[layer]; | 84 const SLayerBSInfo& layerInfo = info->sLayerInfo[layer]; |
85 for (int nal = 0; nal < layerInfo.iNalCount; ++nal, ++fragments_count) { | 85 for (int nal = 0; nal < layerInfo.iNalCount; ++nal, ++fragments_count) { |
86 RTC_CHECK_GE(layerInfo.pNalLengthInByte[nal], 0); | 86 RTC_CHECK_GE(layerInfo.pNalLengthInByte[nal], 0); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 | 396 |
397 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { | 397 int32_t H264EncoderImpl::SetPeriodicKeyFrames(bool enable) { |
398 return WEBRTC_VIDEO_CODEC_OK; | 398 return WEBRTC_VIDEO_CODEC_OK; |
399 } | 399 } |
400 | 400 |
401 void H264EncoderImpl::OnDroppedFrame() { | 401 void H264EncoderImpl::OnDroppedFrame() { |
402 } | 402 } |
403 | 403 |
404 } // namespace webrtc | 404 } // namespace webrtc |
OLD | NEW |