From 8cf8e4ed5f8d50c842c14cd3ad2bd6bcb37796df Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sun, 1 Dec 2024 10:20:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2rtmp=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=B8=8D=E6=94=AF=E6=8C=81=E7=9A=84=E7=BC=96=E7=A0=81=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=97=B6=E9=A2=91=E7=B9=81=E6=89=93=E5=8D=B0=E8=AD=A6?= =?UTF-8?q?=E5=91=8A=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/Factory.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Extension/Factory.cpp b/src/Extension/Factory.cpp index 57d67132..b332db6c 100644 --- a/src/Extension/Factory.cpp +++ b/src/Extension/Factory.cpp @@ -178,8 +178,9 @@ RtmpCodec::Ptr Factory::getRtmpDecoderByTrack(const Track::Ptr &track) { RtmpCodec::Ptr Factory::getRtmpEncoderByTrack(const Track::Ptr &track) { auto it = s_plugins.find(track->getCodecId()); if (it == s_plugins.end()) { - WarnL << "Unsupported codec: " << track->getCodecName() << ", use CommonRtmpEncoder"; - return std::make_shared(track); + auto amf = Factory::getAmfByCodecId(track->getCodecId()); + WarnL << "Unsupported codec: " << track->getCodecName() << (amf ? ", use CommonRtmpEncoder" : ""); + return amf ? std::make_shared(track) : nullptr; } return it->second->getRtmpEncoderByTrack(track); }