| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 int H264VideoToolboxEncoder::SetRates(uint32_t new_bitrate_kbit, | 528 int H264VideoToolboxEncoder::SetRates(uint32_t new_bitrate_kbit, |
| 529 uint32_t frame_rate) { | 529 uint32_t frame_rate) { |
| 530 target_bitrate_bps_ = 1000 * new_bitrate_kbit; | 530 target_bitrate_bps_ = 1000 * new_bitrate_kbit; |
| 531 bitrate_adjuster_.SetTargetBitrateBps(target_bitrate_bps_); | 531 bitrate_adjuster_.SetTargetBitrateBps(target_bitrate_bps_); |
| 532 SetBitrateBps(bitrate_adjuster_.GetAdjustedBitrateBps()); | 532 SetBitrateBps(bitrate_adjuster_.GetAdjustedBitrateBps()); |
| 533 return WEBRTC_VIDEO_CODEC_OK; | 533 return WEBRTC_VIDEO_CODEC_OK; |
| 534 } | 534 } |
| 535 | 535 |
| 536 int H264VideoToolboxEncoder::Release() { | 536 int H264VideoToolboxEncoder::Release() { |
| 537 // Need to reset so that the session is invalidated and won't use the | 537 // Need to destroy so that the session is invalidated and won't use the |
| 538 // callback anymore. Do not remove callback until the session is invalidated | 538 // callback anymore. Do not remove callback until the session is invalidated |
| 539 // since async encoder callbacks can occur until invalidation. | 539 // since async encoder callbacks can occur until invalidation. |
| 540 int ret = ResetCompressionSession(); | 540 DestroyCompressionSession(); |
| 541 callback_ = nullptr; | 541 callback_ = nullptr; |
| 542 return ret; | 542 return WEBRTC_VIDEO_CODEC_OK; |
| 543 } | 543 } |
| 544 | 544 |
| 545 int H264VideoToolboxEncoder::ResetCompressionSession() { | 545 int H264VideoToolboxEncoder::ResetCompressionSession() { |
| 546 DestroyCompressionSession(); | 546 DestroyCompressionSession(); |
| 547 | 547 |
| 548 // Set source image buffer attributes. These attributes will be present on | 548 // Set source image buffer attributes. These attributes will be present on |
| 549 // buffers retrieved from the encoder's pixel buffer pool. | 549 // buffers retrieved from the encoder's pixel buffer pool. |
| 550 const size_t attributes_size = 3; | 550 const size_t attributes_size = 3; |
| 551 CFTypeRef keys[attributes_size] = { | 551 CFTypeRef keys[attributes_size] = { |
| 552 #if defined(WEBRTC_IOS) | 552 #if defined(WEBRTC_IOS) |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 // TODO(magjed): This function is not used by RTCVideoEncoderH264, but this whol
e file will be | 760 // TODO(magjed): This function is not used by RTCVideoEncoderH264, but this whol
e file will be |
| 761 // removed soon and inlined as ObjC. | 761 // removed soon and inlined as ObjC. |
| 762 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings() | 762 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings() |
| 763 const { | 763 const { |
| 764 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold, | 764 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold, |
| 765 internal::kHighH264QpThreshold); | 765 internal::kHighH264QpThreshold); |
| 766 } | 766 } |
| 767 } // namespace webrtc | 767 } // namespace webrtc |
| OLD | NEW |