need to copy parameters to codecpar
This commit is contained in:
parent
16662f79ce
commit
a440ab3ef0
|
@ -350,7 +350,7 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const {
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
||||||
AVCodecContext *codec_context = avcodec_alloc_context3(nullptr);
|
AVCodecContext *codec_context = avcodec_alloc_context3(nullptr);
|
||||||
avcodec_parameters_to_context(codec_context, stream->codecpar);
|
//avcodec_parameters_to_context(codec_context, stream->codecpar);
|
||||||
stream->codec = codec_context;
|
stream->codec = codec_context;
|
||||||
#else
|
#else
|
||||||
AVCodecContext *codec_context = stream->codec;
|
AVCodecContext *codec_context = stream->codec;
|
||||||
|
@ -376,9 +376,6 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const {
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
Warning("Unknown media_type %s", type.c_str());
|
Warning("Unknown media_type %s", type.c_str());
|
||||||
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
|
||||||
stream->codecpar->codec_type = codec_context->codec_type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
|
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
|
||||||
std::string codec_name;
|
std::string codec_name;
|
||||||
|
@ -417,6 +414,7 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const {
|
||||||
}
|
}
|
||||||
} /// end if static or dynamic
|
} /// end if static or dynamic
|
||||||
|
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
|
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
|
||||||
if ( codec_name.empty() )
|
if ( codec_name.empty() )
|
||||||
#else
|
#else
|
||||||
|
@ -425,7 +423,6 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const {
|
||||||
{
|
{
|
||||||
Warning( "Can't find payload details for %s payload type %d, name %s",
|
Warning( "Can't find payload details for %s payload type %d, name %s",
|
||||||
mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() );
|
mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() );
|
||||||
//return( 0 );
|
|
||||||
}
|
}
|
||||||
if ( mediaDesc->getWidth() )
|
if ( mediaDesc->getWidth() )
|
||||||
codec_context->width = mediaDesc->getWidth();
|
codec_context->width = mediaDesc->getWidth();
|
||||||
|
@ -493,7 +490,10 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0)
|
||||||
|
avcodec_parameters_from_context(stream->codecpar, codec_context);
|
||||||
|
#endif
|
||||||
|
} // end foreach mediaList
|
||||||
|
|
||||||
return formatContext;
|
return formatContext;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue