I modified something for the USB earphone issue.
hustxyj at sina.com
Mon Jun 9 05:16:46 PDT 2014
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
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 (GstAudioSink * asink)
LPVOID pLockedBuffer = NULL;
DWORD dwSizeBuffer = 0;
dsoundsink = GST_DIRECTSOUND_SINK (asink);
dsoundsink->reset = TRUE;
In the calculate_freesize loop, modified as below:
if (SUCCEEDED (hRes) && (dwStatus & DSBSTATUS_PLAYING) &&
dsoundsink->first_buffer_after_reset = FALSE;
dsoundsink->reset = FALSE;
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gstreamer-devel