On 26/11/11 15:33, Cheng Sun wrote:
> ---
> libavcodec/pthread.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
> index 3364376..dae28e6 100644
> --- a/libavcodec/pthread.c
> +++ b/libavcodec/pthread.c
> @@ -651,7 +651,8 @@ static void frame_thread_free(AVCodecContext *avctx,
> int thread_count)
> pthread_cond_signal(&p->input_cond);
> pthread_mutex_unlock(&p->mutex);
>
> - pthread_join(p->thread, NULL);
> + if (p->thread)
> + pthread_join(p->thread, NULL);
>
> if (codec->close)
> codec->close(p->avctx);
Revised patch to fix a compile error on windows.
---
libavcodec/pthread.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index dae28e6..17fc5c3 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -70,6 +70,7 @@ typedef struct PerThreadContext {
struct FrameThreadContext *parent;
pthread_t thread;
+ int thread_init;
pthread_cond_t input_cond; ///< Used to wait for a new packet
from the main thread.
pthread_cond_t progress_cond; ///< Used by child threads to wait
for progress to change.
pthread_cond_t output_cond; ///< Used by the main thread to
wait for frames to finish.
@@ -651,7 +652,7 @@ static void frame_thread_free(AVCodecContext *avctx,
int thread_count)
pthread_cond_signal(&p->input_cond);
pthread_mutex_unlock(&p->mutex);
- if (p->thread)
+ if (p->thread_init)
pthread_join(p->thread, NULL);
if (codec->close)
@@ -757,6 +758,7 @@ static int frame_thread_init(AVCodecContext *avctx)
if (err) goto error;
pthread_create(&p->thread, NULL, frame_worker_thread, p);
+ p->thread_init = 1;
}
return 0;
--
1.7.7.3
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel