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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 657 |
658 if (isKeyframe) { | 658 if (isKeyframe) { |
659 LOG(LS_INFO) << "Generated keyframe"; | 659 LOG(LS_INFO) << "Generated keyframe"; |
660 } | 660 } |
661 | 661 |
662 // Convert the sample buffer into a buffer suitable for RTP packetization. | 662 // Convert the sample buffer into a buffer suitable for RTP packetization. |
663 // TODO(tkchin): Allocate buffers through a pool. | 663 // TODO(tkchin): Allocate buffers through a pool. |
664 std::unique_ptr<rtc::Buffer> buffer(new rtc::Buffer()); | 664 std::unique_ptr<rtc::Buffer> buffer(new rtc::Buffer()); |
665 RTCRtpFragmentationHeader *header; | 665 RTCRtpFragmentationHeader *header; |
666 { | 666 { |
667 webrtc::RTPFragmentationHeader *header_cpp; | 667 std::unique_ptr<webrtc::RTPFragmentationHeader> header_cpp; |
668 bool result = | 668 bool result = |
669 H264CMSampleBufferToAnnexBBuffer(sampleBuffer, isKeyframe, buffer.get(),
&header_cpp); | 669 H264CMSampleBufferToAnnexBBuffer(sampleBuffer, isKeyframe, buffer.get(),
&header_cpp); |
670 header = [[RTCRtpFragmentationHeader alloc] initWithNativeFragmentationHeade
r:header_cpp]; | 670 header = [[RTCRtpFragmentationHeader alloc] initWithNativeFragmentationHeade
r:header_cpp.get()]; |
671 if (!result) { | 671 if (!result) { |
672 return; | 672 return; |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 RTCEncodedImage *frame = [[RTCEncodedImage alloc] init]; | 676 RTCEncodedImage *frame = [[RTCEncodedImage alloc] init]; |
677 frame.buffer = [NSData dataWithBytesNoCopy:buffer->data() length:buffer->size(
) freeWhenDone:NO]; | 677 frame.buffer = [NSData dataWithBytesNoCopy:buffer->data() length:buffer->size(
) freeWhenDone:NO]; |
678 frame.encodedWidth = width; | 678 frame.encodedWidth = width; |
679 frame.encodedHeight = height; | 679 frame.encodedHeight = height; |
680 frame.completeFrame = YES; | 680 frame.completeFrame = YES; |
(...skipping 17 matching lines...) Expand all Loading... |
698 } | 698 } |
699 _bitrateAdjuster->Update(frame.buffer.length); | 699 _bitrateAdjuster->Update(frame.buffer.length); |
700 } | 700 } |
701 | 701 |
702 - (RTCVideoEncoderQpThresholds *)scalingSettings { | 702 - (RTCVideoEncoderQpThresholds *)scalingSettings { |
703 return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpTh
reshold | 703 return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpTh
reshold |
704 high:kHighH264QpT
hreshold]; | 704 high:kHighH264QpT
hreshold]; |
705 } | 705 } |
706 | 706 |
707 @end | 707 @end |
OLD | NEW |