]> git.vomp.tv Git - vompclient-marten.git/commitdiff
*** empty log message ***
authorChris Tallon <chris@vomp.tv>
Mon, 13 Nov 2006 23:14:00 +0000 (23:14 +0000)
committerChris Tallon <chris@vomp.tv>
Mon, 13 Nov 2006 23:14:00 +0000 (23:14 +0000)
command.cc
command.h
messagequeue.h
player.cc

index e6ba5eec38ffdd878401d3d23d37830431ea8b91..2cbdeb586b8cd598516ebf82cdca891b52b7c29d 100644 (file)
@@ -236,6 +236,49 @@ bool Command::postMessageIfNotBusy(Message* m)
 #endif
 }
 
+void Command::postMessageFromOuterSpace(Message* m)
+{
+  /*
+  Yet another way of getting messages into Command. This one is for events that
+  are not standard button presses (or UDP generated buttons). It is also not for
+  events that are generated as a result of other events (events that can safely
+  call postMessageNoLock and be guaranteed that the message will be processed
+  because it is known that the queue is currently being processed).
+  This is for events that come from outer space and can occur when the master
+  mutex is locked or not, they need to be queued and executed but it doesn't
+  matter when.
+  Actually so far it is for events caused by the video stream - aspect ratio
+  changes. These can occur when the master mutex is locked and so postMessage
+  doesn't work. postMessageNoLock doesn't work because if the mutex *isn't*
+  locked at the time then the message could be sat around a while before
+  being noticed.
+  The whole message system was at first supposed to prevent the problem of
+  calling a function on an object that had just been deleted, by ordering
+  messages such that all calls are done before object deletion. However,
+  because of the new centralised messaging system and the fact that ViewMan
+  locates the destination object before calling it, the messaging system now
+  allows the kind of sloppy calls it was supposed to stop. Weird huh. This
+  is mentioned here because the video stream might generate an event just as
+  the user hits stop. The mutex is locked, and by the time the message
+  is examined the vvideorec/live has been deleted. This doesn't matter because
+  viewman will drop the message if it can't find the matching object to
+  deliver it to.
+  Finally, all this is fine and dandy, except that I'm not 100% sure that
+  this sloppy postMessage and hope a queued signal will force it to be processed
+  thingy will actually work. Hmmm.
+  Lastly <g>, I will consider making the naming system a little more sane
+  if this works.
+  */
+
+  logger->log("Command", Log::DEBUG, "PMFOS called");
+  MessageQueue::postMessage(m);
+  kill(mainPid, SIGURG);
+
+  // FIXME: Marten - if this actually works on the MVP then you will need
+  // to come up with the Windows equivalent here.
+
+}
+
 void Command::processMessage(Message* m)
 {
   logger->log("Command", Log::DEBUG, "processing message %i", m->message);
@@ -247,6 +290,10 @@ void Command::processMessage(Message* m)
     // objects deriving from messagequeues, make them derive from
     // messagereceiver - then one messagequeue can deliver any message to anywhere
 
+    // FIXME - a slight modification - how if messagereceivers were to register
+    // themselves as receivers to avoid the calling-a-deleted-object problem
+    // then only deliver/register/unregister would have to be protected
+
     // deliver timer
 
     logger->log("Command", Log::DEBUG, "sending timer");
index c38272c731d78f06aee6063c12e906eef6b9102f..a5a6d03e4abc65b40e4f60775c6419ff4d0a6b2c 100644 (file)
--- a/command.h
+++ b/command.h
@@ -77,6 +77,7 @@ class Command : public MessageQueue
     void postMessage(Message* m); // override of MessageQueue::postMessage
     void postMessageNoLock(Message* m); // override of MessageQueue::postMessage
     bool postMessageIfNotBusy(Message* m); // for timers, when masterMutex might be locked
+    void postMessageFromOuterSpace(Message* m); // err, read the cc comments.
     void sig1();
     void connectionLost();
 
index 2f5a7efd8dac5c867ed45771041f4e43150cac55..9949424b7498ea1e91f41949a4da97b1cae1a68f 100644 (file)
@@ -36,12 +36,15 @@ class MessageQueue
     virtual ~MessageQueue() {};
 
     virtual void postMessage(Message* m);
+    virtual void postMessageNoLock(Message* m)=0;
+    virtual void postMessageFromOuterSpace(Message* m)=0;
 
   protected:
     virtual void processMessageQueue();
     virtual void processMessage(Message* m)=0;
 
 
+
   private:
     MQueue messages;
 
index c36b8660e2f71db13418debfb461ea1a3b50416d..173fc0163bfcb61d6ee31a1aa2fff9f77f086155 100644 (file)
--- a/player.cc
+++ b/player.cc
@@ -726,7 +726,7 @@ void Player::call(void* caller)
       m->to = messageReceiver;
       m->message = Message::PLAYER_EVENT;
       m->parameter = Player::ASPECT43;
-      messageQueue->postMessage(m);
+      messageQueue->postMessageFromOuterSpace(m);
     }
     else if (dxCurrentAspect == Demuxer::ASPECT_16_9)
     {
@@ -738,7 +738,7 @@ void Player::call(void* caller)
       m->to = messageReceiver;
       m->message = Message::PLAYER_EVENT;
       m->parameter = Player::ASPECT169;
-      messageQueue->postMessage(m);
+      messageQueue->postMessageFromOuterSpace(m);
     }
     else
     {