--- gst/subparse/gstsubparse.c.org	2011-01-07 09:51:27.000000000 +0800
+++ gst/subparse/gstsubparse.c	2011-10-14 11:00:30.457916000 +0800
@@ -237,6 +237,11 @@
 
   subparse->fps_n = 24000;
   subparse->fps_d = 1001;
+  
+  // initialize lock and cond
+  subparse->mutex = g_mutex_new();
+  subparse->cond = g_cond_new();
+  subparse->is_seek_requested = FALSE;  
 }
 
 /*
@@ -342,6 +347,12 @@
         GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
       }
 
+      // wakeup chain function
+      g_mutex_lock (self->mutex);
+      self->is_seek_requested = FALSE;
+      g_cond_signal(self->cond);    
+      g_mutex_unlock(self->mutex);
+
       gst_event_unref (event);
       break;
     }
@@ -1570,6 +1581,14 @@
 
   self = GST_SUBPARSE (GST_PAD_PARENT (sinkpad));
 
+  // sleep here to wait for seek complete
+  g_mutex_lock (self->mutex);
+  if (self->is_seek_requested == TRUE)
+  {    
+    g_cond_wait(self->cond, self->mutex);    
+  }
+  g_mutex_unlock(self->mutex);
+
   /* Push newsegment if needed */
   if (self->need_segment) {
     GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
@@ -1655,6 +1674,9 @@
     case GST_EVENT_FLUSH_STOP:
     {
       self->flushing = FALSE;
+      
+      // put chain function in sleep      
+      self->is_seek_requested = TRUE; 
 
       ret = gst_pad_event_default (pad, event);
       break;
