summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/mpeg
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-20 20:42:45 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-20 20:42:45 +0000
commit8ea84076a35728eaafe6f481630b7c76ac0654fd (patch)
treeadc3854d336a53e2b6c7929f4303c2ac16256a4b /TAO/orbsvcs/tests/AVStreams/mpeg
parentf2d396c5a31c1aed0e5a994db7a7c0ca6dce02e3 (diff)
downloadATCD-8ea84076a35728eaafe6f481630b7c76ac0654fd.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/mpeg')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp27
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp13
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp11
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp14
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp9
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp30
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp52
7 files changed, 99 insertions, 57 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
index 14fd79ccce6..4e2f0ecd219 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
@@ -244,6 +244,11 @@ Command_Handler::init_av (void)
int i, j;
+ // if (this->orb_manager_ != 0)
+ // delete this->orb_manager_;
+
+ // init the ORB manager.
+ // this->init ();
/* try to stop and close previous playing */
if (audioSocket >= 0 || videoSocket >= 0)
{
@@ -271,7 +276,7 @@ Command_Handler::init_av (void)
}
usleep(10000);
this->close ();
- ComCloseConn(videoSocket);
+ // ComCloseConn(videoSocket);
videoSocket = -1;
while ((!VBbufEmpty()) || !VDbufEmpty()) {
while (VDpeekMsg() != NULL) {
@@ -764,7 +769,7 @@ int
Command_Handler::close (void)
{
// flag to call close only once.
- static called = 0;
+ // static called = 0;
// if (audioSocket >=0)
// {
// int result =
@@ -782,9 +787,9 @@ Command_Handler::close (void)
// ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
// }
// }
- if (!called)
- {
- called =1;
+ // if (!called)
+ // {
+ // called =1;
TAO_TRY
{
if (CORBA::is_nil (this->audio_control_.in ()) == CORBA::B_FALSE)
@@ -811,8 +816,8 @@ Command_Handler::close (void)
}
TAO_ENDTRY;
return 0;
- }
- return 0;
+ // }
+ // return 0;
}
@@ -1516,6 +1521,7 @@ Command_Handler::connect_to_video_server (char *address,
ACE_INET_Addr server_addr (VCR_TCP_PORT,
address);
+ this->video_stream_.close ();
if (this->video_connector_.connect (this->video_stream_,
server_addr) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
@@ -1549,6 +1555,7 @@ Command_Handler::connect_to_video_server (char *address,
ACE_NEW_RETURN (client_address_string,
char [BUFSIZ],
-1);
+ this->video_dgram_.close ();
// Get the local UDP address
if (this->video_dgram_.open (ACE_Addr::sap_any) == -1)
ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram open failed %p"),-1);
@@ -1629,6 +1636,7 @@ Command_Handler::connect_to_audio_server (char *address,
ACE_INET_Addr server_addr (VCR_TCP_PORT,
address);
+ this->audio_stream_.close ();
if (this->audio_connector_.connect (this->audio_stream_,
server_addr) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
@@ -1643,9 +1651,7 @@ Command_Handler::connect_to_audio_server (char *address,
int ack;
this->audio_stream_.recv_n (&ack, sizeof (ack));
- // ACE_DEBUG ((LM_DEBUG,
- // "(%P|%t) got ack :%d\n",
- // ack));
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) got ack :%d\n",ack));
// initialize the command handler , ORB
if (this->resolve_audio_reference () == -1)
@@ -1661,6 +1667,7 @@ Command_Handler::connect_to_audio_server (char *address,
ACE_NEW_RETURN (client_address_string,
char [BUFSIZ],
-1);
+ this->audio_dgram_.close ();
// Get the local UDP address
if (this->audio_dgram_.open (ACE_Addr::sap_any) == -1)
ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram open failed %p"),-1);
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp
index b1ced0c3333..7dfc22bc911 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp
@@ -168,13 +168,9 @@ void ABdeleteSem(void)
/* SIGUSR1 from CTR is for killing this process, without affecting any other ones. */
-static void usr1_handler(int sig)
-{
- exit_tag = 1;
-}
-
static void exit_on_kill(void)
{
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) ABprocess killed \n"));
extern void set_exit_routine_tag(int tag);
set_exit_routine_tag(0);
ComCloseConn(savedSocket);
@@ -182,6 +178,13 @@ static void exit_on_kill(void)
exit(0);
}
+static void usr1_handler(int sig)
+{
+ cerr << "ABprocess got sigusr1\n";
+ exit_on_kill ();
+}
+
+
static void usr2_handler(int sig)
{
Fprintf(stderr, "VB void usr2_handler (supposed for stat).\n");
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
index edde8565fd4..60045342abc 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
@@ -233,8 +233,7 @@ static void CmdWrite(unsigned char * buf, int size)
static void SocketRead(int s, char *buf, int size)
{ int val, remain = size;
char * ptr = buf;
- fprintf (stderr, "SocketRead: videoSocket = %d\n",
- videoSocket);
+ // fprintf (stderr, "SocketRead: videoSocket = %d\n",videoSocket);
for (;;)
{
val = read(s, ptr, remain);
@@ -2991,10 +2990,10 @@ int CTRmain(void)
// -1);
// if (command_handler->init () == -1)
- if (command_handler.init () == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) command_handler: init returned -1"),
- -1);
+ if (command_handler.init () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) command_handler: init returned -1"),
+ -1);
// .. and register it with the reactor.
if (ACE_Reactor::instance ()->register_handler (&command_handler,
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp
index 7456d583bd8..3e8fc9f3d84 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp
@@ -162,13 +162,9 @@ void VBdeleteSem(void)
/* SIGUSR1 from CTR is for killing this process, without affecting any other ones. */
-static void usr1_handler(int sig)
-{
- exit_tag = 1;
-}
-
static void exit_on_kill(void)
{
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) VBProcess killed\n"));
extern void set_exit_routine_tag(int tag);
set_exit_routine_tag(0);
ComCloseConn(savedSocket);
@@ -176,6 +172,14 @@ static void exit_on_kill(void)
exit(0);
}
+static void usr1_handler(int sig)
+{
+ cerr << "VBProcess got sigusr1\n";
+ exit_on_kill ();
+ exit_tag = 1;
+}
+
+
static void usr2_handler(int sig)
{
/*
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp
index b55474d4333..ca4f2c5bf0f 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp
@@ -1494,6 +1494,8 @@ Video_Global::play_send (int debug)
sendStatus = this->SendPacket (this->preHeader != curHeader,
curGroup, curFrame,
(this->currentUPF + this->addedUPF) * frameStep);
+ if (sendStatus == -1)
+ return -1;
if (!sendStatus)
{
this->preHeader = curHeader;
@@ -1517,8 +1519,11 @@ Video_Global::fast_play_send (void)
{
if (this->fast_preGroup != Video_Timer_Global::timerGroup)
{
- this->SendPacket (this->fast_preHeader != Video_Timer_Global::timerHeader, Video_Timer_Global::timerGroup, 0,
- this->fast_para.usecPerFrame * this->patternSize >> 2);
+ int result;
+ result = this->SendPacket (this->fast_preHeader != Video_Timer_Global::timerHeader, Video_Timer_Global::timerGroup, 0,
+ this->fast_para.usecPerFrame * this->patternSize >> 2);
+ if (result == -1)
+ return -1;
this->fast_preHeader = Video_Timer_Global::timerHeader;
this->fast_preGroup = Video_Timer_Global::timerGroup;
}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp
index 0f4de875dd0..c7fbd442f7d 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp
@@ -163,20 +163,30 @@ Video_Data_Handler::handle_input (ACE_HANDLE handle)
{
case Video_Control_State::VIDEO_PLAY:
VIDEO_SINGLETON::instance ()->GetFeedBack ();
- // if (VIDEO_SINGLETON::instance ()->GetFeedBack () == -1)
-// {
-// ACE_DEBUG ((LM_DEBUG, "(%P|%t) Error reading feedback. Ending the reactor event loop\n"));
-// // TAO_ORB_Core_instance ()-> orb ()->shutdown ();
-// // return -1;
-// // return 0;
-// }
-
- VIDEO_SINGLETON::instance ()->play_send (); // simulating the for loop in playvideo () in vs.cpp
+ // if (VIDEO_SINGLETON::instance ()->GetFeedBack () == -1)
+// {
+// ACE_DEBUG ((LM_DEBUG, "(%P|%t) Error reading feedback. Ending the reactor event loop\n"));
+// TAO_ORB_Core_instance ()-> orb ()->shutdown ();
+// return -1;
+// }
+ if (VIDEO_SINGLETON::instance ()->play_send () == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Error sending packets. Ending the reactor event loop\n"));
+ // TAO_ORB_Core_instance ()-> orb ()->shutdown ();
+ // return -1;
+ }
+ // simulating the for loop in playvideo () in vs.cpp
break;
case Video_Control_State::VIDEO_FAST_FORWARD:
case Video_Control_State::VIDEO_FAST_BACKWARD:
VIDEO_SINGLETON::instance ()->GetFeedBack ();
- VIDEO_SINGLETON::instance ()->fast_play_send (); // simulating the for loop in fast_play
+ if (VIDEO_SINGLETON::instance ()->fast_play_send () == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Error sending packets. Ending the reactor event loop\n"));
+ // TAO_ORB_Core_instance ()-> orb ()->shutdown ();
+ // return -1;
+ }
+ // simulating the for loop in fast_play
break;
}
return 0;
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp
index a057dfb88f0..e7ace9f7228 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp
@@ -4,7 +4,7 @@
#include "ace/Process.h"
int AV_Server::done_;
-pid_t AV_Server::current_pid_;
+pid_t AV_Server::current_pid_ = -1;
// Initialize the svc_handler, and the acceptor.
@@ -116,6 +116,7 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE)
break;
}
+ AV_Server::current_pid_ = -1;
if (semaphore.remove () == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) semaphore remove failed: %p\n",
@@ -163,9 +164,11 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE)
// ORBport of 0 makes the audio server pick a port for itself
ACE_Process audio_process;
- pid_t child_pid;
+
+ AV_Server::done_ = 0;
- if ((child_pid = audio_process.spawn (audio_process_options)) == -1)
+ if ((AV_Server::current_pid_
+ = audio_process.spawn (audio_process_options)) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) ACE_Process:: spawn failed: %p\n",
"spawn"),
@@ -179,7 +182,7 @@ AV_Svc_Handler::handle_connection (ACE_HANDLE)
::sprintf (sem_str,
"%s:%d",
"Audio_Server_Semaphore",
- child_pid);
+ AV_Server::current_pid_);
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) semaphore is %s\n",
@@ -190,17 +193,32 @@ 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);
+ while (AV_Server::done_ == 0)
+ {
+ if (semaphore.acquire () == -1)
+ {
+ if (errno != EINTR)
+ {
+ ACE_DEBUG ((LM_DEBUG,"Semaphore acquire failed\n"));
+ return -1;
+ }
+ // break;
+ }
+ else
+ break;
+ }
+// if (semaphore.acquire () == -1)
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%P|%t) semaphore acquire failed: %p\n",
+// "acquire"),
+// -1);
// ~~?? remove the semaphore.
// 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.
// ::sleep (5);
+ AV_Server::current_pid_ = -1;
if (semaphore.remove () == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) semaphore remove failed: %p\n",
@@ -360,7 +378,7 @@ AV_Server_Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask)
int
AV_Server_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *)
{
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum));
+ // ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum));
switch (signum)
{
@@ -377,9 +395,7 @@ AV_Server_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *)
this->int_handler (signum);
break;
default:
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) %S: not handled, returning to program\n",
- signum));
+ // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %S: not handled, returning to program\n", signum));
break;
}
return 0;
@@ -392,7 +408,7 @@ AV_Server_Sig_Handler::clear_child (int sig)
int pid;
int status;
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) AV_Server: Reaping the children\n"));
+ // ACE_DEBUG ((LM_DEBUG,"(%P|%t) AV_Server: Reaping the children\n"));
// reap the children
while ((pid = ACE_OS::waitpid (-1,
&status,
@@ -400,7 +416,8 @@ AV_Server_Sig_Handler::clear_child (int sig)
{
if (pid == AV_Server::current_pid_)
{
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) The child currently being waited for has died.\n"));
+ cerr << "The child currently being waited for has died\n";
+ // ACE_DEBUG ((LM_DEBUG,"(%P|%t) The child currently being waited for has died.\n"));
AV_Server::done_ = 1;
}
@@ -410,10 +427,7 @@ AV_Server_Sig_Handler::clear_child (int sig)
if (status == 0)
continue;
- ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) AV_Server: child %d (status %d)\n",
- pid,
- status));
+ // ACE_DEBUG ((LM_DEBUG, "(%P|%t) AV_Server: child %d (status %d)\n", pid, status));
}
return;
}