Move list of supported H264 codecs from InternalEncoderFactory to h264.h
This CL is a clean-up to prepare for adding more supported codecs for the internal H264 SW codec. Bug: webrtc:8317 Change-Id: If483d05c01c40bbc81cbd1a6aad89961689714ef Reviewed-on: https://webrtc-review.googlesource.com/4940 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20105}
This commit is contained in:
committed by
Commit Bot
parent
3c0bbff27c
commit
849b3aeb71
@ -188,6 +188,7 @@ rtc_static_library("webrtc_h264") {
|
||||
defines = []
|
||||
deps = [
|
||||
":video_coding_utility",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../media:rtc_media_base",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"../../system_wrappers",
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
#include "modules/video_coding/codecs/h264/include/h264.h"
|
||||
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
|
||||
#if defined(WEBRTC_USE_H264)
|
||||
#include "modules/video_coding/codecs/h264/h264_decoder_impl.h"
|
||||
#include "modules/video_coding/codecs/h264/h264_encoder_impl.h"
|
||||
@ -27,6 +29,15 @@ namespace {
|
||||
bool g_rtc_use_h264 = true;
|
||||
#endif
|
||||
|
||||
// If any H.264 codec is supported (iOS HW or OpenH264/FFmpeg).
|
||||
bool IsH264CodecSupported() {
|
||||
#if defined(WEBRTC_USE_H264)
|
||||
return g_rtc_use_h264;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void DisableRtcUseH264() {
|
||||
@ -35,13 +46,18 @@ void DisableRtcUseH264() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// If any H.264 codec is supported (iOS HW or OpenH264/FFmpeg).
|
||||
bool IsH264CodecSupported() {
|
||||
#if defined(WEBRTC_USE_H264)
|
||||
return g_rtc_use_h264;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
std::vector<SdpVideoFormat> SupportedH264Codecs() {
|
||||
if (!IsH264CodecSupported())
|
||||
return std::vector<SdpVideoFormat>();
|
||||
std::vector<SdpVideoFormat> codecs;
|
||||
|
||||
codecs.push_back(SdpVideoFormat(
|
||||
cricket::kH264CodecName, {{cricket::kH264FmtpProfileLevelId,
|
||||
cricket::kH264ProfileLevelConstrainedBaseline},
|
||||
{cricket::kH264FmtpLevelAsymmetryAllowed, "1"},
|
||||
{cricket::kH264FmtpPacketizationMode, "1"}}));
|
||||
|
||||
return codecs;
|
||||
}
|
||||
|
||||
H264Encoder* H264Encoder::Create(const cricket::VideoCodec& codec) {
|
||||
|
||||
@ -12,17 +12,25 @@
|
||||
#ifndef MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
|
||||
#define MODULES_VIDEO_CODING_CODECS_H264_INCLUDE_H264_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "media/base/codec.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
struct SdpVideoFormat;
|
||||
|
||||
// Set to disable the H.264 encoder/decoder implementations that are provided if
|
||||
// |rtc_use_h264| build flag is true (if false, this function does nothing).
|
||||
// This function should only be called before or during WebRTC initialization
|
||||
// and is not thread-safe.
|
||||
void DisableRtcUseH264();
|
||||
|
||||
// Returns a vector with all supported internal H264 profiles that we can
|
||||
// negotiate in SDP, in order of preference.
|
||||
std::vector<SdpVideoFormat> SupportedH264Codecs();
|
||||
|
||||
class H264Encoder : public VideoEncoder {
|
||||
public:
|
||||
static H264Encoder* Create(const cricket::VideoCodec& codec);
|
||||
|
||||
Reference in New Issue
Block a user