WebRTC支持H264笔记

环境 Ubuntu16.04 

版本 WebRTC m84 

1、修改代码

  vi  third_party/ffmpeg/chromium/config/Chromium/linux/x64/libavcodec/parser_list.c

static const AVCodecParser * const parser_list[] = {
    &ff_flac_parser,
    &ff_mpegaudio_parser,
    &ff_opus_parser,
    &ff_vorbis_parser,
    &ff_vp3_parser,
    &ff_vp8_parser,
    &ff_vp9_parser,
    &ff_h264_parser,
    NULL };

vi third_party/ffmpeg/chromium/config/Chromium/linux/x64/libavcodec/codec_list.c 

static const AVCodec * const codec_list[] = {
    &ff_theora_decoder,
    &ff_vp3_decoder,
    &ff_vp8_decoder,
    &ff_flac_decoder,
    &ff_mp3_decoder,
    &ff_vorbis_decoder,
    &ff_pcm_alaw_decoder,
    &ff_pcm_f32le_decoder,
    &ff_pcm_mulaw_decoder,
    &ff_pcm_s16be_decoder,
    &ff_pcm_s16le_decoder,
    &ff_pcm_s24be_decoder,
    &ff_pcm_s24le_decoder,
    &ff_pcm_s32le_decoder,
    &ff_pcm_u8_decoder,
    &ff_libopus_decoder,
    &ff_h264_decoder,
    NULL };

vi media/engine/internal_encoder_factory.cc 


std::vector<SdpVideoFormat> InternalEncoderFactory::SupportedFormats() {
  std::vector<SdpVideoFormat> supported_codecs;
  for (const webrtc::SdpVideoFormat& format : webrtc::SupportedH264Codecs())
    supported_codecs.push_back(format);
/*   supported_codecs.push_back(SdpVideoFormat(cricket::kVp8CodecName));
     for (const webrtc::SdpVideoFormat& format : webrtc::SupportedVP9Codecs())
     supported_codecs.push_back(format);
 if (kIsLibaomAv1EncoderSupported)
    supported_codecs.push_back(SdpVideoFormat(cricket::kAv1CodecName));*/
  return supported_codecs;
}

vi src/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.h

#define CONFIG_H264_DECODER 1

2、编译选项支持

gn gen out/h264Debug --args="proprietary_codecs=true rtc_use_h264=true use_openh264=true ffmpeg_branding=\"Chrome\""

3、调试结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值