Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to rtspsrc protocols #39

Open
yengliong93 opened this issue Jun 10, 2022 · 6 comments
Open

Support to rtspsrc protocols #39

yengliong93 opened this issue Jun 10, 2022 · 6 comments

Comments

@yengliong93
Copy link

Hi, I have created a new element for rtspsrc and set the protocols to tcp. From the rtsp server logs, it is still using UDP protocol to fetch the video stream. Is the rtspsrc element supported? How can we set its protocols?

Codes:

    src, err := gst.NewElement("rtspsrc")
    if err != nil {
            return nil, err
    }
    src.Set("protocols", "tcp")

RTSP logs:

rtsp-simple-server_1 | 2022/06/10 06:35:35 INF [RTSP] [session 896969789] is reading from path 'final_new.h264', 1 track with UDP
rtsp-simple-server_1 | 2022/06/10 06:35:43 INF [RTSP] [session 896969789] destroyed (teared down by 10.72.4.66:47506)
rtsp-simple-server_1 | 2022/06/10 06:35:43 INF [RTSP] [conn 10.72.4.66:47506] closed (EOF)

@brucekim
Copy link
Collaborator

Hi

go-gst is a binding for gstramer in go language in which all gstramer functionalities are supported.

How does your rtsp configure with? Does it correctly set up to use tcp?
'''
protocols
“protocols” GstRTSPLowerTrans *
Allowed lower transport protocols

Flags : Read / Write

Default value : tcp+udp-mcast+udp
'''

@yengliong93
Copy link
Author

Hi,
Yes, the rtsp server is supported tcp protocol. I run the gst-launch command. The command is reading the stream with TCP protocols.

gst-launch command:
gst-launch-1.0 -e rtspsrc protocols=tcp location=rtsp://10.72.4.66:8554/final_new.h264 ! fakesink async=false

RTSP logs:

rtsp-simple-server_1 | 2022/06/13 00:34:07 INF [RTSP] [conn 10.72.4.66:47512] opened
rtsp-simple-server_1 | 2022/06/13 00:34:07 INF [RTSP] [session 111889720] created by 10.72.4.66:47512
rtsp-simple-server_1 | 2022/06/13 00:34:08 INF [RTSP] [session 111889720] is reading from path 'final_new.h264', 1 track with TCP

In my code, I am able to set location of rtspsrc. It can connect to my rtsp server and the filename is correct. However, the set to protocols doesn't take effect.

@brucekim
Copy link
Collaborator

First of all, check the return value from Set("protocols", "tcp") in order to verify whether there is no error.

Second as alternative way, try to use SetArg() instead of Set()

  • SetArg() doesn`t have any return value, but it is useful for unsupported type in go-gst to set argument into gst object.
func (o *Object) SetArg(name, value string) {

@yengliong93
Copy link
Author

Thanks, the SetArg() works. The next step is I am trying to link both rtspsrc and fakesink. An error happened when I use ElementLinkMany to link them.

Error:

Error Happen: Failed to link rtspsrc0 to fakesink0

My codes:

    fakesink, err := gst.NewElement("fakesink")
    if err != nil {
            return nil, err
    }
    fakesink.SetArg("async", "false")
    anyerror := pipeline.AddMany(src, fakesink)
    if anyerror != nil {
            fmt.Println("Error Happen: ", anyerror)
    }
    anyerror = gst.ElementLinkMany(src, fakesink)
    if anyerror != nil {
            fmt.Println("Error Happen: ", anyerror)
    }

Any idea?

@brucekim
Copy link
Collaborator

Strange,
Does the rtspsrc successfully be created?

I suggest you to debug logs with enable DEBUG level into gstreamer.

@yengliong93
Copy link
Author

I figure it out by connecting the rtspsrc's pad-added signal. The issue has been discussed in
https://stackoverflow.com/questions/32233370/gstreamer-1-0-rtspsrc-to-rtph264depay-cannot-link

Thanks for all the advices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants