Revision: 8857
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8857&view=rev
Author:   jpgr87
Date:     2010-08-15 21:24:36 +0000 (Sun, 15 Aug 2010)

Log Message:
-----------
Applied patch #3044485: Player SVN: camerav4l2 again

Modified Paths:
--------------
    code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc

Modified: code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc
===================================================================
--- code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc  2010-08-15 
21:22:14 UTC (rev 8856)
+++ code/player/trunk/server/drivers/camera/v4l2/camerav4l2.cc  2010-08-15 
21:24:36 UTC (rev 8857)
@@ -570,6 +570,7 @@
 {
   struct timespec tspec;
   player_camera_data_t * data = NULL;
+  int current;
 
   for (;;)
   {
@@ -590,7 +591,8 @@
       PLAYER_ERROR("Out of memory");
       continue;
     }
-    if (this->prepareData(data, !(this->request_only)))
+    current = this->prepareData(data, !(this->request_only));
+    if (current < 0)
     {
       free(data);
       data = NULL;
@@ -599,10 +601,10 @@
     }
     if (!(this->request_only))
     {
-      Publish(this->camera_addrs[this->current_source],
-              PLAYER_MSGTYPE_DATA, PLAYER_CAMERA_DATA_STATE,
-              reinterpret_cast<void *>(data), 0, NULL, false);
-              // copy = false, don't dispose anything here!
+      this->Publish(this->camera_addrs[current],
+                    PLAYER_MSGTYPE_DATA, PLAYER_CAMERA_DATA_STATE,
+                    reinterpret_cast<void *>(data), 0, NULL, false);
+                    // copy = false, don't dispose anything here!
     } else
     {
       if (data->image)
@@ -624,6 +626,7 @@
   const unsigned char * img;
   struct timespec tspec;
   int i = 0;
+  int current;
 
   assert(data);
   assert(this->fg);
@@ -632,6 +635,8 @@
     if (this->useSource()) return -1;
   }
   if (!(this->started)) return -1;
+  current = this->current_source;
+  assert(current >= 0);
   // Grab the next frame (blocking)
   img = get_image(this->fg);
   if (this->failsafe)
@@ -711,7 +716,7 @@
       assert(!(this->useSource()));
     }
   }
-  return 0;
+  return current;
 }
 
 int CameraV4L2::ProcessMessage(QueuePointer & resp_queue,
@@ -799,12 +804,12 @@
     {
       if (this->current_source != i)
       {
-        assert((this->current_source) > 1);
+        assert((this->sources_count) > 1);
         this->next_source = i;
         if (this->useSource()) return -1;
       }
       assert((this->current_source) == i);
-      if (this->prepareData(&imgData, 0)) return -1;
+      if (this->prepareData(&imgData, 0) != i) return -1;
       this->Publish(this->camera_addrs[i],
                     resp_queue,
                     PLAYER_MSGTYPE_RESP_ACK,


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to