I am creating an application where I need to have access to rtspsrc sender report. So I added a new-manager callback to rtspsrc element and inside that callback I retrieve its manager (aka rtpbin), and then after getting its recv_rtcp_sink_0 session using "get-internal-session" Action-Signal, connected an "on-receiving-rtcp" signal to the session.
static void new_manager_callback (
GstElement * rtspsrc,
GstElement * manager,
gpointer udata)
{
/*
rtspsrc - a rtspsrc
manager - a GstElement
udata - No description available
*/
GstPad *sinkpad;
GObject *session;
sinkpad = gst_element_request_pad_simple (manager, "recv_rtcp_sink_0");
if (!sinkpad) {
g_printerr("Failed to get sinkpad\n");
return;
}
g_signal_emit_by_name (manager, "get-internal-session", 0, &session);
g_print("requested session\n");
if (!session) {
g_printerr("Failed to get internal session\n");
return;
}
// // callback (GstElement * session, GstBuffer * buffer, gpointer udata)
g_print("creating on-receiving-rtcp cb\n");
// g_signal_connect(session, "on-receiving-rtcp", G_CALLBACK (on_receiving_rtcp_callback), NULL)
g_signal_connect_after (session, "on-receiving-rtcp", G_CALLBACK (on_receiving_rtcp_callback), NULL);
// g_print("after on-receiving-rtcp cb0000");
g_object_unref(session);
}
This works great when I run it on the host, and I am able to get the SR, but when I move the application to a docker container based on the same Ubuntu version as host, with the exact same gstreamer version, I do not receive the RTCP packets callback.
Note that I receive RTP data packets on a callback connected to rtph264depay element, as well as the new-sample callback of appsink in both host and docker.
So basically, inside docker we receive RTP data packets but not the RTCP packets. I used port-range property of rtspsrc to set the UDP RTP/RTCP ports and the map those ports to my host and it didn't work out.
here is my pipeline:
rtspsrc location=%s name=rtsp ! rtph264depay name=rtpdepay ! avdec_h264 ! videoconvert ! appsink name=appsink sync=true emit-signals=true
what are the possible cause of this problem? is there any network bridge or host network settings preventing RTCP packets from being forward to the docker container from host?
I used port-range option to use specific RTP/RTCP ports, and mapped those point to host and It did not work.
I also tried enabling forwading: Docker network bridge not working from outside
when I set the protocols property to tcp, it worked fine inside docker. this shows that the docker maps tcp ports by default.
for rtsp with UDP, The port-range was a good try, I just needed to add udp protcol to docker-compose when I was mapping the ports.
ports:
- "60000-60201:60000-60201/udp"
- "60000-60201:60000-60201/udp"