[gst-cvs] gst-plugins-base: rtsp: ignore \n and \r as the first line
Wim Taymans
wtay at kemper.freedesktop.org
Fri Feb 12 03:18:43 PST 2010
Module: gst-plugins-base
Branch: master
Commit: 30fd219e6367d413eb22961ad9a94ca74d286e8e
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=30fd219e6367d413eb22961ad9a94ca74d286e8e
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Fri Jan 29 16:34:44 2010 +0100
rtsp: ignore \n and \r as the first line
Be more forgiving for bad servers and ignore \r and \n when we are looking for
the response/request line.
See #608417
---
gst-libs/gst/rtsp/gstrtspconnection.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c
index 3548beb..813eefd 100644
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ b/gst-libs/gst/rtsp/gstrtspconnection.c
@@ -1834,22 +1834,31 @@ build_next (GstRTSPBuilder * builder, GstRTSPMessage * message,
while (TRUE) {
switch (builder->state) {
case STATE_START:
+ {
+ guint8 c;
+
builder->offset = 0;
res =
read_bytes (conn, (guint8 *) builder->buffer, &builder->offset, 1);
if (res != GST_RTSP_OK)
goto done;
+ c = builder->buffer[0];
+
/* we have 1 bytes now and we can see if this is a data message or
* not */
- if (builder->buffer[0] == '$') {
+ if (c == '$') {
/* data message, prepare for the header */
builder->state = STATE_DATA_HEADER;
+ } else if (c == '\n' || c == '\r') {
+ /* skip \n and \r */
+ builder->offset = 0;
} else {
builder->line = 0;
builder->state = STATE_READ_LINES;
}
break;
+ }
case STATE_DATA_HEADER:
{
res =
More information about the Gstreamer-commits
mailing list