From ac817c55b801fee8cf6a43e77b3e3c77614ae040 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)> Date: Fri, 26 Feb 2010 11:22:54 -0500 Subject: [PATCH] [#2926] Code cleanup --- .../audio/audiortp/ZrtpSessionCallback.cpp | 18 +++--- .../src/plug-in/audiorecorder/audiorecord.cpp | 58 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp index da38f1e0a2..f866b39e00 100644 --- a/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp +++ b/sflphone-common/src/audio/audiortp/ZrtpSessionCallback.cpp @@ -44,7 +44,7 @@ ZrtpSessionCallback::ZrtpSessionCallback (SIPCall *sipcall) : return; } - _debug ("Initialize callbacks"); + _info("Zrtp: Initialize callbacks"); /** * Information Map @@ -114,31 +114,33 @@ ZrtpSessionCallback::ZrtpSessionCallback (SIPCall *sipcall) : void ZrtpSessionCallback::secureOn (std::string cipher) { - _debug ("Secure mode is on with cipher %s", cipher.c_str()); + _debug ("Zrtp: Secure mode is on with cipher %s", cipher.c_str()); DBusManager::instance().getCallManager()->secureZrtpOn (_sipcall->getCallId(), cipher); } void ZrtpSessionCallback::secureOff (void) { - _debug ("Secure mode is off"); + _debug ("Zrtp: Secure mode is off"); DBusManager::instance().getCallManager()->secureZrtpOff (_sipcall->getCallId()); } void ZrtpSessionCallback::showSAS (std::string sas, bool verified) { - _debug ("SAS is: %s", sas.c_str()); + _debug ("Zrtp: SAS is: %s", sas.c_str()); DBusManager::instance().getCallManager()->showSAS (_sipcall->getCallId(), sas, verified); } + void ZrtpSessionCallback::zrtpNotSuppOther() { - _debug ("Callee does not support ZRTP"); + _debug ("Zrtp: Callee does not support ZRTP"); DBusManager::instance().getCallManager()->zrtpNotSuppOther (_sipcall->getCallId()); } + void ZrtpSessionCallback::showMessage (GnuZrtpCodes::MessageSeverity sev, int32_t subCode) { @@ -192,9 +194,9 @@ ZrtpSessionCallback::zrtpNegotiationFailed (MessageSeverity severity, int subCod if (severity == ZrtpError) { if (subCode < 0) { // received an error packet from peer subCode *= -1; - _debug ("Received error packet: "); + _debug ("Zrtp: Received error packet: "); } else { - _debug ("Sent error packet: "); + _debug ("Zrtp: Sent error packet: "); } msg = _zrtpMap[subCode]; @@ -213,7 +215,7 @@ ZrtpSessionCallback::zrtpNegotiationFailed (MessageSeverity severity, int subCod void ZrtpSessionCallback::confirmGoClear() { - _debug ("Received go clear message. Until confirmation, ZRTP won't send any data"); + _debug ("Zrtp: Received go clear message. Until confirmation, ZRTP won't send any data"); DBusManager::instance().getCallManager()->zrtpNotSuppOther (_sipcall->getCallId()); } diff --git a/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp b/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp index c5bbfa81d1..f9c7478eee 100644 --- a/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp +++ b/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp @@ -109,8 +109,7 @@ void AudioRecord::initFileName (std::string peerNumber) void AudioRecord::openFile() { - - _debug ("AudioRecord: Open file()"); + _info ("AudioRecord: Open file()"); bool result = false; @@ -165,7 +164,7 @@ bool AudioRecord::isOpenFile() bool AudioRecord::isFileExist() { - _debug ("AudioRecord: Try to open name : %s ", fileName_); + _info ("AudioRecord: Try to open name : %s ", fileName_); if (fopen (fileName_,"rb") ==0) { return true; @@ -189,12 +188,12 @@ bool AudioRecord::setRecording() if (isOpenFile()) { if (!recordingEnabled_) { - _debug ("AudioRecording: Start recording"); + _info ("AudioRecording: Start recording"); recordingEnabled_ = true; } else { recordingEnabled_ = false; - _debug ("AudioRecording: Stop recording"); + _info ("AudioRecording: Stop recording"); } } else { @@ -210,7 +209,7 @@ bool AudioRecord::setRecording() void AudioRecord::stopRecording() { - _debug ("AudioRecording: Stop recording"); + _info ("AudioRecording: Stop recording"); if (recordingEnabled_) recordingEnabled_ = false; @@ -267,7 +266,7 @@ void AudioRecord::createFilename() // fileName_ = out.str(); strncpy (fileName_, out.str().c_str(), 8192); - printf ("AudioRecord: create filename for this call %s ", fileName_); + _info("AudioRecord: create filename for this call %s ", fileName_); } bool AudioRecord::setRawFile() @@ -276,7 +275,7 @@ bool AudioRecord::setRawFile() fp = fopen (savePath_.c_str(), "wb"); if (!fp) { - _debug ("AudioRecord::setRawFile() : could not create RAW file!"); + _warn ("AudioRecord::setRawFile() : could not create RAW file!"); return false; } @@ -325,7 +324,7 @@ bool AudioRecord::setWavFile() if (fwrite (&hdr, 4, 11, fp) != 11) { - _debug ("AudioRecord: Error: could not write WAV header for file. "); + _warn("AudioRecord: Error: could not write WAV header for file. "); return false; } @@ -350,42 +349,41 @@ bool AudioRecord::openExistingRawFile() bool AudioRecord::openExistingWavFile() { - _debug ("AudioRecord::openExistingWavFile() "); + _info ("AudioRecord: Open existing wave file"); fp = fopen (fileName_, "rb+"); if (!fp) { - _debug ("AudioRecord::openExistingWavFile() : could not open WAV file rb+!"); + _warn("AudioRecord: Error: could not open WAV file!"); return false; } printf ("AudioRecord::openExistingWavFile()::Tried to open %s ",fileName_); if (fseek (fp, 40, SEEK_SET) != 0) // jump to data length - _debug ("AudioRecord::OpenExistingWavFile: 1.Couldn't seek offset 40 in the file "); + _warn ("AudioRecord: Error: Couldn't seek offset 40 in the file "); if (fread (&byteCounter_, 4, 1, fp)) - _debug ("AudioRecord::OpenExistingWavFile : bytecounter Read successfully "); + _warn("AudioRecord: Error: bytecounter Read successfully "); if (fseek (fp, 0 , SEEK_END) != 0) - _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file "); + _warn ("AudioRecord: Error: Couldn't seek at the en of the file "); - printf ("AudioRecord::OpenExistingWavFile : Byte counter after oppening : %d ", (int) byteCounter_); if (fclose (fp) != 0) - _debug ("AudioRecord::openExistingWavFile()::ERROR: can't close file r+ "); + _warn ("AudioRecord: Error: Can't close file r+ "); fp = fopen (fileName_, "ab+"); if (!fp) { - _debug ("AudioRecord::openExistingWavFile() : could not createopen WAV file ab+!"); + _warn ("AudioRecord: Error: Could not createopen WAV file ab+!"); return false; } if (fseek (fp, 4 , SEEK_END) != 0) - _debug ("AudioRecors::OpenExistingWavFile : 2.Couldn't seek at the en of the file "); + _warn ("AudioRecord: Error: Couldn't seek at the en of the file "); return true; @@ -395,7 +393,7 @@ bool AudioRecord::openExistingWavFile() void AudioRecord::closeWavFile() { if (fp == 0) { - _debug ("AudioRecord:: Can't closeWavFile, a file has not yet been opened!"); + _debug ("AudioRecord: Can't closeWavFile, a file has not yet been opened!"); return; } @@ -403,27 +401,27 @@ void AudioRecord::closeWavFile() SINT32 bytes = byteCounter_ * channels_; fseek (fp, 40, SEEK_SET); // jump to data length - - if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 40"); + if (ferror (fp)) + _warn ("AudioRecord: Error: can't reach offset 40 while closing"); fwrite (&bytes, sizeof (SINT32), 1, fp); - - if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't write bytes for data length "); + if (ferror (fp)) + _warn ("AudioRecord: Error: can't write bytes for data length "); bytes = byteCounter_ * channels_ + 44; // + 44 for the wave header fseek (fp, 4, SEEK_SET); // jump to file size - - if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 4"); + if (ferror (fp)) + _warn ("AudioRecord: Error: can't reach offset 4"); fwrite (&bytes, 4, 1, fp); - - if (ferror (fp)) perror ("AudioRecord::closeWavFile()::ERROR: can't reach offset 4"); + if (ferror (fp)) + _warn("AudioRecord: Error: can't reach offset 4"); if (fclose (fp) != 0) - _debug ("AudioRecord: Error: can't close file"); + _warn ("AudioRecord: Error: can't close file"); } @@ -473,7 +471,7 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples) if (sndFormat_ == INT16) { // TODO change INT16 to SINT16 if (fwrite (buffer, sizeof (SFLDataFormat), nSamples, fp) != (unsigned int) nSamples) - _debug ("AudioRecord: Could not record data! "); + _warn ("AudioRecord: Could not record data! "); else { fflush (fp); byteCounter_ += (unsigned long) (nSamples*sizeof (SFLDataFormat)); @@ -503,7 +501,7 @@ void AudioRecord::recData (SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int if (fwrite (&mixBuffer_[k], 2, 1, fp) != 1) - _debug ("AudioRecord: Could not record data!"); + _warn ("AudioRecord: Could not record data!"); else { fflush (fp); } -- GitLab