found the problem (in xineliboutput) Re: vdr-sxfe segfaults when listening to radiochannles (vdr-1.7.9/1.7.12)

Message ID 20100213131650.GA24809@gentoo.local
State New
Headers

Commit Message

Halim Sahin Feb. 13, 2010, 1:16 p.m. UTC
  Hi folks,
The segfault was introduced in xineliboutput's cvs between 28.01.2010
and 29.01.2010
The following change produces it:

   BR.
  

Comments

Marco Skambraks Feb. 15, 2010, 4:17 p.m. UTC | #1
hi,

I had/have the same problem
I found out that this feature produces the problem:
  Visualization: goom

if I turn it off I can switch to radio-channels and listen to it without 
any problems

Halim, the code lines you posted looks like a new a/v sync method
if "Visualization" is set to "goom"
xineliboutput or maybe xinelib adds some frames to the video stream

hth to solve the problem

marco

On Sat, 13 Feb 2010, Halim Sahin wrote:

> Hi folks,
> The segfault was introduced in xineliboutput's cvs between 28.01.2010
> and 29.01.2010
> The following change produces it:
>
> --- xine_input_vdr.c.old	2010-02-13 14:13:48.670894516 +0100
> +++ xine_input_vdr.c	2010-02-13 14:13:56.246141788 +0100
> @@ -4,7 +4,7 @@
>  * See the main source file 'xineliboutput.c' for copyright information and
>  * how to reach the author.
>  *
> - * $Id: xine_input_vdr.c,v 1.289 2010/01/18 20:39:36 phintuka Exp $
> + * $Id: xine_input_vdr.c,v 1.291 2010/01/28 11:50:07 phintuka Exp $
>  *
>  */
>
> @@ -62,6 +62,7 @@
>
> #include "xine/adjustable_scr.h"
> #include "xine/osd_manager.h"
> +#include "xine/xvdr_metronom.h"
>
> #include "xine_input_vdr.h"
> #include "xine_input_vdr_net.h"
> @@ -127,7 +128,7 @@
> #  include <linux/unistd.h> /* syscall(__NR_gettid) */
> #endif
>
> -static const char module_revision[] = "$Id: xine_input_vdr.c,v 1.289 2010/01/18 20:39:36 phintuka Exp $";
> +static const char module_revision[] = "$Id: xine_input_vdr.c,v 1.291 2010/01/28 11:50:07 phintuka Exp $";
> static const char log_module_input_vdr[] = "[input_vdr] ";
> #define LOG_MODULENAME log_module_input_vdr
> #define SysLogLevel    iSysLogLevel
> @@ -313,6 +314,9 @@
>   uint8_t             hd_stream : 1;        /* true if current stream is HD */
>   uint8_t             sw_volume_control : 1;
>
> +  /* metronom */
> +  xvdr_metronom_t    *metronom;
> +
>   /* SCR */
>   adjustable_scr_t   *scr;
>   int                 speed_before_pause;
> @@ -1813,7 +1817,7 @@
>   this->class->xine->config->update_num(this->class->xine->config,
> 					"video.output.xv_deinterlace_method",
> 					method >= 0 ? method : 0);
> -  xine_set_param(this->stream, XINE_PARAM_VO_DEINTERLACE, method ? 1 : 0);
> +  xine_set_param(this->stream, XINE_PARAM_VO_DEINTERLACE, !!method);
>
>   return 0;
> }
> @@ -1935,7 +1939,7 @@
>   return 0;
> }
>
> -static int  set_playback_speed(vdr_input_plugin_t *this, int speed)
> +static int set_trick_speed(vdr_input_plugin_t *this, int speed, int backwards)
> {
> /*  speed:
>       <0 - show each abs(n)'th frame (drop other frames)
> @@ -1955,6 +1959,8 @@
>     return -2;
>   }
>
> +  this->metronom->set_trickspeed(this->metronom, backwards ? speed : 0);
> +
>   if(speed > 1 || speed < -1) {
>     reset_scr_tuning(this, -1);
>     this->is_trickspeed = 1;
> @@ -1981,6 +1987,11 @@
>   return 0;
> }
>
> +static int reset_trick_speed(vdr_input_plugin_t *this)
> +{
> +  return set_trick_speed(this, 1, 0);
> +}
> +
> static void send_meta_info(vdr_input_plugin_t *this)
> {
>   if(this->slave_stream) {
> @@ -2263,10 +2274,10 @@
>       xine_usec_sleep(50*1000);
>
>       /* keep our own demux happy while playing another stream */
> -      set_playback_speed(this, 1);
> +      reset_trick_speed(this);
>       this->live_mode = 1;
>       set_live_mode(this, 0);
> -      set_playback_speed(this, 1);
> +      reset_trick_speed(this);
>       reset_scr_tuning(this, this->speed_before_pause = XINE_FINE_SPEED_NORMAL);
>       this->slave_stream->metronom->set_option(this->slave_stream->metronom,
> 					       METRONOM_PREBUFFER, 90000);
> @@ -2902,7 +2913,7 @@
>
>   } else if(!strncasecmp(cmd, "TRICKSPEED ", 11)) {
>     err = (1 == sscanf(cmd+11, "%d", &tmp32)) ?
> -      set_playback_speed(this, tmp32) :
> +      set_trick_speed(this, tmp32, !!strstr(cmd+13, "Back")) :
>       CONTROL_PARAM_ERROR;
>
>   } else if(!strncasecmp(cmd, "STILL ", 6)) {
> @@ -2938,13 +2949,13 @@
>
>   } else if(!strncasecmp(cmd, "MASTER ", 7)) {
>     if(1 == sscanf(cmd+7, "%d", &tmp32))
> -      this->fixed_scr = tmp32 ? 1 : 0;
> +      this->fixed_scr = !!tmp32;
>     else
>       err = CONTROL_PARAM_ERROR;
>
>   } else if(!strncasecmp(cmd, "VOLUME ", 7)) {
>     if(1 == sscanf(cmd+7, "%d", &tmp32)) {
> -      int sw = strstr(cmd, "SW") ? 1 : 0;
> +      int sw = !!strstr(cmd, "SW");
>       if(!sw) {
> 	xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, tmp32);
> 	xine_set_param(stream, XINE_PARAM_AUDIO_MUTE, tmp32<=0 ? 1 : 0);
> @@ -2994,7 +3005,7 @@
>   } else if(!strncasecmp(cmd, "AUDIOSTREAM ", 12)) {
>     if(!this->slave_stream) {
> #if 0
> -      int ac3 = strncmp(cmd+12, "AC3", 3) ? 0 : 1;
> +      int ac3 = !strncmp(cmd+12, "AC3", 3);
>       if(1 == sscanf(cmd+12 + 4*ac3, "%d", &tmp32)) {
> 	pthread_mutex_lock(&this->lock);
> 	this->audio_stream_id = tmp32;
> @@ -3016,7 +3027,7 @@
>     int old_ch  = _x_get_spu_channel(stream);
>     int max_ch  = xine_get_stream_info(stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL);
>     int ch      = old_ch;
> -    int ch_auto = strstr(cmd+10, "auto") ? 1 : 0;
> +    int ch_auto = !!strstr(cmd+10, "auto");
>     int is_dvd  = 0;
>
>     if (this->slave_stream && this->slave_stream->input_plugin) {
> @@ -4512,7 +4523,7 @@
>
>   flush_all_fifos (this, 0);
>
> -  set_playback_speed(this, 1);
> +  reset_trick_speed(this);
>   this->live_mode = 0;
>   reset_scr_tuning(this, XINE_FINE_SPEED_NORMAL);
>   this->stream->emergency_brake = 1;
> @@ -4697,7 +4708,7 @@
>
>   this->control_running = 0;
>
> -  local = this->funcs.push_input_write ? 1 : 0;
> +  local = !!this->funcs.push_input_write;
>   memset(&this->funcs, 0, sizeof(this->funcs));
>
>   /* shutdown sockets */
> @@ -4798,6 +4809,10 @@
>   if (this->scr)
>     this->scr->dispose(this->scr);
>
> +  /* metronom */
> +  if (this->metronom)
> +    this->metronom->dispose(this->metronom);
> +
>   free (this->mrl);
>
>   if(this->udp_data)
> @@ -4863,6 +4878,9 @@
>   this->scr_tuning = SCR_TUNING_OFF;
>   this->curpos = 0;
>
> +  /* replace stream metronom */
> +  this->metronom = xvdr_metronom_init(this->stream);
> +
>   /* buffer */
>   this->block_buffer = fifo_buffer_new(this->stream, 4, 0x10000+64); /* dummy buf to be used before first read and for big PES frames */
>   ny ideas howto solve this?
>   BR.
>
> -- 
> Halim Sahin
> E-Mail:
> halim.sahin (at) t-online.de
>
> _______________________________________________
> vdr mailing list
> vdr@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
>

--------------------------------------------------
AMMEC - Accessible MultiMedia Entertainment Center

http://www.ammec.de
Support Telefon: +49 6421 968255
  

Patch

--- xine_input_vdr.c.old	2010-02-13 14:13:48.670894516 +0100
+++ xine_input_vdr.c	2010-02-13 14:13:56.246141788 +0100
@@ -4,7 +4,7 @@ 
  * See the main source file 'xineliboutput.c' for copyright information and
  * how to reach the author.
  *
- * $Id: xine_input_vdr.c,v 1.289 2010/01/18 20:39:36 phintuka Exp $
+ * $Id: xine_input_vdr.c,v 1.291 2010/01/28 11:50:07 phintuka Exp $
  *
  */
 
@@ -62,6 +62,7 @@ 
 
 #include "xine/adjustable_scr.h"
 #include "xine/osd_manager.h"
+#include "xine/xvdr_metronom.h"
 
 #include "xine_input_vdr.h"
 #include "xine_input_vdr_net.h"
@@ -127,7 +128,7 @@ 
 #  include <linux/unistd.h> /* syscall(__NR_gettid) */
 #endif
 
-static const char module_revision[] = "$Id: xine_input_vdr.c,v 1.289 2010/01/18 20:39:36 phintuka Exp $";
+static const char module_revision[] = "$Id: xine_input_vdr.c,v 1.291 2010/01/28 11:50:07 phintuka Exp $";
 static const char log_module_input_vdr[] = "[input_vdr] ";
 #define LOG_MODULENAME log_module_input_vdr
 #define SysLogLevel    iSysLogLevel
@@ -313,6 +314,9 @@ 
   uint8_t             hd_stream : 1;        /* true if current stream is HD */
   uint8_t             sw_volume_control : 1;
 
+  /* metronom */
+  xvdr_metronom_t    *metronom;
+
   /* SCR */
   adjustable_scr_t   *scr;
   int                 speed_before_pause;
@@ -1813,7 +1817,7 @@ 
   this->class->xine->config->update_num(this->class->xine->config,
 					"video.output.xv_deinterlace_method",
 					method >= 0 ? method : 0);
-  xine_set_param(this->stream, XINE_PARAM_VO_DEINTERLACE, method ? 1 : 0);
+  xine_set_param(this->stream, XINE_PARAM_VO_DEINTERLACE, !!method);
   
   return 0;
 }
@@ -1935,7 +1939,7 @@ 
   return 0;
 }
 
-static int  set_playback_speed(vdr_input_plugin_t *this, int speed)
+static int set_trick_speed(vdr_input_plugin_t *this, int speed, int backwards)
 {
 /*  speed:
       <0 - show each abs(n)'th frame (drop other frames)
@@ -1955,6 +1959,8 @@ 
     return -2;
   }
 
+  this->metronom->set_trickspeed(this->metronom, backwards ? speed : 0);
+
   if(speed > 1 || speed < -1) {
     reset_scr_tuning(this, -1);
     this->is_trickspeed = 1;
@@ -1981,6 +1987,11 @@ 
   return 0;
 }
 
+static int reset_trick_speed(vdr_input_plugin_t *this)
+{
+  return set_trick_speed(this, 1, 0);
+}
+
 static void send_meta_info(vdr_input_plugin_t *this)
 {
   if(this->slave_stream) {
@@ -2263,10 +2274,10 @@ 
       xine_usec_sleep(50*1000);
 
       /* keep our own demux happy while playing another stream */
-      set_playback_speed(this, 1);
+      reset_trick_speed(this);
       this->live_mode = 1;
       set_live_mode(this, 0);
-      set_playback_speed(this, 1);
+      reset_trick_speed(this);
       reset_scr_tuning(this, this->speed_before_pause = XINE_FINE_SPEED_NORMAL);
       this->slave_stream->metronom->set_option(this->slave_stream->metronom, 
 					       METRONOM_PREBUFFER, 90000);
@@ -2902,7 +2913,7 @@ 
 
   } else if(!strncasecmp(cmd, "TRICKSPEED ", 11)) {
     err = (1 == sscanf(cmd+11, "%d", &tmp32)) ? 
-      set_playback_speed(this, tmp32) : 
+      set_trick_speed(this, tmp32, !!strstr(cmd+13, "Back")) :
       CONTROL_PARAM_ERROR;    
 
   } else if(!strncasecmp(cmd, "STILL ", 6)) {
@@ -2938,13 +2949,13 @@ 
 
   } else if(!strncasecmp(cmd, "MASTER ", 7)) {
     if(1 == sscanf(cmd+7, "%d", &tmp32))
-      this->fixed_scr = tmp32 ? 1 : 0;
+      this->fixed_scr = !!tmp32;
     else
       err = CONTROL_PARAM_ERROR;
 
   } else if(!strncasecmp(cmd, "VOLUME ", 7)) {
     if(1 == sscanf(cmd+7, "%d", &tmp32)) {
-      int sw = strstr(cmd, "SW") ? 1 : 0;
+      int sw = !!strstr(cmd, "SW");
       if(!sw) {
 	xine_set_param(stream, XINE_PARAM_AUDIO_VOLUME, tmp32);
 	xine_set_param(stream, XINE_PARAM_AUDIO_MUTE, tmp32<=0 ? 1 : 0);
@@ -2994,7 +3005,7 @@ 
   } else if(!strncasecmp(cmd, "AUDIOSTREAM ", 12)) {
     if(!this->slave_stream) {
 #if 0
-      int ac3 = strncmp(cmd+12, "AC3", 3) ? 0 : 1;
+      int ac3 = !strncmp(cmd+12, "AC3", 3);
       if(1 == sscanf(cmd+12 + 4*ac3, "%d", &tmp32)) {
 	pthread_mutex_lock(&this->lock);
 	this->audio_stream_id = tmp32;
@@ -3016,7 +3027,7 @@ 
     int old_ch  = _x_get_spu_channel(stream);
     int max_ch  = xine_get_stream_info(stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL);
     int ch      = old_ch;
-    int ch_auto = strstr(cmd+10, "auto") ? 1 : 0;
+    int ch_auto = !!strstr(cmd+10, "auto");
     int is_dvd  = 0;
 
     if (this->slave_stream && this->slave_stream->input_plugin) {
@@ -4512,7 +4523,7 @@ 
 
   flush_all_fifos (this, 0);
 
-  set_playback_speed(this, 1);
+  reset_trick_speed(this);
   this->live_mode = 0;
   reset_scr_tuning(this, XINE_FINE_SPEED_NORMAL);
   this->stream->emergency_brake = 1;
@@ -4697,7 +4708,7 @@ 
 
   this->control_running = 0;
 
-  local = this->funcs.push_input_write ? 1 : 0;
+  local = !!this->funcs.push_input_write;
   memset(&this->funcs, 0, sizeof(this->funcs));
 
   /* shutdown sockets */
@@ -4798,6 +4809,10 @@ 
   if (this->scr)
     this->scr->dispose(this->scr);
 
+  /* metronom */
+  if (this->metronom)
+    this->metronom->dispose(this->metronom);
+
   free (this->mrl);
 
   if(this->udp_data)
@@ -4863,6 +4878,9 @@ 
   this->scr_tuning = SCR_TUNING_OFF;
   this->curpos = 0;
 
+  /* replace stream metronom */
+  this->metronom = xvdr_metronom_init(this->stream);
+
   /* buffer */
   this->block_buffer = fifo_buffer_new(this->stream, 4, 0x10000+64); /* dummy buf to be used before first read and for big PES frames */
   ny ideas howto solve this?