Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Enable H.265 for iOS.
Browse files Browse the repository at this point in the history
This issue also fixes some H.265 depacketizer issues for all platforms.

There are still some issues expected to be fixed later.

- H.265 only supported on iOS 11, iPhone 7 and later. Device and system
  check should be performed before calling H.265 APIs.
- Profile, tier and level are not correctly handled.
- QP is not enabled.

This change has been modified during rebasing since some C++ files already
been picked to 70-sdk branch.

Change-Id: Idf6087bae4f12432178b571ab76ab55127b66f5f
Reviewed-on: https://git-ccr-1.devtools.intel.com/gerrit/78608
Reviewed-by: Qiu, Jianlin <jianlin.qiu@intel.com>
Tested-by: Qiu, Jianlin <jianlin.qiu@intel.com>
  • Loading branch information
jianjunz committed Oct 31, 2018
1 parent 7800b5d commit 243912b
Show file tree
Hide file tree
Showing 11 changed files with 1,328 additions and 220 deletions.
189 changes: 0 additions & 189 deletions modules/rtp_rtcp/source/h265_sps_parser.cc

This file was deleted.

31 changes: 0 additions & 31 deletions modules/rtp_rtcp/source/h265_sps_parser.h

This file was deleted.

6 changes: 6 additions & 0 deletions sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,12 @@ if (is_ios || is_mac) {
"objc/Framework/Classes/PeerConnection/RTCVideoCodec+Private.h",
"objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm",
"objc/Framework/Classes/PeerConnection/RTCVideoCodecH264.mm",
"objc/Framework/Classes/PeerConnection/RTCVideoCodecH265.mm",
"objc/Framework/Classes/PeerConnection/RTCVideoEncoderSettings.mm",
"objc/Framework/Headers/WebRTC/RTCVideoCodec.h",
"objc/Framework/Headers/WebRTC/RTCVideoCodecFactory.h",
"objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h",
"objc/Framework/Headers/WebRTC/RTCVideoCodecH265.h",
]
if (is_ios) {
sources += [
Expand Down Expand Up @@ -982,6 +984,7 @@ if (is_ios || is_mac) {
"objc/Framework/Headers/WebRTC/RTCTracing.h",
"objc/Framework/Headers/WebRTC/RTCVideoCapturer.h",
"objc/Framework/Headers/WebRTC/RTCVideoCodecH264.h",
"objc/Framework/Headers/WebRTC/RTCVideoCodecH265.h",
"objc/Framework/Headers/WebRTC/RTCVideoFrame.h",
"objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h",
"objc/Framework/Headers/WebRTC/RTCVideoRenderer.h",
Expand Down Expand Up @@ -1179,7 +1182,10 @@ if (is_ios || is_mac) {
]
sources = [
"objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm",
"objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH265.mm",
"objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm",
"objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH265.mm",
"objc/Framework/Headers/WebRTC/RTCVideoFrameBuffer.h",
]

configs += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "WebRTC/RTCVideoCodec.h"

#import "WebRTC/RTCVideoCodecH264.h"
#import "WebRTC/RTCVideoCodecH265.h"

#include "api/video_codecs/sdp_video_format.h"
#include "common_video/include/video_frame.h"
Expand Down
68 changes: 68 additions & 0 deletions sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH265.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/

/* This file is borrowed from
* webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodecH265.mm */

#import "WebRTC/RTCVideoCodecH265.h"

#include <vector>

#import "RTCVideoCodec+Private.h"
#import "WebRTC/RTCVideoCodec.h"

#include "rtc_base/timeutils.h"
#include "system_wrappers/include/field_trial.h"

static NSString* kH265CodecName = @"H265";
// TODO(jianjunz): This is value is not correct.
static NSString* kLevel31Main = @"4d001f";

@implementation RTCCodecSpecificInfoH265
@end

// Encoder factory.
@implementation RTCVideoEncoderFactoryH265

- (NSArray<RTCVideoCodecInfo*>*)supportedCodecs {
NSMutableArray<RTCVideoCodecInfo*>* codecs = [NSMutableArray array];
NSString* codecName = kH265CodecName;

NSDictionary<NSString*, NSString*>* mainParams = @{
@"profile-level-id" : kLevel31Main,
@"level-asymmetry-allowed" : @"1",
@"packetization-mode" : @"1",
};
RTCVideoCodecInfo* constrainedBaselineInfo =
[[RTCVideoCodecInfo alloc] initWithName:codecName parameters:mainParams];
[codecs addObject:constrainedBaselineInfo];

return [codecs copy];
}

- (id<RTCVideoEncoder>)createEncoder:(RTCVideoCodecInfo*)info {
return [[RTCVideoEncoderH265 alloc] initWithCodecInfo:info];
}

@end

// Decoder factory.
@implementation RTCVideoDecoderFactoryH265

- (id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo*)info {
return [[RTCVideoDecoderH265 alloc] init];
}

- (NSArray<RTCVideoCodecInfo*>*)supportedCodecs {
NSString* codecName = kH265CodecName;
return @[ [[RTCVideoCodecInfo alloc] initWithName:codecName parameters:nil] ];
}

@end
Loading

0 comments on commit 243912b

Please sign in to comment.