After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 606265 - H263 crashes ekiga - bug in ffmpeg?
H263 crashes ekiga - bug in ffmpeg?
Status: RESOLVED NOTGNOME
Product: ekiga
Classification: Applications
Component: general
3.2.x
Other All
: Normal critical
: ---
Assigned To: Ekiga maintainers
Ekiga maintainers
Depends on:
Blocks:
 
 
Reported: 2010-01-06 21:56 UTC by olivier.poupel
Modified: 2011-07-27 10:59 UTC
See Also:
GNOME target: ---
GNOME version: 2.27/2.28



Description olivier.poupel 2010-01-06 21:56:41 UTC
Version: 3.2.6

What were you doing when the application crashed?
Appel vers "Test echo"



Distribution: Mandriva Linux release 2010.0 (Official) for i586
Gnome Release: 2.28.0 2009-12-16 (Mandriva)
BugBuddy Version: 2.28.0

System: Linux 2.6.31.6-desktop586-1mnb #1 SMP Tue Dec 8 15:43:31 EST 2009 i686
X Vendor: The X.Org Foundation
X Vendor Release: 10605000
Selinux: No
Accessibility: Disabled
GTK+ Theme: Ia Ora Steel
Icon Theme: gnome
GTK+ Modules: canberra-gtk-module, gnomebreakpad

Memory status: size: 208257024 vsize: 208257024 resident: 40349696 share: 26791936 rss: 40349696 rss_rlim: 18446744073709551615
CPU usage: start_time: 1262814852 rtime: 134 utime: 117 stime: 17 cutime:0 cstime: 0 timeout: 0 it_real_value: 0 frequency: 100

Backtrace was generated from '/usr/bin/ekiga'

[Thread debugging using libthread_db enabled]
[New Thread 0xb4fb5910 (LWP 15827)]
[New Thread 0xab732b70 (LWP 16261)]
[New Thread 0xab808b70 (LWP 16260)]
[New Thread 0xab849b70 (LWP 16259)]
[New Thread 0xab88ab70 (LWP 16258)]
[New Thread 0xab8cbb70 (LWP 16257)]
[New Thread 0xb19b7b70 (LWP 16250)]
[New Thread 0xb119eb70 (LWP 16249)]
[New Thread 0xb3d4ab70 (LWP 15946)]
[New Thread 0xb3d8bb70 (LWP 15945)]
[New Thread 0xb3bffb70 (LWP 15853)]
[New Thread 0xb3378b70 (LWP 15846)]
[New Thread 0xb3b79b70 (LWP 15843)]
[New Thread 0xb3dccb70 (LWP 15839)]
[New Thread 0xb3e0db70 (LWP 15838)]
[New Thread 0xb3e4eb70 (LWP 15836)]
[New Thread 0xb3e8fb70 (LWP 15831)]
[New Thread 0xb3ed0b70 (LWP 15830)]
[New Thread 0xb3f11b70 (LWP 15829)]
0xffffe430 in __kernel_vsyscall ()

Thread 3 (Thread 0xab808b70 (LWP 16260))

  • #0 __kernel_vsyscall
  • #1 waitpid
    from /lib/i686/libpthread.so.0
  • #2 g_spawn_sync
    from /usr/lib/libglib-2.0.so.0
  • #3 g_spawn_command_line_sync
    from /usr/lib/libglib-2.0.so.0
  • #4 ??
    from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
  • #5 ??
    from /usr/lib/gtk-2.0/modules/libgnomebreakpad.so
  • #6 <signal handler called>
  • #7 ??
    from /usr/lib/libavcodec.so
  • #8 ff_epzs_motion_search
    from /usr/lib/libavcodec.so
  • #9 ff_estimate_p_frame_motion
    from /usr/lib/libavcodec.so
  • #10 ??
    from /usr/lib/libavcodec.so
  • #11 avcodec_default_execute
    from /usr/lib/libavcodec.so
  • #12 MPV_encode_picture
    from /usr/lib/libavcodec.so
  • #13 avcodec_encode_video
    from /usr/lib/libavcodec.so
  • #14 FFMPEGLibrary::AvcodecEncodeVideo
    from /usr/lib/opal-3.6.6/codecs/video/h263-1998_video_pwplugin.so
  • #15 H263_RFC2429_EncoderContext::EncodeFrames
    from /usr/lib/opal-3.6.6/codecs/video/h263-1998_video_pwplugin.so
  • #16 codec_encoder
    from /usr/lib/opal-3.6.6/codecs/video/h263-1998_video_pwplugin.so
  • #17 OpalPluginTranscoder::Transcode
    from /usr/lib/libopal.so.3.6.6
  • #18 OpalPluginVideoTranscoder::ConvertFrames
    from /usr/lib/libopal.so.3.6.6
  • #19 OpalMediaPatch::Sink::WriteFrame
    from /usr/lib/libopal.so.3.6.6
  • #20 OpalMediaPatch::DispatchFrame
    from /usr/lib/libopal.so.3.6.6
  • #21 OpalMediaPatch::Main
    from /usr/lib/libopal.so.3.6.6
  • #22 OpalMediaPatch::Thread::Main
    from /usr/lib/libopal.so.3.6.6
  • #23 PThread::PX_ThreadStart
    from /usr/lib/libpt.so.2.6.5
  • #24 start_thread
    from /lib/i686/libpthread.so.0
  • #25 clone
    from /lib/i686/libc.so.6

Comment 1 Akhil Laddha 2010-01-07 04:00:53 UTC
Thanks for taking the time to report this bug.
Unfortunately, that stack trace is missing some elements that will help a lot
to solve the problem, so it will be hard for the developers to fix that crash.
Could you please install some debugging packages [1], start the application as
normal, and reproduce the crash, if possible?

Once bug-buddy pops up, you can find the stacktrace in the Details, now
containing way more information. Please copy that stacktrace and paste it as a
comment here. Thanks in advance!

[1] More details can be found here:
http://live.gnome.org/GettingTraces
Comment 2 olivier.poupel 2010-01-10 20:24:15 UTC
More details on the problem:

It happens when I call "echo" number with the video capability H263-1998. With H264 or H263 or Theora, it works fine.
Comment 3 olivier.poupel 2010-01-10 20:34:19 UTC
(In reply to comment #1)
> Thanks for taking the time to report this bug.
> Unfortunately, that stack trace is missing some elements that will help a lot
> to solve the problem, so it will be hard for the developers to fix that crash.
> Could you please install some debugging packages [1], start the application as
> normal, and reproduce the crash, if possible?
> 
> Once bug-buddy pops up, you can find the stacktrace in the Details, now
> containing way more information. Please copy that stacktrace and paste it as a
> comment here. Thanks in advance!
> 
> [1] More details can be found here:
> http://live.gnome.org/GettingTraces

I have compiled Ekiga from the sources (Ptlib, Opal and Ekiga) to have more codecs than the one provided by the my distribution version.

Do you want me to rebuild ptlib, opal and ekiga with debug flag ? If yes, can you tell me exactly which configure flags you want:

 --enable-debug for opal ?
 --enable-gtk-debug --enable-opal-debug for Ekiga ?

I did not find any debug flags for ptlib ...

Olivier
Comment 4 Eugen Dedu 2010-01-11 17:33:06 UTC
It seems to me this is a bug in libavcodec:

Thread 3:
[...]
  • #7 ??
    from /usr/lib/libavcodec.so
  • #8 ff_epzs_motion_search
    from /usr/lib/libavcodec.so
  • #9 ff_estimate_p_frame_motion
    from /usr/lib/libavcodec.so
  • #10 ??
    from /usr/lib/libavcodec.so

I had not time to analyse it.

Reporter, could you install libavcodec dbg package and check in ff_epzs_motion_search function where exactly it crashes (by adding printf for ex.)?
Comment 5 Eugen Dedu 2010-01-19 14:22:05 UTC
Olivier, could you please update libavcodec and libx264 packages to latest unstable versions (tell us what version), recompile opal (make clean before !) and re-send us the stack trace?

Is it also possible to test ekiga and H263 on a 64 bits machine?
Comment 6 Eugen Dedu 2010-01-19 17:43:10 UTC
I have finally obtained a detailed backtrace of the crash.  It appears in ffmpeg.  See https://roundup.ffmpeg.org/roundup/ffmpeg/issue1700 for more information.  Closing bug as notgnome.
Comment 7 Eugen Dedu 2011-01-24 14:02:14 UTC
Reopening, so that people can see it, and until the issue is settled.

For reference, some parts of this patch have been committed to opal.  Patch from Guido Trentalancia.

diff -pruN opal-3.8.3/plugins/video/H.263-1998/h263-1998.cxx opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.263-1998/h263-1998.cxx
--- opal-3.8.3/plugins/video/H.263-1998/h263-1998.cxx	2010-12-20 23:42:42.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.263-1998/h263-1998.cxx	2011-01-21 06:26:16.283344061 +0100
@@ -221,7 +221,7 @@ H263_Base_EncoderContext::H263_Base_Enco
 
 H263_Base_EncoderContext::~H263_Base_EncoderContext()
 {
-  free(_inputFrameBuffer);
+  if (_inputFrameBuffer) free(_inputFrameBuffer);
 }
 
 bool H263_Base_EncoderContext::Open(CodecID codecId)
@@ -517,8 +517,8 @@ H263_RFC2190_EncoderContext::~H263_RFC21
 
   CloseCodec();
 
-  av_free(_context);
-  av_free(_inputFrame);
+  if (_context) av_free(_context);
+  if (_inputFrame) av_free(_inputFrame);
 
   TRACE_AND_LOG(tracer, 3, "encoder closed");
 }
@@ -770,8 +770,8 @@ H263_RFC2429_EncoderContext::~H263_RFC24
   if (_txH263PFrame)
     delete _txH263PFrame;
 
-  av_free(_context);
-  av_free(_inputFrame);
+  if (_context) av_free(_context);
+  if (_inputFrame) av_free(_inputFrame);
 
   TRACE_AND_LOG(tracer, 3, "encoder closed");
 }
@@ -951,8 +951,8 @@ H263_Base_DecoderContext::~H263_Base_Dec
 {
   CloseCodec();
 
-  av_free(_context);
-  av_free(_outputFrame);
+  if (_context) av_free(_context);
+  if (_outputFrame) av_free(_outputFrame);
 }
 
 bool H263_Base_DecoderContext::OpenCodec()
@@ -1315,7 +1315,7 @@ static int free_codec_options ( const st
   char ** strings = (char **) parm;
   for (char ** string = strings; *string != NULL; string++)
     free(*string);
-  free(strings);
+  if (strings) free(strings);
   return 1;
 }
 
@@ -1360,7 +1360,12 @@ static int codec_encoder(const struct Pl
                                    unsigned int * flag)
 {
   H263_Base_EncoderContext * context = (H263_Base_EncoderContext *)_context;
-  return context->EncodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag);
+  if (context)
+	return context->EncodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag);
+  else {
+	TRACE_AND_LOG(tracer, 1, "Context for the encoder has not been initialised !");
+	return 0;
+  }
 }
 
 #define PMAX(a,b) ((a)>=(b)?(a):(b))
@@ -1590,7 +1595,7 @@ static int encoder_set_options(const Plu
                                unsigned * parmLen)
 {
   H263_Base_EncoderContext * context = (H263_Base_EncoderContext *)_context;
-  if (parmLen == NULL || *parmLen != sizeof(const char **) || parm == NULL)
+  if (parmLen == NULL || *parmLen != sizeof(const char **) || parm == NULL || context == NULL)
     return 0;
 
   context->Lock();
@@ -1678,7 +1683,12 @@ static int codec_decoder(const struct Pl
                                    unsigned int * flag)
 {
   H263_Base_DecoderContext * context = (H263_Base_DecoderContext *)_context;
-  return context->DecodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag) ? 1 : 0;
+  if (context)
+	context->DecodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag) ? 1 : 0;
+  else {
+        TRACE_AND_LOG(tracer, 1, "Context for the decoder has not been initialised !");
+        return 0;
+  }
 }
 
 static int decoder_get_output_data_size(const PluginCodec_Definition * codec, void *, const char *, void *, unsigned *)
diff -pruN opal-3.8.3/plugins/video/H.264/h264-x264.h opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.264/h264-x264.h
--- opal-3.8.3/plugins/video/H.264/h264-x264.h	2010-12-20 23:42:42.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.264/h264-x264.h	2011-01-21 06:11:44.545191085 +0100
@@ -54,7 +54,10 @@
 
 #include "shared/h264frame.h"
 
-
+#ifndef INT64_C
+#define INT64_C(c) (c ## LL)
+#define UINT64_C(c) (c ## ULL)
+#endif
 
 extern "C" {
 #ifdef _MSC_VER
diff -pruN opal-3.8.3/src/codec/opalpluginmgr.cxx opal-3.8.3-fix-h263-crash-on-null-context//src/codec/opalpluginmgr.cxx
--- opal-3.8.3/src/codec/opalpluginmgr.cxx	2010-12-20 23:43:00.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//src/codec/opalpluginmgr.cxx	2011-01-21 05:57:51.479056064 +0100
@@ -302,7 +302,7 @@ void OpalPluginMediaFormatInternal::SetO
         format.AddOption(new OpalMediaOptionString(key, false, val), true);
         break;
     }
-    free(array);
+    if (array) free(array);
   }
 }
 
@@ -488,7 +488,7 @@ bool OpalPluginMediaFormatInternal::Adju
     freeOptionsControl.Call(output, sizeof(output));
   }
 
-  free(input);
+  if (input) free(input);
 
   return ok;
 }
@@ -654,7 +654,7 @@ bool OpalPluginTranscoder::UpdateOptions
 
   char ** options = fmt.GetOptions().ToCharArray(false);
   bool ok = setCodecOptions.Call(options, sizeof(options), context) != 0;
-  free(options);
+  if (options) free(options);
   return ok;
 }
Comment 8 Eugen Dedu 2011-01-24 14:02:31 UTC
Reopening, so that people can see it, and until the issue is settled.

For reference, some parts of this patch have been committed to opal.  Patch from Guido Trentalancia.

diff -pruN opal-3.8.3/plugins/video/H.263-1998/h263-1998.cxx opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.263-1998/h263-1998.cxx
--- opal-3.8.3/plugins/video/H.263-1998/h263-1998.cxx	2010-12-20 23:42:42.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.263-1998/h263-1998.cxx	2011-01-21 06:26:16.283344061 +0100
@@ -221,7 +221,7 @@ H263_Base_EncoderContext::H263_Base_Enco
 
 H263_Base_EncoderContext::~H263_Base_EncoderContext()
 {
-  free(_inputFrameBuffer);
+  if (_inputFrameBuffer) free(_inputFrameBuffer);
 }
 
 bool H263_Base_EncoderContext::Open(CodecID codecId)
@@ -517,8 +517,8 @@ H263_RFC2190_EncoderContext::~H263_RFC21
 
   CloseCodec();
 
-  av_free(_context);
-  av_free(_inputFrame);
+  if (_context) av_free(_context);
+  if (_inputFrame) av_free(_inputFrame);
 
   TRACE_AND_LOG(tracer, 3, "encoder closed");
 }
@@ -770,8 +770,8 @@ H263_RFC2429_EncoderContext::~H263_RFC24
   if (_txH263PFrame)
     delete _txH263PFrame;
 
-  av_free(_context);
-  av_free(_inputFrame);
+  if (_context) av_free(_context);
+  if (_inputFrame) av_free(_inputFrame);
 
   TRACE_AND_LOG(tracer, 3, "encoder closed");
 }
@@ -951,8 +951,8 @@ H263_Base_DecoderContext::~H263_Base_Dec
 {
   CloseCodec();
 
-  av_free(_context);
-  av_free(_outputFrame);
+  if (_context) av_free(_context);
+  if (_outputFrame) av_free(_outputFrame);
 }
 
 bool H263_Base_DecoderContext::OpenCodec()
@@ -1315,7 +1315,7 @@ static int free_codec_options ( const st
   char ** strings = (char **) parm;
   for (char ** string = strings; *string != NULL; string++)
     free(*string);
-  free(strings);
+  if (strings) free(strings);
   return 1;
 }
 
@@ -1360,7 +1360,12 @@ static int codec_encoder(const struct Pl
                                    unsigned int * flag)
 {
   H263_Base_EncoderContext * context = (H263_Base_EncoderContext *)_context;
-  return context->EncodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag);
+  if (context)
+	return context->EncodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag);
+  else {
+	TRACE_AND_LOG(tracer, 1, "Context for the encoder has not been initialised !");
+	return 0;
+  }
 }
 
 #define PMAX(a,b) ((a)>=(b)?(a):(b))
@@ -1590,7 +1595,7 @@ static int encoder_set_options(const Plu
                                unsigned * parmLen)
 {
   H263_Base_EncoderContext * context = (H263_Base_EncoderContext *)_context;
-  if (parmLen == NULL || *parmLen != sizeof(const char **) || parm == NULL)
+  if (parmLen == NULL || *parmLen != sizeof(const char **) || parm == NULL || context == NULL)
     return 0;
 
   context->Lock();
@@ -1678,7 +1683,12 @@ static int codec_decoder(const struct Pl
                                    unsigned int * flag)
 {
   H263_Base_DecoderContext * context = (H263_Base_DecoderContext *)_context;
-  return context->DecodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag) ? 1 : 0;
+  if (context)
+	context->DecodeFrames((const BYTE *)from, *fromLen, (BYTE *)to, *toLen, *flag) ? 1 : 0;
+  else {
+        TRACE_AND_LOG(tracer, 1, "Context for the decoder has not been initialised !");
+        return 0;
+  }
 }
 
 static int decoder_get_output_data_size(const PluginCodec_Definition * codec, void *, const char *, void *, unsigned *)
diff -pruN opal-3.8.3/plugins/video/H.264/h264-x264.h opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.264/h264-x264.h
--- opal-3.8.3/plugins/video/H.264/h264-x264.h	2010-12-20 23:42:42.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//plugins/video/H.264/h264-x264.h	2011-01-21 06:11:44.545191085 +0100
@@ -54,7 +54,10 @@
 
 #include "shared/h264frame.h"
 
-
+#ifndef INT64_C
+#define INT64_C(c) (c ## LL)
+#define UINT64_C(c) (c ## ULL)
+#endif
 
 extern "C" {
 #ifdef _MSC_VER
diff -pruN opal-3.8.3/src/codec/opalpluginmgr.cxx opal-3.8.3-fix-h263-crash-on-null-context//src/codec/opalpluginmgr.cxx
--- opal-3.8.3/src/codec/opalpluginmgr.cxx	2010-12-20 23:43:00.000000000 +0100
+++ opal-3.8.3-fix-h263-crash-on-null-context//src/codec/opalpluginmgr.cxx	2011-01-21 05:57:51.479056064 +0100
@@ -302,7 +302,7 @@ void OpalPluginMediaFormatInternal::SetO
         format.AddOption(new OpalMediaOptionString(key, false, val), true);
         break;
     }
-    free(array);
+    if (array) free(array);
   }
 }
 
@@ -488,7 +488,7 @@ bool OpalPluginMediaFormatInternal::Adju
     freeOptionsControl.Call(output, sizeof(output));
   }
 
-  free(input);
+  if (input) free(input);
 
   return ok;
 }
@@ -654,7 +654,7 @@ bool OpalPluginTranscoder::UpdateOptions
 
   char ** options = fmt.GetOptions().ToCharArray(false);
   bool ok = setCodecOptions.Call(options, sizeof(options), context) != 0;
-  free(options);
+  if (options) free(options);
   return ok;
 }
Comment 9 Eugen Dedu 2011-07-27 10:59:42 UTC
This has finally been fixed!  The commit is very probably http://opalvoip.svn.sourceforge.net/viewvc/opalvoip?view=revision&revision=26248