diff options
author | sumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-15 22:42:20 +0000 |
---|---|---|
committer | sumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-15 22:42:20 +0000 |
commit | 7c7546d2c128135c2992ff7cd91614440db09027 (patch) | |
tree | 327d0b11163e9f407b721ac1a0ade3ef83c43a1d | |
parent | 1a368664c0f8d9e72df18d501d1e416132f89c1a (diff) | |
download | ATCD-7c7546d2c128135c2992ff7cd91614440db09027.tar.gz |
*** empty log message ***
4 files changed, 60 insertions, 38 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO b/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO index ad7698e62f4..3a5e0832d51 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO @@ -3,30 +3,23 @@ $Id$ Use - for things to do, * for urgent things, and + for things that have been done. -Things to do ------------- - -"Simple" things - -- Clear the semaphores on the client and the server! -- Semaphore on the client side is exclusive ?! Sometimes one - client blocks forever when the server exits +Bugs +---- -- rttag is enabled with -r - does it work ? +- States problem -- pressing play twice screws up, position is not working +- client blocks forever while exiting sometimes (often after the above) +- vs, as don't die as a result of the above +- server segfaults if addr is already in use -- Make #define's into enums in common.h/globals.h -+ Change handle_input to handle_connection in - Mpeg_Svc_Handler +Things to do +------------ -+ Video_Sig_Handler is in Mpeg_Server -- needs to be moved to Video_Server - -- done +"Simple" things -+ Split up VIDEO_FAST into two commands - VIDEO_FAST_{FORWARD,BACKWARD} -+ create a helper class for video, and put FBread et al in that +- Make #define's into enums in common.h/globals.h - try compiling ACE and the application with fast=1 to see if performance improves diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp index 8c963ea975b..9dc30867e43 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp @@ -32,7 +32,7 @@ int Audio_Global::CmdRead(char *buf, int psize) { int res = wait_read_bytes(serviceSocket, buf, psize); - if (res == 0) return (1); + if (res == 0) return (-1); if (res == -1) { fprintf(stderr, "AS error on read cmdSocket, size %d", psize); perror(""); @@ -810,7 +810,7 @@ Audio_Data_Handler::get_handle (void) const int Audio_Data_Handler::handle_input (ACE_HANDLE fd) { - ACE_DEBUG ((LM_DEBUG,"(%P|%t)Audio_Data_Handler::handle_input ()\n")); + ACE_DEBUG ((LM_DEBUG,"(%P|%t) Audio_Data_Handler::handle_input ()\n")); int bytes, len; for (;;) { if (this->audio_global_->conn_tag >= 0) { @@ -941,14 +941,14 @@ Audio_Control_Handler::get_handle (void) const int Audio_Control_Handler::handle_input (ACE_HANDLE fd) { - ACE_DEBUG ((LM_DEBUG,"(%P|%t)Audio_Control_Handler::handle_input ()\n")); + ACE_DEBUG ((LM_DEBUG,"(%P|%t) Audio_Control_Handler::handle_input ()\n")); int result; switch (this->audio_global_->state) { case Audio_Global::AUDIO_WAITING: result = this->audio_global_->CmdRead((char *)&(this->audio_global_->cmd), 1); if (result != 0) - return result; + return -1; ACE_DEBUG ((LM_DEBUG,"(%P|%t)command %d received",this->audio_global_->cmd)); switch (this->audio_global_->cmd) { @@ -956,12 +956,12 @@ Audio_Control_Handler::handle_input (ACE_HANDLE fd) this->audio_global_->state = Audio_Global::AUDIO_PLAY; result = this->audio_global_->play_audio(); if (result != 0) - return result; + return -1; break; case CmdCLOSE: ACE_DEBUG ((LM_DEBUG,"(%P|%t) A session closed\n")); ACE_Reactor::instance ()->end_event_loop (); - return(0); + return 0; break; default: fprintf(stderr, "audio channel command %d not recoganizeable\n", @@ -973,7 +973,7 @@ Audio_Control_Handler::handle_input (ACE_HANDLE fd) unsigned char tmp; result = this->audio_global_->CmdRead((char *)&tmp, 1); if (result != 0) - return result; + return -1; switch (tmp) { case CmdSPEED: @@ -981,7 +981,7 @@ Audio_Control_Handler::handle_input (ACE_HANDLE fd) SPEEDaudioPara para; result = this->audio_global_->CmdRead((char *)¶, sizeof(para)); if (result != 0) - return result; + return -1; #ifdef NeedByteOrderConversion para.sn = ntohl(para.sn); para.samplesPerSecond = ntohl(para.samplesPerSecond); @@ -1010,7 +1010,7 @@ Audio_Control_Handler::handle_input (ACE_HANDLE fd) result = this->audio_global_->CmdRead((char *)&val, sizeof(int)); if (result != 0) - return result; + return -1; /* CmdWrite(AUDIO_STOP_PATTERN, strlen(AUDIO_STOP_PATTERN)); */ @@ -1018,7 +1018,7 @@ Audio_Control_Handler::handle_input (ACE_HANDLE fd) StopPlayLiveAudio(); } this->audio_global_->state = Audio_Global::AUDIO_WAITING; - return 0; + break; } case CmdCLOSE: if (this->audio_global_->live_source) { @@ -1028,13 +1028,13 @@ Audio_Control_Handler::handle_input (ACE_HANDLE fd) // event loop. ACE_Reactor::instance ()->end_event_loop (); - return(1); /* The whole AS session terminates */ + return 0; /* The whole AS session terminates */ default: if (this->audio_global_->live_source) { StopPlayLiveAudio(); } fprintf(stderr, "AS error: cmd=%d while expects STOP/SPEED/CLOSE.\n", tmp); - return(-1); + return -1; } this->audio_global_->send_audio (); break; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp index 6d28c912d81..0f5f51f66dc 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp @@ -3,6 +3,9 @@ #include "server.h" #include "ace/Process.h" +int AV_Server::done_; +pid_t AV_Server::current_pid_; + // Initialize the svc_handler, and the acceptor. AV_Svc_Handler::AV_Svc_Handler (ACE_Thread_Manager *t) @@ -73,9 +76,11 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) // ORBport of 0 makes the video server pick a port for itself ACE_Process video_process; - pid_t child_pid; + + AV_Server::done_ = 0; - if ((child_pid = video_process.spawn (video_process_options)) == -1) + if ((AV_Server::current_pid_ = + video_process.spawn (video_process_options)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) ACE_Process:: spawn failed: %p\n", "spawn"), @@ -89,7 +94,7 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) ::sprintf (sem_str, "%s:%d", "Video_Server_Semaphore", - child_pid); + AV_Server::current_pid_); ACE_DEBUG ((LM_DEBUG, "(%P|%t) semaphore is %s\n", @@ -100,12 +105,23 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE) sem_str); // %% wait until the child finishes booting - if (semaphore.acquire () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) semaphore acquire failed: %p\n", - "acquire"), - -1); - // ~~?? remove the semaphore. + while (AV_Server::done_ == 0) + { + if (semaphore.acquire () == -1) + { + if (errno != EINTR) + break; + } + else + break; + } + + if (semaphore.remove () == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) semaphore remove failed: %p\n", + "remove"), + -1); + // Wait until a ACE_SV_Semaphore's value is greater than 0, the // decrement it by 1 and return. Dijkstra's P operation, Tannenbaums // DOWN operation. @@ -319,6 +335,13 @@ AV_Server_Sig_Handler::clear_child (int sig) &status, WNOHANG)) > 0) { + if (pid == AV_Server::current_pid_) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) The child currently being waited for has died.\n")); + AV_Server::done_ = 1; + } + // decrement the count of number of active children Mpeg_Global::session_num --; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h index 0be49ebd91a..98efbe6f3a4 100644 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h +++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h @@ -182,6 +182,12 @@ public: static void on_exit_routine (void); // Routine called when this process exits. + static pid_t current_pid_; + // %% the pid the server is currently waiting on + + static int done_; + // %% the done flag, set by the signal handler + ~AV_Server (void); // Destructor //private: |