From: Wim T. <wt...@us...> - 2002-04-28 22:23:36
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: wtay Date: Sun Apr 28 2002 06:25:20 PDT Log message: More intelligent clock offset and sync. Modified files: sys/oss : gstossclock.c gstosssink.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/oss/gstossclock.c.diff?r1=1.3&r2=1.4 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/oss/gstosssink.c.diff?r1=1.15&r2=1.16 ====Begin Diffs==== Index: gstossclock.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/sys/oss/gstossclock.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstossclock.c 30 Mar 2002 17:06:26 -0000 1.3 +++ gstossclock.c 28 Apr 2002 13:25:08 -0000 1.4 @@ -117,7 +117,11 @@ oss_clock->adjust -= diff2 - diff1; } - //g_print ("diff %lld %lld %lld %lld %lld %lld\n", diff1, diff2, time1, time2, diff2 - diff1, oss_clock->adjust); + /* + g_print ("diff %lld %lld %lld %lld %lld %lld\n", + diff1, diff2, time1, time2, diff2 - diff1, oss_clock->adjust); + */ + return time2 + oss_clock->adjust; } Index: gstosssink.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/sys/oss/gstosssink.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- gstosssink.c 15 Apr 2002 09:27:03 -0000 1.15 +++ gstosssink.c 28 Apr 2002 13:25:08 -0000 1.16 @@ -222,13 +222,19 @@ { GstOssSink *osssink = GST_OSSSINK (data); gint delay; + gint offset = 0; if (!osssink->bps) return 0; + /* if we have a start time, use offset */ + if (osssink->offset >= 0LL) { + offset = osssink->offset; + } + ioctl (osssink->fd, SNDCTL_DSP_GETODELAY, &delay); - return osssink->offset + (osssink->handled - delay) * 1000000LL / osssink->bps; + return offset + (osssink->handled - delay) * 1000000LL / osssink->bps; } static void @@ -467,7 +473,10 @@ if (osssink->clock) { /* FIXME, NEW_MEDIA/DISCONT?. Try to get our start point */ if (osssink->offset == -1LL && buftime != -1LL) { - /* g_print ("%lld %lld %lld\n", osssink->offset, buftime, gst_clock_get_time (osssink->clock)); */ + GST_INFO (GST_CAT_PLUGIN_INFO, + "osssink: clock at offset: %lld, new offset %lld at time %lld\n", + osssink->offset, buftime, gst_clock_get_time (osssink->clock)); + osssink->offset = buftime; osssink->handled = 0; gst_element_clock_wait (GST_ELEMENT (osssink), osssink->clock, buftime); @@ -483,6 +492,7 @@ osssink->handled += tosend; } */ write (osssink->fd, data, size); + osssink->handled += size; } /* no clock, try to be as fast as possible */ else { |