Skip to content

Commit b030fd3

Browse files
committed
Set decoder context time base
1 parent 0f4a066 commit b030fd3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/AvTranscoder/stream/InputStream.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ InputStream::InputStream(InputFile& inputFile, const size_t streamIndex)
2121
, _streamIndex(streamIndex)
2222
, _isActivated(false)
2323
{
24-
AVCodecParameters* codecParameters = _inputFile->getFormatContext().getAVStream(_streamIndex).codecpar;
24+
AVStream& avStream = _inputFile->getFormatContext().getAVStream(_streamIndex);
25+
AVCodecParameters* codecParameters = avStream.codecpar;
26+
2527
const AVCodec* codec = avcodec_find_decoder(codecParameters->codec_id);
2628
AVCodecContext* context = avcodec_alloc_context3(codec);
29+
2730
int ret = avcodec_parameters_to_context(context, codecParameters);
31+
context->time_base = avStream.time_base;
2832

2933
if (ret < 0)
3034
throw std::runtime_error("Failed to copy decoder parameters to input stream context");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy