changeset 21842:f0040ff1ba40

Don't drop last rdt packet on eof
author rtogni
date Tue, 09 Jan 2007 21:32:25 +0000
parents 4cdc4b2cd3da
children 7e5c4075fcdf
files stream/librtsp/rtsp_session.c stream/realrtsp/real.c stream/realrtsp/real.h
diffstat 3 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stream/librtsp/rtsp_session.c	Tue Jan 09 20:02:13 2007 +0000
+++ b/stream/librtsp/rtsp_session.c	Tue Jan 09 21:32:25 2007 +0000
@@ -208,6 +208,8 @@
     (char *) (this->real_session->recv + this->real_session->recv_read);
   int fill = this->real_session->recv_size - this->real_session->recv_read;
 
+  if(this->real_session->rdteof)
+    return -1;
   if (len < 0) return 0;
   if (this->real_session->recv_size < 0) return -1;
   while (to_copy > fill) {
@@ -218,8 +220,10 @@
     this->real_session->recv_read = 0;
     this->real_session->recv_size =
       real_get_rdt_chunk (this->s, (char **)&(this->real_session->recv));
-    if (this->real_session->recv_size < 0)
-      return -1;
+    if (this->real_session->recv_size < 0) {
+      this->real_session->rdteof = 1;
+      this->real_session->recv_size = 0;
+    }
     source = (char *) this->real_session->recv;
     fill = this->real_session->recv_size;
 
--- a/stream/realrtsp/real.c	Tue Jan 09 20:02:13 2007 +0000
+++ b/stream/realrtsp/real.c	Tue Jan 09 21:32:25 2007 +0000
@@ -649,6 +649,7 @@
 
   real_rtsp_session = malloc (sizeof (struct real_rtsp_session_t));
   real_rtsp_session->recv = xbuffer_init (BUF_SIZE);
+  real_rtsp_session->rdteof = 0;
 
   return real_rtsp_session;
 }
--- a/stream/realrtsp/real.h	Tue Jan 09 20:02:13 2007 +0000
+++ b/stream/realrtsp/real.h	Tue Jan 09 21:32:25 2007 +0000
@@ -45,6 +45,8 @@
   uint8_t header[HEADER_SIZE];
   int header_len;
   int header_read;
+
+  int rdteof;
 };
 
 int real_get_rdt_chunk(rtsp_t *rtsp_session, char **buffer);