Roland,

I have tested this patch locally with a H.264 movie trailer, and it causes lots of errors on the console like these:

[h264 @ 0xb23be360] AVC: nal size 1891941506
[h264 @ 0xb23be360] AVC: nal size 1891941506
[h264 @ 0xb23be360] no frame!
[h264 @ 0xb23796e0] AVC: nal size 1144403958
[h264 @ 0xb23796e0] AVC: nal size 1144403958
[h264 @ 0xb23796e0] no frame!
[h264 @ 0xb23be360] AVC: nal size 806848447
[h264 @ 0xb23be360] AVC: nal size 806848447
[h264 @ 0xb23be360] no frame!
[h264 @ 0xb23796e0] AVC: nal size -897927973
[h264 @ 0xb23796e0] AVC: nal size -897927973
[h264 @ 0xb23796e0] no frame!
[h264 @ 0xb23be360] AVC: nal size -1555011007
[h264 @ 0xb23be360] AVC: nal size -1555011007
[h264 @ 0xb23be360] no frame!

The trailer seems to play without any artifacts, except that xine complains that it is dropping too many frames. Without the patch, the trailer plays fine.

I am testing on a box with two physical CPUs, and with the following line in my .xine/config file:

video.processing.ffmpeg_thread_count:2

Cheers,
Chris


From: Roland Scheidegger <rscheidegger_lists@hispeed.ch>
To: xine-devel@lists.sourceforge.net
Sent: Wednesday, 21 December 2011, 20:39
Subject: [xine-devel] [PATCH] Fix multithreaded initialization with API change

# HG changeset patch
# User Roland Scheidegger <rscheidegger_lists@hispeed.ch>
# Date 1324499001 -3600
# Node ID 58e9f9c91a0eebada08912e0a14c2deaaab917d7
# Parent  dc1a30e82601af99013a3ed6b74310753790f969
Fix multithreaded initialization with API change

thread count needs to be set before avcodec_open otherwise it will be stuck
with a single thread at least for h264 (might also want to use avcodec_open2
instead?)

diff -r dc1a30e82601 -r 58e9f9c91a0e src/combined/ffmpeg/ff_video_decoder.c
--- a/src/combined/ffmpeg/ff_video_decoder.c    Thu Dec 15 16:07:46 2011 +0200
+++ b/src/combined/ffmpeg/ff_video_decoder.c    Wed Dec 21 21:23:21 2011 +0100
@@ -329,6 +329,13 @@
  if (this->class->choose_speed_over_accuracy)
    this->context->flags2 |= CODEC_FLAG2_FAST;

+#ifdef DEPRECATED_AVCODEC_THREAD_INIT
+  if (this->class->thread_count > 1) {
+    if (this->codec->id != CODEC_ID_SVQ3)
+      this->context->thread_count = this->class->thread_count;
+  }
+#endif
+
  pthread_mutex_lock(&ffmpeg_lock);
  if (avcodec_open (this->context, this->codec) < 0) {
    pthread_mutex_unlock(&ffmpeg_lock);
@@ -356,14 +363,13 @@
    }
  }

+#ifndef DEPRECATED_AVCODEC_THREAD_INIT
  if (this->class->thread_count > 1) {
    if (this->codec->id != CODEC_ID_SVQ3
-#ifndef DEPRECATED_AVCODEC_THREAD_INIT
-    && avcodec_thread_init(this->context, this->class->thread_count) != -1
-#endif
-    )
+    && avcodec_thread_init(this->context, this->class->thread_count) != -1)
      this->context->thread_count = this->class->thread_count;
  }
+#endif

  this->context->skip_loop_filter =
skip_loop_filter_enum_values[this->class->skip_loop_filter_enum];


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
xine-devel mailing list
xine-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-devel