summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-04-10 20:21:45 +0000
committerphintuka <phintuka>2008-04-10 20:21:45 +0000
commit6a9c80a8ec8f8eb1ea1b3c66d259c6013b3e00bc (patch)
tree98611329531ee9cea27d02d13e6d4b27711abe25
parentdfd44f84954852ad0732dd66a0767d053a1fdeb1 (diff)
downloadxineliboutput-6a9c80a8ec8f8eb1ea1b3c66d259c6013b3e00bc.tar.gz
xineliboutput-6a9c80a8ec8f8eb1ea1b3c66d259c6013b3e00bc.tar.bz2
Deliver DISCARD control message in both streams (data and control).
(protect against random delays in control stream)
-rw-r--r--frontend.c6
-rw-r--r--frontend_svr.c12
-rw-r--r--xine_input_vdr.c14
3 files changed, 20 insertions, 12 deletions
diff --git a/frontend.c b/frontend.c
index 3739eaa0..9d267e4a 100644
--- a/frontend.c
+++ b/frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend.c,v 1.53 2008-04-03 08:08:27 phintuka Exp $
+ * $Id: frontend.c,v 1.54 2008-04-10 20:21:45 phintuka Exp $
*
*/
@@ -400,7 +400,11 @@ void cXinelibThread::Clear(void)
char buf[128];
snprintf(buf, sizeof(buf), "DISCARD %" PRId64 " %d", tmp1, tmp2);
+ /* Send to control stream and data stream. If message is sent only to
+ * control stream, and it is delayed, engine flush will be skipped.
+ */
Xine_Control(buf);
+ Xine_Control_Sync(buf);
}
bool cXinelibThread::Flush(int TimeoutMs)
diff --git a/frontend_svr.c b/frontend_svr.c
index caa92639..720106f8 100644
--- a/frontend_svr.c
+++ b/frontend_svr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend_svr.c,v 1.55 2008-04-03 08:10:49 phintuka Exp $
+ * $Id: frontend_svr.c,v 1.56 2008-04-10 20:21:45 phintuka Exp $
*
*/
@@ -172,14 +172,14 @@ void cXinelibServer::Clear(void)
LOCK_THREAD;
- cXinelibThread::Clear();
-
for(int i = 0; i < MAXCLIENTS; i++)
if(fd_control[i].open() && m_Writer[i])
m_Writer[i]->Clear();
if(m_Scheduler)
m_Scheduler->Clear();
+
+ cXinelibThread::Clear();
}
void cXinelibServer::CloseDataConnection(int cli)
@@ -639,11 +639,11 @@ int cXinelibServer::Xine_Control_Sync(const char *cmd)
if(cmd && *cmd) {
int i, len, UdpClients = 0, RtpClients = 0;
- char buf[4096];
+ char buf[256];
- len = snprintf(buf, sizeof(buf), "%s\r\n", cmd);
+ len = snprintf(buf, sizeof(buf), "%s\r\n", cmd) + 1;
if(len >= (int)sizeof(buf)) {
- LOGMSG("Xine_Control_Sync: command truncated !");
+ LOGMSG("Xine_Control_Sync: command truncated ! (%s)", cmd);
len = sizeof(buf);
}
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 4fdb94bc..83826c9b 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.125 2008-03-25 21:58:01 phintuka Exp $
+ * $Id: xine_input_vdr.c,v 1.126 2008-04-10 20:21:45 phintuka Exp $
*
*/
@@ -2476,6 +2476,7 @@ static void vdr_flush_engine(vdr_input_plugin_t *this)
_x_demux_control_start(this->stream);
#endif
this->stream_start = 1;
+ this->I_frames = this->B_frames = this->P_frames = 0;
resume_demuxer(this);
}
@@ -3553,10 +3554,13 @@ static int vdr_plugin_parse_control(input_plugin_t *this_gen, const char *cmd)
} else if(!strncasecmp(cmd, "DISCARD ", 8)) {
if(2 == sscanf(cmd, "DISCARD %" PRIu64 " %d", &tmp64, &tmp32)) {
pthread_mutex_lock(&this->lock);
- this->discard_index = tmp64;
- this->discard_frame = tmp32;
- vdr_flush_engine(this);
- this->I_frames = this->B_frames = this->P_frames = 0;
+ if(this->discard_index < tmp64) {
+ this->discard_index = tmp64;
+ this->discard_frame = tmp32;
+ vdr_flush_engine(this);
+ } else if(this->discard_index != tmp64) {
+ LOGMSG("Ignoring delayed control message %s", cmd);
+ }
pthread_mutex_unlock(&this->lock);
} else
err = CONTROL_PARAM_ERROR;