changeset 9915:eabe876ab5e2

Fix cache uninit
author albeu
date Sat, 12 Apr 2003 13:53:33 +0000
parents 3c856c0fc45e
children 54f791edd847
files libmpdemux/cache2.c libmpdemux/stream.c
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cache2.c	Sat Apr 12 13:52:21 2003 +0000
+++ b/libmpdemux/cache2.c	Sat Apr 12 13:53:33 2003 +0000
@@ -196,6 +196,16 @@
   return s;
 }
 
+void cache_uninit(stream_t *s) {
+  cache_vars_t* c = s->cache_data;
+  if(!s->cache_pid) return;
+  kill(s->cache_pid,SIGKILL);
+  waitpid(s->cache_pid,NULL,0);
+  if(!c) return;
+  shmem_free(c->buffer,c->buffer_size);
+  shmem_free(s->cache_data,sizeof(cache_vars_t));
+}
+
 static void exit_sighandler(int x){
   // close stream
   exit(0);
--- a/libmpdemux/stream.c	Sat Apr 12 13:52:21 2003 +0000
+++ b/libmpdemux/stream.c	Sat Apr 12 13:53:33 2003 +0000
@@ -391,10 +391,7 @@
 //  printf("\n*** free_stream() called ***\n");
 #ifdef USE_STREAM_CACHE
   if(s->cache_pid) {
-//    kill(s->cache_pid,SIGTERM);
-    kill(s->cache_pid,SIGKILL);
-    waitpid(s->cache_pid,NULL,0);
-    shmem_free(s->cache_data);
+    cache_uninit(s);
   }
 #endif
   switch(s->type) {