elzaksspro / gstreamer-java

Automatically exported from code.google.com/p/gstreamer-java
0 stars 0 forks source link

setMaximumLateness does not work correctly #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi.

First of all, thanks for that excellent work !

I have faced and resolved an issue, using swing VideoComponent. That
component uses a sync'ed fakesrc, with a max latency of 20ms.

In fact, gstreamer C source code states that gst_base_sink_set_max_lateness
uses a max_lateness in nanoseconds. But BaseSink java class converts time
into milliseconds.

Setting 20ms of latency in gstreamer-java results in setting 20 nanoseconds
of latency in gstreamer library - and that latency is drammatically too short !

In class org.gstreamer.elements.BaseSink, please, replace the following
methods:
    public void setMaximumLateness(long lateness, TimeUnit units) {
        gst().gst_base_sink_set_max_lateness(this, units.toMillis(lateness));
    }
    public long getMaximumLateness(TimeUnit units) {
        return units.convert(gst().gst_base_sink_get_max_lateness(this),
TimeUnit.MILLISECONDS);
    }

with these methods:

    public void setMaximumLateness(long lateness, TimeUnit units) {
        gst().gst_base_sink_set_max_lateness(this, units.toNanos(lateness));
    }
    public long getMaximumLateness(TimeUnit units) {
        return units.convert(gst().gst_base_sink_get_max_lateness(this),
TimeUnit.NANOSECONDS);
    }

Thanks again for this work.
Regards, Sylvain RIBEYRON.

Original issue reported on code.google.com by sylvain....@free.fr on 30 Apr 2010 at 4:37

GoogleCodeExporter commented 8 years ago
Good point, thanks! 
Fixed and commited to the trunk.

Original comment by andres.c...@gmail.com on 1 May 2010 at 11:01