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

Multiplexer, how it actually works? #72

Open
kamilk91 opened this issue Feb 18, 2022 · 0 comments
Open

Multiplexer, how it actually works? #72

kamilk91 opened this issue Feb 18, 2022 · 0 comments

Comments

@kamilk91
Copy link

kamilk91 commented Feb 18, 2022

Hello, i have implemented your code but i have some troubles:

So i created server with .Net 6:

public RtcpServerService(ILogger<RtcpServerService> logger)
        {
            this._logger = logger;
            Contract.EndContractBlock();

            RtspUtils.RegisterUri();
            _RTSPServerListener = new TcpListener(IPAddress.Any, ConfigInstance.config.RTSPPort); //port is 2525
        }

And i wanted to connect to port 2525 with OBS Studio.

image

i realized that there is wrong way, because i have received bla bla bla Invalid header, so my idea was it is port to connect with Client and it was good move. I connected with VLC, received message, logged it and stayed connected.

Then i tried to transmit video from mp4 to vlc, and your also to your Client sample.

private void AcceptConnection()
        {
            try
            {
                while (!_Stopping.WaitOne(0))
                {
                    TcpClient oneClient = _RTSPServerListener.AcceptTcpClient();
                    RtspListener newListener = new RtspListener(
                        new RtspTcpTransport(oneClient));
                    RTSPDispatcher.Instance.AddListener(newListener);

                    newListener.Start();

                    try
                    {

                        string path = "./wwwroot/victor.mp4";

                        var msg = new Rtsp.Messages.RtspMessage
                        {

                            Data = System.IO.File.ReadAllBytes(path),

                        };
                        msg.AddHeader("Transport: RTP/AVP/TCP;interleaved=0");
                        newListener.SendMessage(msg);
                    }
                    catch (Exception) { }
                }
            }
            catch (SocketException error)
            {
                _logger.LogWarning("Got an error listening, I have to handle the stopping which also throw an error", error);
            }
            catch (Exception error)
            {
                _logger.LogError("Got an error listening...", error);
                throw;
            }


        }

So, your client printed some string representation of unreadable bytes, and then vlc just crashed (propably didn't know what to do with this data).

I still have no idea how to make connection like:

Me with camera/desktop sharing from OBS => RtspServer with your library => receiver in web client.
I see that your library is opening some connections and ports like

Connection Open 127.0.0.1:6431
Receive from 127.0.0.1:6431

Can you give me some tips how to achieve that?
I will be greatful!

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

1 participant