mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
streaminfo2: fix segfault with unknown media_type
Origin commit data
------------------
Commit: c60990407b
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2020-02-17 (Mon, 17 Feb 2020)
This commit is contained in:
@@ -183,11 +183,13 @@ void CStreamInfo2::analyzeStream(AVFormatContext *avfc, unsigned int idx)
|
|||||||
size_t pos = m["codec"].find_first_of(":");
|
size_t pos = m["codec"].find_first_of(":");
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
m["codec"] = m["codec"].erase(0, pos + 2);
|
m["codec"] = m["codec"].erase(0, pos + 2);
|
||||||
|
|
||||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||||
m["codec_type"] = av_get_media_type_string(st->codecpar->codec_type);
|
std::string codecType = av_get_media_type_string(st->codecpar->codec_type) ? av_get_media_type_string(st->codecpar->codec_type):"unknown";
|
||||||
#else
|
#else
|
||||||
m["codec_type"] = av_get_media_type_string(st->codec->codec_type);
|
std::string codecType = av_get_media_type_string(st->codec->codec_type) ? av_get_media_type_string(st->codec->codec_type):"unknown";
|
||||||
#endif
|
#endif
|
||||||
|
m["codec_type"] = codecType;
|
||||||
m["codec_type"][0] ^= 'a' ^ 'A';
|
m["codec_type"][0] ^= 'a' ^ 'A';
|
||||||
|
|
||||||
m["pid"] = to_string(st->id);
|
m["pid"] = to_string(st->id);
|
||||||
|
Reference in New Issue
Block a user