I modified something for the USB earphone issue.

hustxyj hustxyj at sina.com
Mon Jun 9 05:59:02 PDT 2014


Hi all:

 

>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.

 

I trace the code and found something more!

 

static gint

gst_directsound_sink_write (GstAudioSink * asink, gpointer data, guint
length)

{

 

  ..

 

  calculate_freesize:

 

..

 

      hRes = IDirectSoundBuffer_GetCurrentPosition
(dsoundsink->pDSBSecondary,

          &dwCurrentPlayCursor, NULL);

 

      hRes =

          IDirectSoundBuffer_GetStatus (dsoundsink->pDSBSecondary,
&dwStatus);

      if (SUCCEEDED (hRes) && (dwStatus & DSBSTATUS_PLAYING))

        goto calculate_freesize;

      else {

        dsoundsink->first_buffer_after_reset = FALSE;

        GST_DSOUND_UNLOCK (dsoundsink);

        return 0;

      }

    

.. 

}

 

If usb earphone was plugged out, IDirectSoundBuffer_GetCurrentPosition
return some error code, which will be overwrote by
IDirectSoundBuffer_GetStatus. So the hRes seemed success every time.

Treat the return values respectively, and  the problem was soloved.

 

Thanks!

--

Yongjian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140609/659890da/attachment.html>


More information about the gstreamer-devel mailing list