Skip to content

Commit 1b36403

Browse files
author
Clement Champetier
committed
VideoProperties: fix ghost threads when call analyseGopStructure
* Close the AVCodecContext at the end of the method. * Fix #181
1 parent 54043f7 commit 1b36403

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/AvTranscoder/properties/VideoProperties.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,16 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
490490
_codecContext->skip_frame = AVDISCARD_NONE;
491491

492492
AVPacket pkt;
493+
av_init_packet(&pkt);
493494

495+
// Allocate frame
494496
#if LIBAVCODEC_VERSION_MAJOR > 54
495497
AVFrame* frame = av_frame_alloc();
496498
#else
497499
AVFrame* frame = avcodec_alloc_frame();
498500
#endif
499501

500-
av_init_packet(&pkt);
502+
// Initialize the AVCodecContext to use the given AVCodec
501503
avcodec_open2(_codecContext, _codec, NULL);
502504

503505
int count = 0;
@@ -531,6 +533,11 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
531533
if(stopAnalyse)
532534
break;
533535
}
536+
537+
// Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext itself)
538+
avcodec_close(_codecContext);
539+
540+
// Free frame
534541
#if LIBAVCODEC_VERSION_MAJOR > 54
535542
av_frame_free(&frame);
536543
#else

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