[FFmpeg-devel] Close Thread Handle in avcodec_thread_free

Shehzad Salim shehzadsalim
Fri Aug 7 13:59:07 CEST 2009

Hi guy's

I am willing to post a patch for avcodec_thread_free.

When using multi threaded video decoding and upon closure in
avcodec_thread_free thread handle are not being closed

But I have no idea to how to create a diff file or patch file on windows OS.

Only one line is added in avcodec_thread_free function which is

void avcodec_thread_free(AVCodecContext *s){
    ThreadContext *c= s->thread_opaque;
    int i;

    for(i=0; i<s->thread_count; i++){

        c[i].func= NULL;
        ReleaseSemaphore(c[i].work_sem, 1, 0);
        WaitForSingleObject(c[i].thread, INFINITE);
        if(c[i].work_sem) CloseHandle(c[i].work_sem);
        if(c[i].done_sem) CloseHandle(c[i].done_sem);



?????? ????? ????? ???? ??????
Best Regards
Shehzad Salim

More information about the ffmpeg-devel mailing list