How to modify RTSP data as it is being passed through c# proxy -
i writing proxy application uses rtsp streaming video content. works follows:
- the application (server) makes rtsp stream available on localhost port 8554.
- a client wishing connect stream connects proxy on localhost port 8553.
- my proxy connects rtsp stream (server) on localhost port 8554 , passes network traffic (bytes) along between client , server. (i don't inspect packets @ all, read bytes on 1 stream , pass bytes along other stream.)
since rtsp uses both tcp , udp communication, have have listeners both protocols on proxy, however, have not yet got implementing udp part. @ moment working on tcp handles "handshaking" start video transfer. actual video transfer on udp next step.
now question: passing messages ("options", "describe", "setup, etc.) along proxy. problem content of messages contains information streaming server. specifically, when server responds client's "describe" request, returns amongst others:
content-base: rtsp://127.0.0.1:8554/nurv/ before passing along client, need change on proxy to:
content-base: rtsp://127.0.0.1:8553/nurv/ because @ moment, when client issues subsequent "setup" request, requests:
setup rtsp://127.0.0.1:8554/nurv/track1 rtsp/1.0 which means actual streaming bypasses proxy on port 8553 , connects directly stream on 8554.
how can modify messages on proxy references actual server (i.e. 127.0.0.1:8554) replaced references proxy (i.e. 127.0.0.1:8553)? isn't optimal string search through each message being passed through proxy since mean unpacking , inspecting each message before repacking , sending on.
i have solved problem. since tcp connection of rtsp protocol typically contains control messages, number of messages being passed through here aren't many (5 or 6 each side if simple request start playback and, in end, end it). big traffic handled through udp connections.
as such, doesn't cause big performance issues if unpack, manipulate, , repackage messages being sent on tcp. read package, replace necessary ip addresses necessary , that's it. need read udp ports client , server negotiates proxy can go in-between. since traffic on tcp low, i'm able this.
Comments
Post a Comment