1.0 returned buffer (in python) doesn't have correct offset value (and also dts, duration and offset_end)
I am trying to transpose a code using Gstreamer 0.1 to use Gstreamer 1.0. In the old version of the code (using Gstreamer 0.1), a callback function (called when a new frame has been decoded) received a buffer, which had an offset field, which is (as far as I understand) representing the frame number. During the execution, this offset started at around zero, and was constantly growing.
In the code using Gstreamer 1.0, the received buffer also has an offset field, but it doesn't change in time, and is equal to an arbitrary very high value. The dts, duration and offset_end fields also stay constant at a high value, and only the pts field starts at a low value and grows during the execution.``
I probably missed a few lines of code (needed in Gstreamer 1.0, which weren't in Gstreamer 0.1), but I cannot find which ones.
Could someone tell me what I am missing here?
Here is the Version using Gstreamer 1.0:
from utils import mksock class Video(): _PIPEDEF=[ "udpsrc name=src blocksize=1316 close-socket=false buffer-size=100000 ",# UDP video data # "video/mpegts ", "tsparse ", # parse the incoming stream to MPegTS "tsdemux emit-stats=True ", # get pts statistics from the MPegTS stream "queue ", # build queue for the decoder # "video/x-h264 ", "h264parse ", "avdec_h264 max-threads=1 ", "identity name=decoded ", # used to grab video frame to be displayed "fakesink sync=false " # dump video frames from memory after all relevant processing is done ] _pipeline = None # The GStreamer pipeline _keepalive = None # Keepalive for video _sock = None # Communicaion socket def __init__(self, streamLibs): [self._Gst, self._Gio, GLib] = streamLibs def start(self, peer): """ Start grabbing video """ # Create socket self._sock = mksock(peer) # Create G address for sending keepalive msg Gpeer = self._Gio.InetSocketAddress.new_from_string(peer, peer) # Create G socket using socketfd self._Gsock = self._Gio.Socket.new_from_fd(self._sock.fileno()) self._Gsock.set_keepalive(True) # Create pipeline self._pipeline= self._Gst.parse_launch("!".join(self._PIPEDEF)) # Set socket to get data from out socket src = self._pipeline.get_by_name("src") src.set_property("socket", self._Gsock) # Catch decoded frames decoded = self._pipeline.get_by_name("decoded") decoded.connect("handoff", self._decoded_buffer) # Start video streaming srcpad = src.get_static_pad("udpsrc") # Start the video pipeline self._pipeline.set_state(self._Gst.State.PLAYING) print 'Succeeded launching video stream pipeline...' def _decoded_buffer(self, ident, buf): """ Callback for decoded buffer """ # Make sure to convert timestamp to us print("Bufer: pts/1000="+str(buf.pts/1000)) #Starts near zero and grows in time print("dts/1000="+str(buf.dts/1000)) #Stays static at an arbitrary high value print("duration/1000="+str(buf.duration/1000)) #Stays static at an arbitrary high value print("offset="+str(buf.offset)) #Stays static at an arbitrary high value print("offset_end="+str(buf.offset_end)) #Stays static at an arbitrary high value