mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-16 08:56:40 -05:00
limit number of concurrent RTP streams
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@730 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
08397d98e2
commit
2f3fa42ca6
1 changed files with 12 additions and 0 deletions
|
|
@ -97,6 +97,8 @@ struct userdata {
|
|||
pa_hashmap *by_origin;
|
||||
|
||||
char *sink_name;
|
||||
|
||||
int n_sessions;
|
||||
};
|
||||
|
||||
static void session_free(struct session *s, int from_hash);
|
||||
|
|
@ -261,6 +263,11 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
|
|||
int fd = -1;
|
||||
pa_memblock *silence;
|
||||
|
||||
if (u->n_sessions >= MAX_SESSIONS) {
|
||||
pa_log(__FILE__": session limit reached.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(sink = pa_namereg_get(u->core, u->sink_name, PA_NAMEREG_SINK, 1))) {
|
||||
pa_log(__FILE__": sink does not exist.");
|
||||
goto fail;
|
||||
|
|
@ -324,6 +331,8 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
|
|||
|
||||
pa_log_info(__FILE__": Found new session '%s'", s->sdp_info.session_name);
|
||||
|
||||
u->n_sessions++;
|
||||
|
||||
return s;
|
||||
|
||||
fail:
|
||||
|
|
@ -355,6 +364,9 @@ static void session_free(struct session *s, int from_hash) {
|
|||
pa_sdp_info_destroy(&s->sdp_info);
|
||||
pa_rtp_context_destroy(&s->rtp_context);
|
||||
|
||||
assert(s->userdata->n_sessions >= 1);
|
||||
s->userdata->n_sessions--;
|
||||
|
||||
pa_xfree(s);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue