[Bug 744442] Unable to obtain GstClock from GstElement (Android)

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Feb 12 16:05:24 PST 2015


https://bugzilla.gnome.org/show_bug.cgi?id=744442

--- Comment #2 from Steve Johnson <steve at svenyonson.com> ---
Thank you Olivier. Unfortunately this excellent information is not easily found
in the GStreamer docs. I added your code and it works. Thank you.

I am porting a python application (syncing playback across two devices -
[noraisin.net]) and the following code works properly without first having to
play the video. This runs on Ubuntu 14.04. Can you see any reason why they
would behave differently? Thanks.

#!/usr/bin/env python

import sys

from gi.repository import Gst
from gi.repository import GstNet

def main(args):
    _, uri, port = args
    port = int(port)

    Gst.init()

    # make the pipeline
    pipeline = Gst.parse_launch('playbin')
    pipeline.set_property('uri', uri) # uri interface

    # make sure some other clock isn't autoselected
    clock = pipeline.get_clock()
    print 'Using clock: ', clock
    pipeline.use_clock(clock)

    # this will start a server listening on a UDP port
    clock_provider = GstNet.NetTimeProvider.new(clock, None, port)

    # we explicitly manage our base time
    base_time = clock.get_time()
    print ('Start slave as: python ./play-slave.py %s [IP] %d %d'
           % (uri, port, base_time))

    # disable the pipeline's management of base_time -- we're going
    # to set it ourselves.
    pipeline.set_start_time(Gst.CLOCK_TIME_NONE)
    pipeline.set_base_time(base_time)

    # now we go :)
    pipeline.set_state(Gst.State.PLAYING)

    # wait until things stop
    pipeline.get_bus().poll(Gst.MessageType.EOS | Gst.MessageType.ERROR,
Gst.CLOCK_TIME_NONE)
    pipeline.set_state(Gst.State.NULL)

if __name__ == '__main__':
    main(sys.argv)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list