Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /src/xine-engine/video_out.c [7d8f10] .. [271a94] Maximize Restore

  Switch to side-by-side view

--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.c
@@ -1364,21 +1364,11 @@
     pthread_mutex_unlock( &img->stream->current_extra_info_lock );
   }
 
-  if (this->overlay_source) {
-    this->overlay_source->multiple_overlay_blend (this->overlay_source,
-						  vpts,
-						  this->driver, img,
-						  this->video_loop_running && this->overlay_enabled);
-  }
-
-  vo_grab_current_frame (this, img, vpts);
-
-  this->driver->display_frame (this->driver, img);
-
-  /*
-   * Wake up xine_play if it's waiting for a frame
+  /* xine_play() may be called from a thread that has the display device locked
+   * (eg an X window event handler). If it is waiting for a frame we better wake
+   * it up _before_ we start displaying, or the first 10 seconds of video are lost.
    */
-  if( this->last_frame->is_first ) {
+  if( img->is_first ) {
     pthread_mutex_lock(&this->streams_lock);
     for (ite = xine_list_front(this->streams); ite;
          ite = xine_list_next(this->streams, ite)) {
@@ -1393,6 +1383,17 @@
     }
     pthread_mutex_unlock(&this->streams_lock);
   }
+
+  if (this->overlay_source) {
+    this->overlay_source->multiple_overlay_blend (this->overlay_source,
+						  vpts,
+						  this->driver, img,
+						  this->video_loop_running && this->overlay_enabled);
+  }
+
+  vo_grab_current_frame (this, img, vpts);
+
+  this->driver->display_frame (this->driver, img);
 
   this->redraw_needed = 0;
 }