Enable VideoToolbox encoder on mac
BUG=webrtc:6317 Review-Url: https://codereview.webrtc.org/2532983006 Cr-Commit-Position: refs/heads/master@{#15348}
This commit is contained in:
parent
024c90ed90
commit
a974d76c74
@ -176,6 +176,10 @@ if (is_ios || is_mac) {
|
||||
"objc/Framework/Headers/WebRTC/RTCVideoTrack.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":webrtc_h264_video_toolbox",
|
||||
]
|
||||
|
||||
if (is_ios) {
|
||||
sources += [
|
||||
"objc/Framework/Classes/RTCEAGLVideoView.m",
|
||||
@ -188,9 +192,6 @@ if (is_ios || is_mac) {
|
||||
"OpenGLES.framework",
|
||||
"QuartzCore.framework",
|
||||
]
|
||||
deps = [
|
||||
":webrtc_h264_video_toolbox",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
@ -202,7 +203,6 @@ if (is_ios || is_mac) {
|
||||
"CoreMedia.framework",
|
||||
"OpenGL.framework",
|
||||
]
|
||||
deps = []
|
||||
}
|
||||
|
||||
configs += [
|
||||
|
||||
@ -12,18 +12,14 @@
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/common_video/h264/profile_level_id.h"
|
||||
#include "webrtc/media/base/codec.h"
|
||||
#if defined(WEBRTC_IOS)
|
||||
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h"
|
||||
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h"
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// VideoToolboxVideoEncoderFactory
|
||||
|
||||
VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() {
|
||||
// Hardware H264 encoding only supported on iOS for now.
|
||||
#if defined(WEBRTC_IOS)
|
||||
// TODO(magjed): Enumerate actual level instead of using hardcoded level 3.1.
|
||||
// Level 3.1 is 1280x720@30fps which is enough for now.
|
||||
const H264::Level level = H264::kLevel3_1;
|
||||
@ -47,29 +43,24 @@ VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() {
|
||||
constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1");
|
||||
constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1");
|
||||
supported_codecs_.push_back(constrained_baseline);
|
||||
#endif
|
||||
}
|
||||
|
||||
VideoToolboxVideoEncoderFactory::~VideoToolboxVideoEncoderFactory() {}
|
||||
|
||||
VideoEncoder* VideoToolboxVideoEncoderFactory::CreateVideoEncoder(
|
||||
const cricket::VideoCodec& codec) {
|
||||
#if defined(WEBRTC_IOS)
|
||||
if (FindMatchingCodec(supported_codecs_, codec)) {
|
||||
LOG(LS_INFO) << "Creating HW encoder for " << codec.name;
|
||||
return new H264VideoToolboxEncoder(codec);
|
||||
}
|
||||
#endif
|
||||
LOG(LS_INFO) << "No HW encoder found for codec " << codec.name;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoToolboxVideoEncoderFactory::DestroyVideoEncoder(
|
||||
VideoEncoder* encoder) {
|
||||
#if defined(WEBRTC_IOS)
|
||||
delete encoder;
|
||||
encoder = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::vector<cricket::VideoCodec>&
|
||||
@ -80,9 +71,7 @@ VideoToolboxVideoEncoderFactory::supported_codecs() const {
|
||||
// VideoToolboxVideoDecoderFactory
|
||||
|
||||
VideoToolboxVideoDecoderFactory::VideoToolboxVideoDecoderFactory() {
|
||||
#if defined(WEBRTC_IOS)
|
||||
supported_codecs_.push_back(cricket::VideoCodec("H264"));
|
||||
#endif
|
||||
}
|
||||
|
||||
VideoToolboxVideoDecoderFactory::~VideoToolboxVideoDecoderFactory() {}
|
||||
@ -95,22 +84,18 @@ VideoDecoder* VideoToolboxVideoDecoderFactory::CreateVideoDecoder(
|
||||
return nullptr;
|
||||
}
|
||||
const cricket::VideoCodec codec(*codec_name);
|
||||
#if defined(WEBRTC_IOS)
|
||||
if (FindMatchingCodec(supported_codecs_, codec)) {
|
||||
LOG(LS_INFO) << "Creating HW decoder for " << codec.name;
|
||||
return new H264VideoToolboxDecoder();
|
||||
}
|
||||
#endif
|
||||
LOG(LS_INFO) << "No HW decoder found for codec " << codec.name;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoToolboxVideoDecoderFactory::DestroyVideoDecoder(
|
||||
VideoDecoder* decoder) {
|
||||
#if defined(WEBRTC_IOS)
|
||||
delete decoder;
|
||||
decoder = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user