GNOME Bugzilla – Bug 703901
audioecho: Output broken if delay value got changed when playing or paused
Last modified: 2013-07-12 07:51:35 UTC
Created attachment 248773 [details] [review] audioecho plug-in patch Hello, I have suffered this bug for a long time just since I started using GStreamer 0.10: If I changed "delay" property at the state of playing or paused, the output audio became noise and then got no output at all. I have done some research on the audioecho plug-in and then write a patch for it (In the attachment).
Review of attachment 248773 [details] [review]: ::: audioecho.c.old @@ +204,3 @@ } + + //Reset the buffer and update delay frame number if delay value has changed. Please use normal C comments /* */ @@ +206,3 @@ + //Reset the buffer and update delay frame number if delay value has changed. + rate = GST_AUDIO_FILTER_RATE (self); + self->delay_frames = MAX (gst_util_uint64_scale (self->delay, rate, GST_SECOND), 1); You should check that the delay is smaller/equal to max-delay. Otherwise the buffer will be too small and it will crash @@ +207,3 @@ + rate = GST_AUDIO_FILTER_RATE (self); + self->delay_frames = MAX (gst_util_uint64_scale (self->delay, rate, GST_SECOND), 1); + self->buffer_pos = 0; Resetting the buffer position should cause a short distortion whenever you set a different delay. Why is that necessary?
Created attachment 248835 [details] [review] Modified patch of audioecho plug-in I have removed the comment and resized the buffer if max_delay has enlarged. Here is my new patch.
Review of attachment 248835 [details] [review]: Please attach this as a "git format-patch" style patch. For this commit the changes locally (check that git uses your mail address and name) and use "git format-patch -1" ::: audioecho.c.old @@ +203,3 @@ self->delay = delay; self->max_delay = MAX (delay, max_delay); + if(self->max_delay>max_delay) { This happens only in READY state and there we don't have a buffer allocated yet. The code in line 195 is for the case when we're PAUSED/PLAYING already and have a buffer.
Created attachment 248962 [details] [review] Patch created by git OK, I create the new one by git.