OSDN Git Service

Merge commit 'd15368ee3926152a3a301c13cc638fbf7a062ddf'
authorHendrik Leppkes <h.leppkes@gmail.com>
Wed, 14 Oct 2015 21:06:06 +0000 (23:06 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Wed, 14 Oct 2015 21:06:06 +0000 (23:06 +0200)
* commit 'd15368ee3926152a3a301c13cc638fbf7a062ddf':
  h264: Run VLC init under pthread_once

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
libavcodec/h264.c
libavcodec/h264.h

@@@ -657,15 -621,15 +659,19 @@@ av_cold int ff_h264_decode_init(AVCodec
      if (!avctx->has_b_frames)
          h->low_delay = 1;
  
-     ff_h264_decode_init_vlc();
+     ret = ff_thread_once(&h264_vlc_init, ff_h264_decode_init_vlc);
+     if (ret != 0) {
+         av_log(avctx, AV_LOG_ERROR, "pthread_once has failed.");
+         return AVERROR_UNKNOWN;
+     }
  
      if (avctx->codec_id == AV_CODEC_ID_H264) {
 -        if (avctx->ticks_per_frame == 1)
 -            h->avctx->framerate.num *= 2;
 +        if (avctx->ticks_per_frame == 1) {
 +            if(h->avctx->time_base.den < INT_MAX/2) {
 +                h->avctx->time_base.den *= 2;
 +            } else
 +                h->avctx->time_base.num /= 2;
 +        }
          avctx->ticks_per_frame = 2;
      }
  
Simple merge