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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/VideoToolbox/encoder.mm

Issue 2977213002: Reland of Injectable Obj-C video codecs (Closed)
Patch Set: Hopefully fix no-video bug in duo Created 3 years, 5 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 reset 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();
jtt_webrtc 2017/07/20 02:33:20 This is not the problem. See ObjCVideoEncoder::~Ob
kthelgason 2017/07/20 11:33:51 Agreed. I still think we should make this change.
jtt_webrtc 2017/07/20 17:55:59 I'm not sure what implications this will have beca
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 756 }
757 bitrate_adjuster_.Update(frame._length); 757 bitrate_adjuster_.Update(frame._length);
758 } 758 }
759 759
760 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings() 760 VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings()
761 const { 761 const {
762 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold, 762 return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold,
763 internal::kHighH264QpThreshold); 763 internal::kHighH264QpThreshold);
764 } 764 }
765 } // namespace webrtc 765 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698