[Sofaswitch-svn] [commit] r431 - sofaswitch/trunk/am
Author: derek Date: Mon Jul 21 23:13:27 2008 New Revision: 431 Modified: sofaswitch/trunk/am/audio.cxx sofaswitch/trunk/am/comms.cxx Log: Tidy up operation so it operates correctly when just the write file is specified. Improve reporting on the status command to accurate describe what is happening. Modified: sofaswitch/trunk/am/audio.cxx ============================================================================== --- sofaswitch/trunk/am/audio.cxx (original) +++ sofaswitch/trunk/am/audio.cxx Mon Jul 21 23:13:27 2008 @@ -70,6 +70,7 @@ EnactFileChange(); if (!audioFile.IsOpen()) { + PTRACE(3, "AudioRead\tNo action - source file is not available"); doThisRead = false; } @@ -80,7 +81,7 @@ PTRACE(1, "Send end of file as we hav read the end of this file." << fileName); comms->SendEndOfFile(); sentEndOfFile = true; - PTRACE(4, "End of this file, currently at " << audioFile.GetPosition() << + PTRACE(4, "AudioRead\tEnd of this file, currently at " << audioFile.GetPosition() << " index, of a total of " <<audioFile.GetDataLength() << " bytes"); } } @@ -91,10 +92,10 @@ if (audioFile.GetErrorCode() != PChannel::NoError) { doThisRead = false; if (!sentEndOfFile) { - PTRACE(1, "Send end of file as we had an error in read, " << audioFile.GetErrorText()); + PTRACE(1, "AudioRead\tSend end of file as we had an error in read, " << audioFile.GetErrorText()); comms->SendEndOfFile(); sentEndOfFile = true; - PTRACE(3, "AudioRead\t failed with error text " << audioFile.GetErrorText()); + PTRACE(3, "AudioRead\tfailed with error text " << audioFile.GetErrorText()); } } lastReadCount = audioFile.GetLastReadCount(); @@ -102,7 +103,7 @@ } if (doThisRead) { - PTRACE(3, dirString << "\tGrabbed " << lastReadCount << " bytes from the file " << fileName); + PTRACE(3, dirString << "AudioRead\tGrabbed " << lastReadCount << " bytes from the file " << fileName); delayTime = data.GetSize()/16; countPackets++; socket->Write(data.GetPointer(), data.GetSize()); @@ -111,7 +112,7 @@ } } - PTRACE(3, "Delay " << delayTime << " ms after the read"); + PTRACE(3, "AudioRead\tDelay " << delayTime << " ms after the read"); delay.Delay(delayTime); } @@ -164,15 +165,16 @@ EnactFileChange(); if (!audioFile.IsOpen()) { + PTRACE(3, "AudioWrite\tNo action - destination file is closed"); continue; } audioFile.Write(data.GetPointer(), lastReadCount); countPackets++; - if (audioFile.GetErrorCode() != PChannel::NoError) { - PTRACE(3, "AudioWrite\t failed with error text " << audioFile.GetErrorText()); + if (audioFile.GetErrorCode() == PChannel::NoError) { + PTRACE(3, "AudioWrite\tSent " << lastReadCount << " bytes to the file " << fileName); } else { - PTRACE(3, "AudioWrite\tSent " << data.GetSize() << " bytes to the file " << fileName); + PTRACE(3, "AudioWrite\t failed with error text " << audioFile.GetErrorText()); } } } Modified: sofaswitch/trunk/am/comms.cxx ============================================================================== --- sofaswitch/trunk/am/comms.cxx (original) +++ sofaswitch/trunk/am/comms.cxx Mon Jul 21 23:13:27 2008 @@ -167,9 +167,12 @@ { PTRACE(3, "Coms::ProcessStatusQuery"); - if (!audioReadThread.IsInitialised()) { - SendThisMessageTo("not yet in a call", sender); - return; + if ((!audioReadThread.IsInitialised()) && (!audioWriteThread.IsInitialised())) { + PStringStream answer; + answer << "\n Currently linked to " << GetMediaPartner(); + answer << "\n No audio file specified - read and/or write cannot happen.\n"; + SendThisMessageTo(answer, sender); + return; } PString status = GetStatusInfo();
participants (1)
-
SofaSWITCH SVN