I modified something for the USB earphone issue.
Tim Müller
tim at centricular.com
Mon Jun 9 07:01:30 PDT 2014
On Mon, 2014-06-09 at 20:16 +0800, hustxyj wrote:
Hi,
it would be best if you could put all of this including your
modifications into a bug in bugzilla. We can discuss the best solution
there then.
Cheers
-Tim
>
>
> I sent an email about the hot-plug issue about USB earphone before.
> These days, I trace the log, and found that when I plugged out the
> device, it came to an endless loop in gst_directsound_sink_write;
> calculate_freesize was called everytime. So, if gst_element_set_state
> was called in another thread, gst_directsound_sink_reset triggered,
> Which may blocked, due to GST_DSOUND_LOCK (dsoundsink).
>
>
>
> I added a variable “reset” in GstDirectSoundSink to indicate the reset
> of a sink. It will be set true before GST_DSOUND_LOCK (dsoundsink) in
> gst_directsound_sink_reset:
>
> static void
>
> gst_directsound_sink_reset (GstAudioSink * asink)
>
> {
>
> GstDirectSoundSink *dsoundsink;
>
> LPVOID pLockedBuffer = NULL;
>
> DWORD dwSizeBuffer = 0;
>
>
>
> dsoundsink = GST_DIRECTSOUND_SINK (asink);
>
>
>
> dsoundsink->reset = TRUE;
>
>
>
> GST_DSOUND_LOCK (dsoundsink);
>
>
>
> ……
>
> }
>
>
>
> In the calculate_freesize loop, modified as below:
>
> if (SUCCEEDED (hRes) && (dwStatus & DSBSTATUS_PLAYING) && !
> dsoundsink->reset)
>
> goto calculate_freesize;
>
> else {
>
> dsoundsink->first_buffer_after_reset = FALSE;
>
> dsoundsink->reset = FALSE;
>
> GST_DSOUND_UNLOCK (dsoundsink);
>
> return 0;
>
> }
>
>
>
> After modified, the stuck issue was gone. I want to ask you guys, if
> this is a good idea or a bad one. If bad, do you have any other
> solutions?
>
> PS: I haven’t looked deep into the logic of calculate_freesize loop.
> So maybe there is a better way to break the loop which I have not
> found.
>
>
>
> Thanks!
>
>
>
> --
>
> Yongjian
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
--
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel
mailing list