How to get RTCP sender report from rtspsrc element?
Ben Rush
ben at ben-rush.net
Tue Aug 31 15:57:39 UTC 2021
On Tue, Aug 31, 2021 at 10:50 AM 이병헌 <byunghun.lee at fainders.ai> wrote:
> Wow... I felt like I met a light in the middle of sea
> Really really thanks to your considerate answer..
>
> I wish you blessings, thanks.
>
You too, my friend. Stay safe and have a good day.
>
> 2021년 9월 1일 (수) 오전 12:33, Ben Rush <ben at ben-rush.net>님이 작성:
>
>>
>>
>> On Tue, Aug 31, 2021 at 8:49 AM 이병헌 <byunghun.lee at fainders.ai> wrote:
>>
>>> Awesome, thanks!!!
>>> You saved me
>>>
>>> And.. If you okay, and if you have, can you recommand me some papers or
>>> document to understand more deep about gstreamer?
>>> I tried myself with gstreamer official document in website, but in some
>>> cases, I got a feeling that stucked at a wall of knowledge...
>>>
>>
>> Yeah. I wouldn't say much of what I've encountered in using GStreamer is
>> complicated; I would say it's overwhelming in the sense that there's so
>> much to piece together in order to get done what you want to get done. I
>> often find myself having to dive into the source code to understand what
>> you want to do: most of the "documentation" I find are actually examples or
>> code snippets on GitHub.
>>
>> As an example, take the information I just gave you. How does one go
>> about figuring this out?
>>
>> I started with understanding the GObject system when I started learning
>> GStreamer. It's the paradigm upon which GStreamer's codebase is built. It
>> can, itself, be confusing at times to look at if you come from the
>> C++/C#/etc world. If you don't understand how to query properties, set
>> properties, register for events, clean up resources, etc. with the GObject
>> type system, you're going to be constantly confused when looking at
>> GStreamer code. So, start there. Google for the GObject type system and
>> follow the examples and walk through it. It's not hard, it's just different
>> to look at.
>>
>> Then understand the basics of how pipelines are constructed. Some good
>> documentation:
>> https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c.
>> Now that you understand the GObject type system, you can understand the
>> nature of this code a bit better. Understand concepts about bins and pads
>> and elements and how they tie together and are constructed. One way that's
>> really good to understand this is to understand how to generate pipeline
>> graphs:
>> https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html?gi-language=c#getting-pipeline-graphs
>> .
>>
>> Next it's about understanding the "objects" that relate to your problem.
>> You're dealing with RTP. So, Google "RTP GStreamer". The first link that
>> popped up is:
>> https://gstreamer.freedesktop.org/documentation/additional/rtp.html?gi-language=c.
>> Now, focus on the objects / components involved. Some examples include:
>> rtpbin, rtpmanager, rtpsession, etc. These objects are going to relate to
>> elements in the pipeline that gets built. Using the GObject system, you can
>> query these elements, get their properties, set their properties, etc.
>>
>> That's how I discovered "internal-session" on the GstRTPSession object:
>> it got the RTPSession object, which has a signal ("event") for getting the
>> RTCP packets. All of this was the result of crawling the documentation,
>> looking at sample code on github by finding a couple of snippets here and
>> there until I pull together a more complete picture.
>>
>> ...and there may be a better way to do it too. That's the other thing.
>> There's often several ways to get to the end goal.
>>
>> One final word: if you're on Windows, be forewarned. At times things
>> don't work as expected there. A lot of (very good) work has been done by
>> some smart people to get it there, but the focus is still very clearly on
>> Linux by many.
>>
>>
>>> Anyway whether you recommand it to me or not,
>>> Thank you.
>>>
>>>
>>> 2021년 8월 31일 (화) 오후 10:19, Ben Rush <ben at ben-rush.net>님이 작성:
>>>
>>>> Hello
>>>>
>>>> On Tue, Aug 31, 2021 at 1:30 AM 이병헌 via gstreamer-devel <
>>>> gstreamer-devel at lists.freedesktop.org> wrote:
>>>>
>>>>> Hi.
>>>>> I’m new on gstreamer, and I have some problem with this issue for many
>>>>> days..
>>>>>
>>>>> I need to get absolute timestamp from multiple rtsp camera.
>>>>> And with some effort, I got to know that I can get absolute timestamp
>>>>> from "RTCP SR(sender report)” in RTSP packets
>>>>> But I can not find the proper way to get RTCP SR from rtspsrc element
>>>>> or rtpbin in gstreamer document..
>>>>> And actually I can not understand well about rtpbin’s role
>>>>> So my questions are
>>>>>
>>>>> 1. How to get RTCP SR with rtspsrc element or rtpbin element
>>>>>
>>>>
>>>> With your pipeline, get the GstRTPSession:
>>>>
>>>> rtpSession = gst_bin_get_by_name(GST_BIN(_pipeline->pipeline),
>>>> "rtpsession0");
>>>>
>>>> Get the internal RTPSession from it:
>>>>
>>>> GstElement* internalRtpSession;
>>>> g_object_get(rtpSession, "internal-session", &internalRtpSession, NULL);
>>>>
>>>> Connect to on-receiving-rtcp:
>>>>
>>>> g_signal_connect(internalRtpSession, "on-receiving-rtcp",
>>>> G_CALLBACK(on_rtcp_callback), NULL);
>>>>
>>>> Iterate over the RTCP packets in the buffer:
>>>>
>>>> GstRTCPBuffer rtcpBuffer = GST_RTCP_BUFFER_INIT;
>>>> gst_rtcp_buffer_map(buffer, GST_MAP_READ, &rtcpBuffer);
>>>> GstRTCPPacket rtcpPacket;
>>>> if (gst_rtcp_buffer_get_first_packet(&rtcpBuffer, &rtcpPacket))
>>>> {
>>>> while (gst_rtcp_packet_move_to_next(&rtcpPacket))
>>>> {
>>>> GstRTCPType type = gst_rtcp_packet_get_type(&rtcpPacket);
>>>>
>>>>>
>>>>> 2. If I connect devices into rtpbin element, then does rtpbin sync
>>>>> sources from multiple device automatically?
>>>>> I mean, suppose If there are two rtsp camera CAM_1 CAM_2, and if I
>>>>> send PLAY request in same time on my client
>>>>> And if there have network delay, so client get packets of PLAY request
>>>>> of CAM_1 10 seconds more later than CAM_2
>>>>> Then does rtpbin element sync that 10 seconds automatically?
>>>>>
>>>>
>>>> I'm not sure.
>>>>
>>>>
>>>>>
>>>>> Thanks for reading.
>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210831/336b7937/attachment-0001.htm>
More information about the gstreamer-devel
mailing list