Forum Discussion
Kirk_Bauer_1018
Altostratus
Jul 20, 2007How to tell when a RTSP request completes?
My knowledge of RTSP is very limited so maybe I'm not asking this properly. But it seems I can watch for the event RTSP_REQUEST to see when a new RTSP session is started. Does that session typically request just one video (accessible via RTSP::uri)? How do I tell when that video is done playing and/or that request is finished?
I want to be able to track the number of active RTSP streams per-URI. Something like this (using the persistence table to track data with timeouts):
when RULE_INIT {
array set ::uri_count { }
}
when RTSP_REQUEST {
set uri [RTSP::uri]
if { [ info exists ::uri_count($uri) ] } {
incr ::uri_count($uri)
} else {
set ::uri_count($uri) 1
}
}
when ?????????? {
if { [ info exists ::uri_count($uri) ] } {
decr ::uri_count($uri)
if { $uri_count($uri) <= 0 } {
unset ::uri_count($uri)
}
}
}
I just don't know how to detect when the request is finished... can anybody help?
4 Replies
- Brandon_Burns_8Historic F5 AccountKirk,
Is this limiting done on a per uri basis, or a per streaming server? It would be easier to limit the number of streams on a given server using the following rule.
when RULE_INIT {
array set connections { }
}
when CLIENT_ACCEPTED {
if { [info exists ::connections([IP::local_addr])] } {
if { [incr ::connections([IP::local_addr])] > 1000 } {
reject
}
} else {
set ::connections([IP::local_addr]) 1
}
}
when CLIENT_CLOSED {
if { [incr ::connections([IP::local_addr]) -1] <= 0 } {
unset ::connections([IP::local_addr])
}
} - Kirk_Bauer_1018
Altostratus
Unfortunately per-URI. They want URI persistence but want to limit the maximum number of connections for one URI on one server. - Kirk_Bauer_1018
Altostratus
Does anybody know how the events are chained and in which order? For example, if I do this:
when RTSP_REQUEST {
set uri [RTSP::uri]
}
Can I later reference $uri in LB_SELECTED, SERVER_CONNECT, and SERVER_CLOSED? Anybody know of a easy way to test RTSP (i.e. a server out there I can point to)? - Deb_Allen_18Historic F5 AccountYes, you can reference the variable in any subsequent event for the life of the connection.
/deb
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects