Author: tack
Date: Wed Dec 20 21:53:38 2006
New Revision: 2258

Modified:
   trunk/xine/src/drivers/kaa.c
   trunk/xine/src/drivers/video_out_kaa.c

Log:
If frame output shmem buffer takes too long to unlock then abort, don't write
over a locked buffer (prevent possible image corruption); be more pedantic
with mutex locks in gui_data_exchange; fix crasher in alpha premul
(premultiply_alpha_byte_8 was being called even when < 8 bytes were available).


Modified: trunk/xine/src/drivers/kaa.c
==============================================================================
--- trunk/xine/src/drivers/kaa.c        (original)
+++ trunk/xine/src/drivers/kaa.c        Wed Dec 20 21:53:38 2006
@@ -155,6 +155,8 @@
                 now = curtime.tv_sec + (curtime.tv_usec/(1000.0*1000));
                 usleep(1);
             }
+            if (now - start_time >= 0.1)
+                break;
             
             if (dst_width == -1)
                 dst_width = frame->width;

Modified: trunk/xine/src/drivers/video_out_kaa.c
==============================================================================
--- trunk/xine/src/drivers/video_out_kaa.c      (original)
+++ trunk/xine/src/drivers/video_out_kaa.c      Wed Dec 20 21:53:38 2006
@@ -531,14 +531,14 @@
 
     for (y = 0; y < rh; y++) {
         n_planes = 1;
-        for (x = 0; x < rw; x += 8)
+        for (x = 0; x < rw & ~7; x += 8)
             premultiply_alpha_byte_8(&ptr[0][x], &alpha_ptr[0][x], 
&pre_ptr[0][x], &pre_alpha_ptr[0][x], global_alpha);
 
         for (; x < rw; x++)
             premultiply_alpha_byte(ptr[0][x], alpha_ptr[0][x], &pre_ptr[0][x], 
&pre_alpha_ptr[0][x], global_alpha);
 
         if (y % 2 == 0 && this->osd_format == XINE_IMGFMT_YV12) {
-            for (x = 0; x < (rw >> 1); x += 8) {
+            for (x = 0; x < (rw >> 1) & ~7; x += 8) {
                 premultiply_alpha_byte_8(&ptr[1][x], &alpha_ptr[1][x], 
&pre_ptr[1][x], &pre_alpha_ptr[1][x], global_alpha);
                 premultiply_alpha_byte_8(&ptr[2][x], &alpha_ptr[2][x], 
&pre_ptr[2][x], &pre_alpha_ptr[2][x], global_alpha);
             }
@@ -958,16 +958,21 @@
 {
     kaa_driver_t *this = (kaa_driver_t *)this_gen;
 
+    // FIXME: handle XINE_GUI_SEND_DRAWABLE_CHANGED for opengl vsync.
     switch(data_type) {
         case GUI_SEND_KAA_VO_SET_PASSTHROUGH:
+            pthread_mutex_lock(&this->osd_buffer_lock);
             this->do_passthrough = (int)data;
             if (this->do_passthrough)
                 this->needs_redraw = 1;
+            pthread_mutex_unlock(&this->osd_buffer_lock);
             break;
 
         case GUI_SEND_KAA_VO_OSD_SET_VISIBILITY:
+            pthread_mutex_lock(&this->osd_buffer_lock);
             this->osd_visible = (int)data;
             this->needs_redraw = 1;
+            pthread_mutex_unlock(&this->osd_buffer_lock);
             break;
 
         case GUI_SEND_KAA_VO_OSD_INVALIDATE_RECT:
@@ -981,8 +986,8 @@
                 image_premultiply_alpha(this, r[i].x, r[i].y, r[i].w, r[i].h);
             }
             calculate_slice(this);
-            pthread_mutex_unlock(&this->osd_buffer_lock);
             this->needs_redraw = 1;
+            pthread_mutex_unlock(&this->osd_buffer_lock);
             break;
         }
         case GUI_SEND_KAA_VO_OSD_SET_ALPHA:

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to