Commit 3bfc46fd authored by michaelni's avatar michaelni

*** fix for read()

Reading 1-char per read() is the less intrusive way to fix the behaviour I observed.
Not a nice fix, but the client requests shouldn't steal so much bandwidth
*** fix for find_rtp_session_with_url.
Note that mplayer send one PLAY request per stream, I don't know if this should be handled
more gracefully
patch by (Giancarlo Formicuccia <ilsensine at inwind dot it>)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1998 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 4d995d82
...@@ -786,14 +786,14 @@ static int handle_connection(HTTPContext *c) ...@@ -786,14 +786,14 @@ static int handle_connection(HTTPContext *c)
if (!(c->poll_entry->revents & POLLIN)) if (!(c->poll_entry->revents & POLLIN))
return 0; return 0;
/* read the data */ /* read the data */
len = read(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr); len = read(c->fd, c->buffer_ptr, 1);
if (len < 0) { if (len < 0) {
if (errno != EAGAIN && errno != EINTR) if (errno != EAGAIN && errno != EINTR)
return -1; return -1;
} else if (len == 0) { } else if (len == 0) {
return -1; return -1;
} else { } else {
/* search for end of request. XXX: not fully correct since garbage could come after the end */ /* search for end of request. */
uint8_t *ptr; uint8_t *ptr;
c->buffer_ptr += len; c->buffer_ptr += len;
ptr = c->buffer_ptr; ptr = c->buffer_ptr;
...@@ -2973,6 +2973,8 @@ static HTTPContext *find_rtp_session_with_url(const char *url, ...@@ -2973,6 +2973,8 @@ static HTTPContext *find_rtp_session_with_url(const char *url,
HTTPContext *rtp_c; HTTPContext *rtp_c;
char path1[1024]; char path1[1024];
const char *path; const char *path;
char buf[1024];
int s;
rtp_c = find_rtp_session(session_id); rtp_c = find_rtp_session(session_id);
if (!rtp_c) if (!rtp_c)
...@@ -2983,9 +2985,16 @@ static HTTPContext *find_rtp_session_with_url(const char *url, ...@@ -2983,9 +2985,16 @@ static HTTPContext *find_rtp_session_with_url(const char *url,
path = path1; path = path1;
if (*path == '/') if (*path == '/')
path++; path++;
if (strcmp(path, rtp_c->stream->filename) != 0) if(!strcmp(path, rtp_c->stream->filename)) return rtp_c;
return NULL; for(s=0; s<rtp_c->stream->nb_streams; ++s) {
snprintf(buf, sizeof(buf), "%s/streamid=%d",
rtp_c->stream->filename, s);
if(!strncmp(path, buf, sizeof(buf))) {
// XXX: Should we reply with RTSP_STATUS_ONLY_AGGREGATE if nb_streams>1?
return rtp_c; return rtp_c;
}
}
return NULL;
} }
static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h) static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment