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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc

Issue 2531823002: iOS HW encoder: Enable H264 High profile support (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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 #include "webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h" 10 #include "webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h"
11 11
12 #include "webrtc/base/logging.h" 12 #include "webrtc/base/logging.h"
13 #include "webrtc/common_video/h264/profile_level_id.h" 13 #include "webrtc/common_video/h264/profile_level_id.h"
14 #include "webrtc/media/base/codec.h" 14 #include "webrtc/media/base/codec.h"
15 #if defined(WEBRTC_IOS) 15 #if defined(WEBRTC_IOS)
16 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h" 16 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h"
17 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h" 17 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h"
18 #endif 18 #endif
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 // VideoToolboxVideoEncoderFactory 22 // VideoToolboxVideoEncoderFactory
23 23
24 VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() { 24 VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() {
25 // Hardware H264 encoding only supported on iOS for now. 25 // Hardware H264 encoding only supported on iOS for now.
26 #if defined(WEBRTC_IOS) 26 #if defined(WEBRTC_IOS)
27 // TODO(magjed): Push Constrained High profile as well when negotiation is
28 // ready, http://crbug/webrtc/6337.
29 cricket::VideoCodec constrained_baseline(cricket::kH264CodecName);
30 // TODO(magjed): Enumerate actual level instead of using hardcoded level 3.1. 27 // TODO(magjed): Enumerate actual level instead of using hardcoded level 3.1.
31 // Level 3.1 is 1280x720@30fps which is enough for now. 28 // Level 3.1 is 1280x720@30fps which is enough for now.
29 const H264::Level level = H264::kLevel3_1;
30
31 cricket::VideoCodec constrained_high(cricket::kH264CodecName);
32 const H264::ProfileLevelId constrained_high_profile(
33 H264::kProfileConstrainedHigh, level);
34 constrained_high.SetParam(
35 cricket::kH264FmtpProfileLevelId,
36 *H264::ProfileLevelIdToString(constrained_high_profile));
37 constrained_high.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1");
38 constrained_high.SetParam(cricket::kH264FmtpPacketizationMode, "1");
39 supported_codecs_.push_back(constrained_high);
40
41 cricket::VideoCodec constrained_baseline(cricket::kH264CodecName);
32 const H264::ProfileLevelId constrained_baseline_profile( 42 const H264::ProfileLevelId constrained_baseline_profile(
33 H264::kProfileConstrainedBaseline, H264::kLevel3_1); 43 H264::kProfileConstrainedBaseline, level);
34 constrained_baseline.SetParam( 44 constrained_baseline.SetParam(
35 cricket::kH264FmtpProfileLevelId, 45 cricket::kH264FmtpProfileLevelId,
36 *H264::ProfileLevelIdToString(constrained_baseline_profile)); 46 *H264::ProfileLevelIdToString(constrained_baseline_profile));
37 constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); 47 constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1");
38 constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1"); 48 constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1");
39 supported_codecs_.push_back(constrained_baseline); 49 supported_codecs_.push_back(constrained_baseline);
40 #endif 50 #endif
41 } 51 }
42 52
43 VideoToolboxVideoEncoderFactory::~VideoToolboxVideoEncoderFactory() {} 53 VideoToolboxVideoEncoderFactory::~VideoToolboxVideoEncoderFactory() {}
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 107
98 void VideoToolboxVideoDecoderFactory::DestroyVideoDecoder( 108 void VideoToolboxVideoDecoderFactory::DestroyVideoDecoder(
99 VideoDecoder* decoder) { 109 VideoDecoder* decoder) {
100 #if defined(WEBRTC_IOS) 110 #if defined(WEBRTC_IOS)
101 delete decoder; 111 delete decoder;
102 decoder = nullptr; 112 decoder = nullptr;
103 #endif 113 #endif
104 } 114 }
105 115
106 } // namespace webrtc 116 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698