支持创建不支持codec的frame (#3126)

This commit is contained in:
PioLing 2023-12-14 14:14:50 +08:00 committed by GitHub
parent 9933398614
commit 07f3c6dde4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,8 +197,8 @@ AMFValue Factory::getAmfByCodecId(CodecId codecId) {
Frame::Ptr Factory::getFrameFromPtr(CodecId codec, const char *data, size_t bytes, uint64_t dts, uint64_t pts) { Frame::Ptr Factory::getFrameFromPtr(CodecId codec, const char *data, size_t bytes, uint64_t dts, uint64_t pts) {
auto it = s_plugins.find(codec); auto it = s_plugins.find(codec);
if (it == s_plugins.end()) { if (it == s_plugins.end()) {
WarnL << "Unsupported codec: " << getCodecName(codec); // 创建不支持codec的frame
return nullptr; return std::make_shared<FrameFromPtr>(codec, (char *)data, bytes, dts, pts);
} }
return it->second->getFrameFromPtr(data, bytes, dts, pts); return it->second->getFrameFromPtr(data, bytes, dts, pts);
} }