Cook WebRTC

WEbRTC Android FFmpeg软解报错 H264解码

2023-04-18  本文已影响0人  devzhaoyou

报错:

  const AVCodec* codec = avcodec_find_decoder(av_context_->codec_id);
  if (!codec) {
    // This is an indication that FFmpeg has not been initialized or it has not
    // been compiled/initialized with the correct set of codecs.
    RTC_LOG(LS_ERROR) << "FFmpeg H.264 decoder not found.";
    Release();
    ReportError();
    return false;
  }

增加编译参数 rtc_use_h264=true 不管用!

修改 ffmpeg_generated.gni

找到third_party/ffmpeg/ffmpeg_generated.gni
use_linux_config,添加 || is_android以支持,结果如下

use_linux_config = is_linux || is_fuchsia || is_android

增加 codec_list parser_list h264 支持

修改 arm64, 相应的armv7的改相应目录即可

chromium/config/Chrome/android/arm64/config.h 中 CONFIG_H264_DECODER 设置为 1
third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavcodec/parser_list.c 添加 &ff_h264_parser,
third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavcodec/codec_list.c 添加 &ff_h264_decoder,

编译参数添加 rtc_use_h264=true ffmpeg_branding="Chrome"

上一篇下一篇

猜你喜欢

热点阅读