Using rtpjitterbuffer to handle RTP packets based on their timestamp only (mode 0)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using rtpjitterbuffer to handle RTP packets based on their timestamp only (mode 0)

Andrea Lo Pumo
I have a dump of RTP traffic (a single ssrc stream) and I would like to decode it with gstreamer.
What I am trying works, but it fails if there are jumps in the timestamps because there is silence in between (no packets sent during the silence). The result is an audio without the right silence.
Note that the RTP timestamp advances correctly, so one knows how much time passed before the jump and after it.
Thus, I was trying "rtpjitterbuffer mode=0" however, when I use mode=0, I get the following:
....
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (1, #23086->#23086) duration too large 0:00:00.800000000 > 0:00:00.200000000, consider 0 lost (0:00:00.200000000)
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (2, #23112->#23113) duration too large 0:00:00.740000000 > 0:00:00.200000000, consider 1 lost (0:00:00.293333332)
...
INFO                 basesrc gstbasesrc.c:2839:gst_base_src_loop:<rtpfilesrc0> pausing after gst_base_src_get_range() = eos
INFO                    task gsttask.c:316:gst_task_func:<rtpfilesrc0:src> Task going to paused

and at this point it remains blocked.

This is the pipeline I am using:

    gst-launch-1.0 rtpfilesrc location=/tmp/input.rtp ! "application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" ! rtpjitterbuffer mode=0 max-rtcp-rtp-time-diff=-1 ! decodebin ! wavenc ! filesink location=/tmp/out.wav

Rtpfilesrc is a plugin I have written that reads an RTP dump and becomes a source of UDP packets. I used PushSrc as the base class and have overridden "fill".
In init() I am using the following configuration:
  gst_base_src_set_live (GST_BASE_SRC (rtpfilesrc), TRUE);
  gst_base_src_set_format (GST_BASE_SRC (rtpfilesrc), GST_FORMAT_TIME);
  // do not make rtpfilesrc set timestamps on outgoing buffers based on the running_time when they were captured
  gst_base_src_set_do_timestamp (GST_BASE_SRC (rtpfilesrc), FALSE);

What should I do?

Thank you in advance.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using rtpjitterbuffer to handle RTP packets based on their timestamp only (mode 0)

Andrea Lo Pumo
P.S. here attached the source code of rtpfilesrc

Il giorno mer 2 ott 2019 alle ore 18:14 Andrea Lo Pumo <[hidden email]> ha scritto:
I have a dump of RTP traffic (a single ssrc stream) and I would like to decode it with gstreamer.
What I am trying works, but it fails if there are jumps in the timestamps because there is silence in between (no packets sent during the silence). The result is an audio without the right silence.
Note that the RTP timestamp advances correctly, so one knows how much time passed before the jump and after it.
Thus, I was trying "rtpjitterbuffer mode=0" however, when I use mode=0, I get the following:
....
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (1, #23086->#23086) duration too large 0:00:00.800000000 > 0:00:00.200000000, consider 0 lost (0:00:00.200000000)
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (2, #23112->#23113) duration too large 0:00:00.740000000 > 0:00:00.200000000, consider 1 lost (0:00:00.293333332)
...
INFO                 basesrc gstbasesrc.c:2839:gst_base_src_loop:<rtpfilesrc0> pausing after gst_base_src_get_range() = eos
INFO                    task gsttask.c:316:gst_task_func:<rtpfilesrc0:src> Task going to paused

and at this point it remains blocked.

This is the pipeline I am using:

    gst-launch-1.0 rtpfilesrc location=/tmp/input.rtp ! "application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" ! rtpjitterbuffer mode=0 max-rtcp-rtp-time-diff=-1 ! decodebin ! wavenc ! filesink location=/tmp/out.wav

Rtpfilesrc is a plugin I have written that reads an RTP dump and becomes a source of UDP packets. I used PushSrc as the base class and have overridden "fill".
In init() I am using the following configuration:
  gst_base_src_set_live (GST_BASE_SRC (rtpfilesrc), TRUE);
  gst_base_src_set_format (GST_BASE_SRC (rtpfilesrc), GST_FORMAT_TIME);
  // do not make rtpfilesrc set timestamps on outgoing buffers based on the running_time when they were captured
  gst_base_src_set_do_timestamp (GST_BASE_SRC (rtpfilesrc), FALSE);

What should I do?

Thank you in advance.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

gstrtpfilesrc.c (19K) Download Attachment
gstrtpfilesrc.h (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using rtpjitterbuffer to handle RTP packets based on their timestamp only (mode 0)

Andrea Lo Pumo
I played with gstreamer-java, using an appsrc as the source of RTP packets given to rtpjitterbuffer (instead of rtpfilesrc).
In this test, I set the Presentation Timestamp of all generated buffers (in the right way, i.e. (timestamp-firstTimestamp)/160*20 milliseconds).
And I removed "mode=0" as an option to rtpjitterbuffer.
However, the behaviour, is the same. After, the source has finished ( appsrc.endOfStream() ), the pipeline remains blocked.
This does not happen if the streams does not have jumps in the rtp timestamp.

Il giorno gio 3 ott 2019 alle ore 09:50 Andrea Lo Pumo <[hidden email]> ha scritto:
P.S. here attached the source code of rtpfilesrc

Il giorno mer 2 ott 2019 alle ore 18:14 Andrea Lo Pumo <[hidden email]> ha scritto:
I have a dump of RTP traffic (a single ssrc stream) and I would like to decode it with gstreamer.
What I am trying works, but it fails if there are jumps in the timestamps because there is silence in between (no packets sent during the silence). The result is an audio without the right silence.
Note that the RTP timestamp advances correctly, so one knows how much time passed before the jump and after it.
Thus, I was trying "rtpjitterbuffer mode=0" however, when I use mode=0, I get the following:
....
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (1, #23086->#23086) duration too large 0:00:00.800000000 > 0:00:00.200000000, consider 0 lost (0:00:00.200000000)
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (2, #23112->#23113) duration too large 0:00:00.740000000 > 0:00:00.200000000, consider 1 lost (0:00:00.293333332)
...
INFO                 basesrc gstbasesrc.c:2839:gst_base_src_loop:<rtpfilesrc0> pausing after gst_base_src_get_range() = eos
INFO                    task gsttask.c:316:gst_task_func:<rtpfilesrc0:src> Task going to paused

and at this point it remains blocked.

This is the pipeline I am using:

    gst-launch-1.0 rtpfilesrc location=/tmp/input.rtp ! "application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" ! rtpjitterbuffer mode=0 max-rtcp-rtp-time-diff=-1 ! decodebin ! wavenc ! filesink location=/tmp/out.wav

Rtpfilesrc is a plugin I have written that reads an RTP dump and becomes a source of UDP packets. I used PushSrc as the base class and have overridden "fill".
In init() I am using the following configuration:
  gst_base_src_set_live (GST_BASE_SRC (rtpfilesrc), TRUE);
  gst_base_src_set_format (GST_BASE_SRC (rtpfilesrc), GST_FORMAT_TIME);
  // do not make rtpfilesrc set timestamps on outgoing buffers based on the running_time when they were captured
  gst_base_src_set_do_timestamp (GST_BASE_SRC (rtpfilesrc), FALSE);

What should I do?

Thank you in advance.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using rtpjitterbuffer to handle RTP packets based on their timestamp only (mode 0)

Andrea Lo Pumo
By manually setting the PTS (Presentation Timestamp) and using the liveadder plugin before wavenc and not using rtpjitterbuffer, it actually works: the missing packets which correspond to silence are rightly considered as silence.
I found the liveadder plugin by mistake. I would suggest to add a reference to liveadder in the rtpjitterbuffer documentation. Something like: "if you would like to create silence for missing RTP packets, use the liveadder plugin".

Pipeline: 
    appsrc caps="application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" emit-signals=true format=3 block=true ! decodebin ! liveadder ! wavenc ! filesink location=/tmp/out-file.wav

However, I would like rtpjitterbuffer to set the PTS for me using the RTP timestamps. I am not able to achieve this. Even if I use the liveadder plugin, the pipeline blocks at EOS.

Pipeline:
    appsrc caps="application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" emit-signals=true format=3 block=true ! rtpjitterbuffer mode=0 latency=0 max-dropout-time=3600000 ! decodebin ! liveadder ! wavenc ! filesink location=/tmp/out-file.wav

I tried with and without format=3 and with latency=0.

Best regards.
 



Il giorno gio 3 ott 2019 alle ore 18:36 Andrea Lo Pumo <[hidden email]> ha scritto:
I played with gstreamer-java, using an appsrc as the source of RTP packets given to rtpjitterbuffer (instead of rtpfilesrc).
In this test, I set the Presentation Timestamp of all generated buffers (in the right way, i.e. (timestamp-firstTimestamp)/160*20 milliseconds).
And I removed "mode=0" as an option to rtpjitterbuffer.
However, the behaviour, is the same. After, the source has finished ( appsrc.endOfStream() ), the pipeline remains blocked.
This does not happen if the streams does not have jumps in the rtp timestamp.

Il giorno gio 3 ott 2019 alle ore 09:50 Andrea Lo Pumo <[hidden email]> ha scritto:
P.S. here attached the source code of rtpfilesrc

Il giorno mer 2 ott 2019 alle ore 18:14 Andrea Lo Pumo <[hidden email]> ha scritto:
I have a dump of RTP traffic (a single ssrc stream) and I would like to decode it with gstreamer.
What I am trying works, but it fails if there are jumps in the timestamps because there is silence in between (no packets sent during the silence). The result is an audio without the right silence.
Note that the RTP timestamp advances correctly, so one knows how much time passed before the jump and after it.
Thus, I was trying "rtpjitterbuffer mode=0" however, when I use mode=0, I get the following:
....
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (1, #23086->#23086) duration too large 0:00:00.800000000 > 0:00:00.200000000, consider 0 lost (0:00:00.200000000)
INFO         rtpjitterbuffer gstrtpjitterbuffer.c:2559:calculate_expected:<rtpjitterbuffer0> lost packets (2, #23112->#23113) duration too large 0:00:00.740000000 > 0:00:00.200000000, consider 1 lost (0:00:00.293333332)
...
INFO                 basesrc gstbasesrc.c:2839:gst_base_src_loop:<rtpfilesrc0> pausing after gst_base_src_get_range() = eos
INFO                    task gsttask.c:316:gst_task_func:<rtpfilesrc0:src> Task going to paused

and at this point it remains blocked.

This is the pipeline I am using:

    gst-launch-1.0 rtpfilesrc location=/tmp/input.rtp ! "application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)PCMA" ! rtpjitterbuffer mode=0 max-rtcp-rtp-time-diff=-1 ! decodebin ! wavenc ! filesink location=/tmp/out.wav

Rtpfilesrc is a plugin I have written that reads an RTP dump and becomes a source of UDP packets. I used PushSrc as the base class and have overridden "fill".
In init() I am using the following configuration:
  gst_base_src_set_live (GST_BASE_SRC (rtpfilesrc), TRUE);
  gst_base_src_set_format (GST_BASE_SRC (rtpfilesrc), GST_FORMAT_TIME);
  // do not make rtpfilesrc set timestamps on outgoing buffers based on the running_time when they were captured
  gst_base_src_set_do_timestamp (GST_BASE_SRC (rtpfilesrc), FALSE);

What should I do?

Thank you in advance.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel