diff --git a/webrtc/modules/media_file/media_file_impl.cc b/webrtc/modules/media_file/media_file_impl.cc index 56dc9c8e9a..a869625cf5 100644 --- a/webrtc/modules/media_file/media_file_impl.cc +++ b/webrtc/modules/media_file/media_file_impl.cc @@ -12,8 +12,8 @@ #include "webrtc/modules/media_file/media_file_impl.h" #include "webrtc/rtc_base/format_macros.h" +#include "webrtc/rtc_base/logging.h" #include "webrtc/system_wrappers/include/file_wrapper.h" -#include "webrtc/system_wrappers/include/trace.h" namespace webrtc { MediaFile* MediaFile::CreateMediaFile(const int32_t id) @@ -43,7 +43,7 @@ MediaFileImpl::MediaFileImpl(const int32_t id) _fileName(), _ptrCallback(NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceFile, id, "Created"); + LOG(LS_INFO) << "MediaFileImpl()"; codec_info_.plname[0] = '\0'; _fileName[0] = '\0'; @@ -52,7 +52,7 @@ MediaFileImpl::MediaFileImpl(const int32_t id) MediaFileImpl::~MediaFileImpl() { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, "~MediaFileImpl()"); + LOG(LS_INFO) << "~MediaFileImpl()"; { rtc::CritScope lock(&_crit); @@ -80,34 +80,29 @@ MediaFileImpl::~MediaFileImpl() int64_t MediaFileImpl::TimeUntilNextProcess() { - WEBRTC_TRACE( - kTraceWarning, - kTraceFile, - _id, - "TimeUntilNextProcess: This method is not used by MediaFile class."); + LOG(LS_WARNING) + << "TimeUntilNextProcess: This method is not used by MediaFile class."; return -1; } void MediaFileImpl::Process() { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Process: This method is not used by MediaFile class."); + LOG(LS_WARNING) << "Process: This method is not used by MediaFile class."; } int32_t MediaFileImpl::PlayoutAudioData(int8_t* buffer, size_t& dataLengthInBytes) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "MediaFileImpl::PlayoutData(buffer= 0x%x, bufLen= %" PRIuS ")", - buffer, dataLengthInBytes); + LOG(LS_INFO) << "MediaFileImpl::PlayoutData(buffer= " + << static_cast(buffer) + << ", bufLen= " << dataLengthInBytes << ")"; const size_t bufferLengthInBytes = dataLengthInBytes; dataLengthInBytes = 0; if(buffer == NULL || bufferLengthInBytes == 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Buffer pointer or length is NULL!"); + LOG(LS_ERROR) << "Buffer pointer or length is NULL!"; return -1; } @@ -117,15 +112,13 @@ int32_t MediaFileImpl::PlayoutAudioData(int8_t* buffer, if(!_playingActive) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Not currently playing!"); + LOG(LS_WARNING) << "Not currently playing!"; return -1; } if(!_ptrFileUtilityObj) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Playing, but no FileUtility object!"); + LOG(LS_ERROR) << "Playing, but no FileUtility object!"; StopPlaying(); return -1; } @@ -165,8 +158,7 @@ int32_t MediaFileImpl::PlayoutAudioData(int8_t* buffer, break; default: { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Invalid file format: %d", _fileFormat); + LOG(LS_ERROR) << "Invalid file format: " << _fileFormat; assert(false); break; } @@ -226,20 +218,18 @@ int32_t MediaFileImpl::PlayoutStereoData( int8_t* bufferRight, size_t& dataLengthInBytes) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "MediaFileImpl::PlayoutStereoData(Left = 0x%x, Right = 0x%x," - " Len= %" PRIuS ")", - bufferLeft, - bufferRight, - dataLengthInBytes); + LOG(LS_INFO) + << "MediaFileImpl::PlayoutStereoData(Left = " + << static_cast(bufferLeft) << ", Right = " + << static_cast(bufferRight) << ", Len= " << dataLengthInBytes + << ")"; const size_t bufferLengthInBytes = dataLengthInBytes; dataLengthInBytes = 0; if(bufferLeft == NULL || bufferRight == NULL || bufferLengthInBytes == 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "A buffer pointer or the length is NULL!"); + LOG(LS_ERROR) << "A buffer pointer or the length is NULL!"; return -1; } @@ -250,18 +240,14 @@ int32_t MediaFileImpl::PlayoutStereoData( if(!_playingActive || !_isStereo) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Not currently playing stereo!"); + LOG(LS_WARNING) << "Not currently playing stereo!"; return -1; } if(!_ptrFileUtilityObj) { - WEBRTC_TRACE( - kTraceError, - kTraceFile, - _id, - "Playing stereo, but the FileUtility objects is NULL!"); + LOG(LS_ERROR) + << "Playing stereo, but the FileUtility objects is NULL!"; StopPlaying(); return -1; } @@ -278,9 +264,8 @@ int32_t MediaFileImpl::PlayoutStereoData( bufferLengthInBytes); break; default: - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Trying to read non-WAV as stereo audio\ - (not supported)"); + LOG(LS_ERROR) + << "Trying to read non-WAV as stereo audio (not supported)"; break; } @@ -348,27 +333,21 @@ int32_t MediaFileImpl::StartPlayingAudioFile( if((startPointMs && stopPointMs && !loop) && (notificationTimeMs > (stopPointMs - startPointMs))) { - WEBRTC_TRACE( - kTraceError, - kTraceFile, - _id, - "specified notification time is longer than amount of ms that will\ - be played"); + LOG(LS_ERROR) << "specified notification time is longer than amount of" + << " ms that will be played"; return -1; } FileWrapper* inputStream = FileWrapper::Create(); if(inputStream == NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "Failed to allocate input stream for file %s", fileName); + LOG(LS_INFO) << "Failed to allocate input stream for file " << fileName; return -1; } if (!inputStream->OpenFile(fileName, true)) { delete inputStream; - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "Could not open input file %s", - fileName); + LOG(LS_ERROR) << "Could not open input file " << fileName; return -1; } @@ -421,30 +400,24 @@ int32_t MediaFileImpl::StartPlayingStream( rtc::CritScope lock(&_crit); if(_playingActive || _recordingActive) { - WEBRTC_TRACE( - kTraceError, - kTraceFile, - _id, - "StartPlaying called, but already playing or recording file %s", - (_fileName[0] == '\0') ? "(name not set)" : _fileName); + LOG(LS_ERROR) + << "StartPlaying called, but already playing or recording file " + << ((_fileName[0] == '\0') ? "(name not set)" : _fileName); return -1; } if(_ptrFileUtilityObj != NULL) { - WEBRTC_TRACE(kTraceError, - kTraceFile, - _id, - "StartPlaying called, but FileUtilityObj already exists!"); + LOG(LS_ERROR) + << "StartPlaying called, but FileUtilityObj already exists!"; StopPlaying(); return -1; } - _ptrFileUtilityObj = new ModuleFileUtility(_id); + _ptrFileUtilityObj = new ModuleFileUtility(); if(_ptrFileUtilityObj == NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "Failed to create FileUtilityObj!"); + LOG(LS_INFO) << "Failed to create FileUtilityObj!"; return -1; } @@ -455,8 +428,7 @@ int32_t MediaFileImpl::StartPlayingStream( if(_ptrFileUtilityObj->InitWavReading(stream, startPointMs, stopPointMs) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a valid WAV file!"); + LOG(LS_ERROR) << "Not a valid WAV file!"; StopPlaying(); return -1; } @@ -468,8 +440,7 @@ int32_t MediaFileImpl::StartPlayingStream( if(_ptrFileUtilityObj->InitCompressedReading(stream, startPointMs, stopPointMs) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a valid Compressed file!"); + LOG(LS_ERROR) << "Not a valid Compressed file!"; StopPlaying(); return -1; } @@ -488,8 +459,7 @@ int32_t MediaFileImpl::StartPlayingStream( stopPointMs, codecInst->plfreq) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a valid raw 8 or 16 KHz PCM file!"); + LOG(LS_ERROR) << "Not a valid raw 8 or 16 KHz PCM file!"; StopPlaying(); return -1; } @@ -505,8 +475,7 @@ int32_t MediaFileImpl::StartPlayingStream( if(_ptrFileUtilityObj->InitPreEncodedReading(stream, *codecInst) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a valid PreEncoded file!"); + LOG(LS_ERROR) << "Not a valid PreEncoded file!"; StopPlaying(); return -1; } @@ -516,16 +485,14 @@ int32_t MediaFileImpl::StartPlayingStream( } default: { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Invalid file format: %d", format); + LOG(LS_ERROR) << "Invalid file format: " << format; assert(false); break; } } if(_ptrFileUtilityObj->codec_info(codec_info_) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Failed to retrieve codec info!"); + LOG(LS_ERROR) << "Failed to retrieve codec info!"; StopPlaying(); return -1; } @@ -533,8 +500,7 @@ int32_t MediaFileImpl::StartPlayingStream( _isStereo = (codec_info_.channels == 2); if(_isStereo && (_fileFormat != kFileFormatWavFile)) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Stereo is only allowed for WAV files"); + LOG(LS_WARNING) << "Stereo is only allowed for WAV files"; StopPlaying(); return -1; } @@ -572,8 +538,7 @@ int32_t MediaFileImpl::StopPlaying() if(!_playingActive) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "playing is not active!"); + LOG(LS_WARNING) << "playing is not active!"; return -1; } @@ -583,7 +548,7 @@ int32_t MediaFileImpl::StopPlaying() bool MediaFileImpl::IsPlaying() { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, "MediaFileImpl::IsPlaying()"); + LOG(LS_VERBOSE) << "MediaFileImpl::IsPlaying()"; rtc::CritScope lock(&_crit); return _playingActive; } @@ -592,14 +557,13 @@ int32_t MediaFileImpl::IncomingAudioData( const int8_t* buffer, const size_t bufferLengthInBytes) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "MediaFile::IncomingData(buffer= 0x%x, bufLen= %" PRIuS, - buffer, bufferLengthInBytes); + LOG(LS_INFO) << "MediaFile::IncomingData(buffer= " + << static_cast(buffer) << ", bufLen= " + << bufferLengthInBytes << ")"; if(buffer == NULL || bufferLengthInBytes == 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Buffer pointer or length is NULL!"); + LOG(LS_ERROR) << "Buffer pointer or length is NULL!"; return -1; } @@ -610,14 +574,12 @@ int32_t MediaFileImpl::IncomingAudioData( if(!_recordingActive) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Not currently recording!"); + LOG(LS_WARNING) << "Not currently recording!"; return -1; } if(_ptrOutStream == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Recording is active, but output stream is NULL!"); + LOG(LS_ERROR) << "Recording is active, but output stream is NULL!"; assert(false); return -1; } @@ -663,8 +625,7 @@ int32_t MediaFileImpl::IncomingAudioData( *_ptrOutStream, buffer, bufferLengthInBytes); break; default: - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Invalid file format: %d", _fileFormat); + LOG(LS_ERROR) << "Invalid file format: " << _fileFormat; assert(false); break; } @@ -693,8 +654,7 @@ int32_t MediaFileImpl::IncomingAudioData( } if(bytesWritten < (int32_t)bufferLengthInBytes) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Failed to write all requested bytes!"); + LOG(LS_WARNING) << "Failed to write all requested bytes!"; StopRecording(); recordingEnded = true; } @@ -736,15 +696,14 @@ int32_t MediaFileImpl::StartRecordingAudioFile( FileWrapper* outputStream = FileWrapper::Create(); if(outputStream == NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "Failed to allocate memory for output stream"); + LOG(LS_INFO) << "Failed to allocate memory for output stream"; return -1; } if (!outputStream->OpenFile(fileName, false)) { delete outputStream; - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Could not open output file '%s' for writing!", fileName); + LOG(LS_ERROR) << "Could not open output file '" << fileName + << "' for writing!"; return -1; } @@ -783,31 +742,24 @@ int32_t MediaFileImpl::StartRecordingAudioStream( rtc::CritScope lock(&_crit); if(_recordingActive || _playingActive) { - WEBRTC_TRACE( - kTraceError, - kTraceFile, - _id, - "StartRecording called, but already recording or playing file %s!", - _fileName); + LOG(LS_ERROR) + << "StartRecording called, but already recording or playing file " + << _fileName << "!"; return -1; } if(_ptrFileUtilityObj != NULL) { - WEBRTC_TRACE( - kTraceError, - kTraceFile, - _id, - "StartRecording called, but fileUtilityObj already exists!"); + LOG(LS_ERROR) + << "StartRecording called, but fileUtilityObj already exists!"; StopRecording(); return -1; } - _ptrFileUtilityObj = new ModuleFileUtility(_id); + _ptrFileUtilityObj = new ModuleFileUtility(); if(_ptrFileUtilityObj == NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "Cannot allocate fileUtilityObj!"); + LOG(LS_INFO) << "Cannot allocate fileUtilityObj!"; return -1; } @@ -819,8 +771,7 @@ int32_t MediaFileImpl::StartRecordingAudioStream( { if(_ptrFileUtilityObj->InitWavWriting(stream, codecInst) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Failed to initialize WAV file!"); + LOG(LS_ERROR) << "Failed to initialize WAV file!"; delete _ptrFileUtilityObj; _ptrFileUtilityObj = NULL; return -1; @@ -834,8 +785,7 @@ int32_t MediaFileImpl::StartRecordingAudioStream( if(_ptrFileUtilityObj->InitCompressedWriting(stream, codecInst) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Failed to initialize Compressed file!"); + LOG(LS_ERROR) << "Failed to initialize Compressed file!"; delete _ptrFileUtilityObj; _ptrFileUtilityObj = NULL; return -1; @@ -850,8 +800,7 @@ int32_t MediaFileImpl::StartRecordingAudioStream( _ptrFileUtilityObj->InitPCMWriting(stream, codecInst.plfreq) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Failed to initialize 8 or 16KHz PCM file!"); + LOG(LS_ERROR) << "Failed to initialize 8 or 16KHz PCM file!"; delete _ptrFileUtilityObj; _ptrFileUtilityObj = NULL; return -1; @@ -864,8 +813,7 @@ int32_t MediaFileImpl::StartRecordingAudioStream( if(_ptrFileUtilityObj->InitPreEncodedWriting(stream, codecInst) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Failed to initialize Pre-Encoded file!"); + LOG(LS_ERROR) << "Failed to initialize Pre-Encoded file!"; delete _ptrFileUtilityObj; _ptrFileUtilityObj = NULL; return -1; @@ -876,8 +824,7 @@ int32_t MediaFileImpl::StartRecordingAudioStream( } default: { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Invalid file format %d specified!", format); + LOG(LS_ERROR) << "Invalid file format " << format << " specified!"; delete _ptrFileUtilityObj; _ptrFileUtilityObj = NULL; return -1; @@ -888,8 +835,7 @@ int32_t MediaFileImpl::StartRecordingAudioStream( { if(_fileFormat != kFileFormatWavFile) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "Stereo is only allowed for WAV files"); + LOG(LS_WARNING) << "Stereo is only allowed for WAV files"; StopRecording(); return -1; } @@ -897,11 +843,8 @@ int32_t MediaFileImpl::StartRecordingAudioStream( (STR_NCASE_CMP(tmpAudioCodec.plname, "PCMU", 5) != 0) && (STR_NCASE_CMP(tmpAudioCodec.plname, "PCMA", 5) != 0)) { - WEBRTC_TRACE( - kTraceWarning, - kTraceFile, - _id, - "Stereo is only allowed for codec PCMU, PCMA and L16 "); + LOG(LS_WARNING) + << "Stereo is only allowed for codec PCMU, PCMA and L16 "; StopRecording(); return -1; } @@ -920,8 +863,7 @@ int32_t MediaFileImpl::StopRecording() rtc::CritScope lock(&_crit); if(!_recordingActive) { - WEBRTC_TRACE(kTraceWarning, kTraceFile, _id, - "recording is not active!"); + LOG(LS_WARNING) << "recording is not active!"; return -1; } @@ -960,7 +902,7 @@ int32_t MediaFileImpl::StopRecording() bool MediaFileImpl::IsRecording() { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, "MediaFileImpl::IsRecording()"); + LOG(LS_VERBOSE) << "MediaFileImpl::IsRecording()"; rtc::CritScope lock(&_crit); return _recordingActive; } @@ -980,7 +922,7 @@ int32_t MediaFileImpl::RecordDurationMs(uint32_t& durationMs) bool MediaFileImpl::IsStereo() { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, "MediaFileImpl::IsStereo()"); + LOG(LS_VERBOSE) << "MediaFileImpl::IsStereo()"; rtc::CritScope lock(&_crit); return _isStereo; } @@ -1009,11 +951,10 @@ int32_t MediaFileImpl::FileDurationMs(const char* fileName, return -1; } - ModuleFileUtility* utilityObj = new ModuleFileUtility(_id); + ModuleFileUtility* utilityObj = new ModuleFileUtility(); if(utilityObj == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "failed to allocate utility object!"); + LOG(LS_ERROR) << "failed to allocate utility object!"; return -1; } @@ -1047,15 +988,14 @@ int32_t MediaFileImpl::codec_info(CodecInst& codecInst) const rtc::CritScope lock(&_crit); if(!_playingActive && !_recordingActive) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Neither playout nor recording has been initialized!"); + LOG(LS_ERROR) << "Neither playout nor recording has been initialized!"; return -1; } if (codec_info_.pltype == 0 && codec_info_.plname[0] == '\0') { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "The CodecInst for %s is unknown!", - _playingActive ? "Playback" : "Recording"); + LOG(LS_ERROR) << "The CodecInst for " + << (_playingActive ? "Playback" : "Recording") + << " is unknown!"; return -1; } memcpy(&codecInst,&codec_info_,sizeof(CodecInst)); @@ -1072,8 +1012,7 @@ bool MediaFileImpl::ValidFileFormat(const FileFormats format, format == kFileFormatPcm16kHzFile || format == kFileFormatPcm32kHzFile) { - WEBRTC_TRACE(kTraceError, kTraceFile, -1, - "Codec info required for file format specified!"); + LOG(LS_ERROR) << "Codec info required for file format specified!"; return false; } } @@ -1084,7 +1023,7 @@ bool MediaFileImpl::ValidFileName(const char* fileName) { if((fileName == NULL) ||(fileName[0] == '\0')) { - WEBRTC_TRACE(kTraceError, kTraceFile, -1, "FileName not specified!"); + LOG(LS_ERROR) << "FileName not specified!"; return false; } return true; @@ -1100,14 +1039,12 @@ bool MediaFileImpl::ValidFilePositions(const uint32_t startPointMs, } if(stopPointMs &&(startPointMs >= stopPointMs)) { - WEBRTC_TRACE(kTraceError, kTraceFile, -1, - "startPointMs must be less than stopPointMs!"); + LOG(LS_ERROR) << "startPointMs must be less than stopPointMs!"; return false; } if(stopPointMs &&((stopPointMs - startPointMs) < 20)) { - WEBRTC_TRACE(kTraceError, kTraceFile, -1, - "minimum play duration for files is 20 ms!"); + LOG(LS_ERROR) << "minimum play duration for files is 20 ms!"; return false; } return true; @@ -1119,8 +1056,7 @@ bool MediaFileImpl::ValidFrequency(const uint32_t frequency) { return true; } - WEBRTC_TRACE(kTraceError, kTraceFile, -1, - "Frequency should be 8000, 16000 or 32000 (Hz)"); + LOG(LS_ERROR) << "Frequency should be 8000, 16000 or 32000 (Hz)"; return false; } } // namespace webrtc diff --git a/webrtc/modules/media_file/media_file_utility.cc b/webrtc/modules/media_file/media_file_utility.cc index d30581230c..883f17780e 100644 --- a/webrtc/modules/media_file/media_file_utility.cc +++ b/webrtc/modules/media_file/media_file_utility.cc @@ -19,8 +19,8 @@ #include "webrtc/common_types.h" #include "webrtc/modules/include/module_common_types.h" #include "webrtc/rtc_base/format_macros.h" +#include "webrtc/rtc_base/logging.h" #include "webrtc/system_wrappers/include/file_wrapper.h" -#include "webrtc/system_wrappers/include/trace.h" #include "webrtc/typedefs.h" namespace { @@ -44,11 +44,10 @@ struct WAVE_CHUNK_header } // unnamed namespace namespace webrtc { -ModuleFileUtility::ModuleFileUtility(const int32_t id) +ModuleFileUtility::ModuleFileUtility() : _wavFormatObj(), _dataSize(0), _readSizeBytes(0), - _id(id), _stopPointInMs(0), _startPointInMs(0), _playoutPositionMs(0), @@ -60,16 +59,14 @@ ModuleFileUtility::ModuleFileUtility(const int32_t id) _reading(false), _writing(false), _tempData() { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "ModuleFileUtility::ModuleFileUtility()"); + LOG(LS_INFO) << "ModuleFileUtility::ModuleFileUtility()"; memset(&codec_info_,0,sizeof(CodecInst)); codec_info_.pltype = -1; } ModuleFileUtility::~ModuleFileUtility() { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "ModuleFileUtility::~ModuleFileUtility()"); + LOG(LS_INFO) << "ModuleFileUtility::~ModuleFileUtility()"; } int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) @@ -89,8 +86,7 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) int len = wav.Read(&RIFFheaderObj, sizeof(WAVE_RIFF_header)); if (len != static_cast(sizeof(WAVE_RIFF_header))) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a wave file (too short)"); + LOG(LS_ERROR) << "Not a wave file (too short)"; return -1; } @@ -100,8 +96,7 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) } if(strcmp(tmpStr, "RIFF") != 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a wave file (does not have RIFF)"); + LOG(LS_ERROR) << "Not a wave file (does not have RIFF)"; return -1; } for (i = 0; i < 4; i++) @@ -110,8 +105,7 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) } if(strcmp(tmpStr, "WAVE") != 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Not a wave file (does not have WAVE)"); + LOG(LS_ERROR) << "Not a wave file (does not have WAVE)"; return -1; } @@ -165,8 +159,7 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) if (CHUNKheaderObj.fmt_ckSize < sizeof(WAVE_FMTINFO_header)) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Chunk size is too small"); + LOG(LS_ERROR) << "Chunk size is too small"; return -1; } for (i = 0; @@ -176,8 +169,8 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) len = wav.Read(&dummyRead, 1); if(len != 1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "File corrupted, reached EOF (reading fmt)"); + LOG(LS_ERROR) + << "File corrupted, reached EOF (reading fmt)"; return -1; } } @@ -196,8 +189,8 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) len = wav.Read(&dummyRead, 1); if(len != 1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "File corrupted, reached EOF (reading other)"); + LOG(LS_ERROR) + << "File corrupted, reached EOF (reading other)"; return -1; } } @@ -219,26 +212,23 @@ int32_t ModuleFileUtility::ReadWavHeader(InStream& wav) (_wavFormatObj.formatTag != kWavFormatALaw) && (_wavFormatObj.formatTag != kWavFormatMuLaw)) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Coding formatTag value=%d not supported!", - _wavFormatObj.formatTag); + LOG(LS_ERROR) << "Coding formatTag value=" << _wavFormatObj.formatTag + << " not supported!"; return -1; } if((_wavFormatObj.nChannels < 1) || (_wavFormatObj.nChannels > 2)) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "nChannels value=%d not supported!", - _wavFormatObj.nChannels); + LOG(LS_ERROR) << "nChannels value=" << _wavFormatObj.nChannels + << " not supported!"; return -1; } if((_wavFormatObj.nBitsPerSample != 8) && (_wavFormatObj.nBitsPerSample != 16)) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "nBitsPerSample value=%d not supported!", - _wavFormatObj.nBitsPerSample); + LOG(LS_ERROR) << "nBitsPerSample value=" << _wavFormatObj.nBitsPerSample + << " not supported!"; return -1; } @@ -326,14 +316,12 @@ int32_t ModuleFileUtility::InitWavCodec(uint32_t samplesPerSec, } else { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Unsupported PCM frequency!"); + LOG(LS_ERROR) << "Unsupported PCM frequency!"; return -1; } break; default: - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "unknown WAV format TAG!"); + LOG(LS_ERROR) << "unknown WAV format TAG!"; return -1; break; } @@ -349,8 +337,7 @@ int32_t ModuleFileUtility::InitWavReading(InStream& wav, if(ReadWavHeader(wav) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "failed to read WAV header!"); + LOG(LS_ERROR) << "failed to read WAV header!"; return -1; } @@ -373,8 +360,8 @@ int32_t ModuleFileUtility::InitWavReading(InStream& wav, } else // Must have reached EOF before start position! { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "InitWavReading(), EOF before start position"); + LOG(LS_ERROR) + << "InitWavReading(), EOF before start position"; return -1; } } @@ -404,15 +391,9 @@ int32_t ModuleFileUtility::ReadWavDataAsMono( int8_t* outData, const size_t bufferSize) { - WEBRTC_TRACE( - kTraceStream, - kTraceFile, - _id, - "ModuleFileUtility::ReadWavDataAsMono(wav= 0x%x, outData= 0x%d, " - "bufSize= %" PRIuS ")", - &wav, - outData, - bufferSize); + LOG(LS_VERBOSE) << "ModuleFileUtility::ReadWavDataAsMono(wav= " << &wav + << ", outData= " << static_cast(outData) + << ", bufSize= " << bufferSize << ")"; // The number of bytes that should be read from file. const size_t totalBytesNeeded = _readSizeBytes; @@ -421,21 +402,18 @@ int32_t ModuleFileUtility::ReadWavDataAsMono( totalBytesNeeded >> 1 : totalBytesNeeded; if(bufferSize < bytesRequested) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsMono: output buffer is too short!"); + LOG(LS_ERROR) << "ReadWavDataAsMono: output buffer is too short!"; return -1; } if(outData == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsMono: output buffer NULL!"); + LOG(LS_ERROR) << "ReadWavDataAsMono: output buffer NULL!"; return -1; } if(!_reading) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsMono: no longer reading file."); + LOG(LS_ERROR) << "ReadWavDataAsMono: no longer reading file."; return -1; } @@ -449,8 +427,8 @@ int32_t ModuleFileUtility::ReadWavDataAsMono( } if(bytesRead < 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsMono: failed to read data from WAV file."); + LOG(LS_ERROR) + << "ReadWavDataAsMono: failed to read data from WAV file."; return -1; } // Output data is should be mono. @@ -483,37 +461,26 @@ int32_t ModuleFileUtility::ReadWavDataAsStereo( int8_t* outDataRight, const size_t bufferSize) { - WEBRTC_TRACE( - kTraceStream, - kTraceFile, - _id, - "ModuleFileUtility::ReadWavDataAsStereo(wav= 0x%x, outLeft= 0x%x, " - "outRight= 0x%x, bufSize= %" PRIuS ")", - &wav, - outDataLeft, - outDataRight, - bufferSize); + LOG(LS_VERBOSE) << "ModuleFileUtility::ReadWavDataAsStereo(wav= " << &wav + << ", outLeft= " << static_cast(outDataLeft) + << ", outRight= " << static_cast(outDataRight) + << ", bufSize= " << bufferSize << ")"; if((outDataLeft == NULL) || (outDataRight == NULL)) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsMono: an input buffer is NULL!"); + LOG(LS_ERROR) << "ReadWavDataAsStereo: an input buffer is NULL!"; return -1; } if(codec_info_.channels != 2) { - WEBRTC_TRACE( - kTraceError, - kTraceFile, - _id, - "ReadWavDataAsStereo: WAV file does not contain stereo data!"); + LOG(LS_ERROR) + << "ReadWavDataAsStereo: WAV file does not contain stereo data!"; return -1; } if(! _reading) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsStereo: no longer reading file."); + LOG(LS_ERROR) << "ReadWavDataAsStereo: no longer reading file."; return -1; } @@ -524,8 +491,7 @@ int32_t ModuleFileUtility::ReadWavDataAsStereo( const size_t bytesRequested = totalBytesNeeded >> 1; if(bufferSize < bytesRequested) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavData: Output buffers are too short!"); + LOG(LS_ERROR) << "ReadWavDataAsStereo: Output buffers are too short!"; assert(false); return -1; } @@ -533,8 +499,8 @@ int32_t ModuleFileUtility::ReadWavDataAsStereo( int32_t bytesRead = ReadWavData(wav, _tempData, totalBytesNeeded); if(bytesRead <= 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsStereo: failed to read data from WAV file."); + LOG(LS_ERROR) + << "ReadWavDataAsStereo: failed to read data from WAV file."; return -1; } @@ -563,9 +529,8 @@ int32_t ModuleFileUtility::ReadWavDataAsStereo( outRight[i] = sampleData[(2 * i) + 1]; } } else { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavStereoData: unsupported sample size %" PRIuS "!", - _bytesPerSample); + LOG(LS_ERROR) << "ReadWavStereoData: unsupported sample size " + << _bytesPerSample << "!"; assert(false); return -1; } @@ -576,15 +541,13 @@ int32_t ModuleFileUtility::ReadWavData(InStream& wav, uint8_t* buffer, size_t dataLengthInBytes) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::ReadWavData(wav= 0x%x, buffer= 0x%x, " - "dataLen= %" PRIuS ")", &wav, buffer, dataLengthInBytes); - + LOG(LS_VERBOSE) << "ModuleFileUtility::ReadWavData(wav= " << &wav + << ", buffer= " << static_cast(buffer) + << ", dataLen= " << dataLengthInBytes << ")"; if(buffer == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadWavDataAsMono: output buffer NULL!"); + LOG(LS_ERROR) << "ReadWavDataAsMono: output buffer NULL!"; return -1; } @@ -658,8 +621,7 @@ int32_t ModuleFileUtility::InitWavWriting(OutStream& wav, if(set_codec_info(codecInst) != 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "codecInst identifies unsupported codec!"); + LOG(LS_ERROR) << "codecInst identifies unsupported codec!"; return -1; } _writing = false; @@ -694,8 +656,7 @@ int32_t ModuleFileUtility::InitWavWriting(OutStream& wav, } else { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "codecInst identifies unsupported codec for WAV file!"); + LOG(LS_ERROR) << "codecInst identifies unsupported codec for WAV file!"; return -1; } _writing = true; @@ -707,14 +668,13 @@ int32_t ModuleFileUtility::WriteWavData(OutStream& out, const int8_t* buffer, const size_t dataLength) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::WriteWavData(out= 0x%x, buf= 0x%x, " - "dataLen= %" PRIuS ")", &out, buffer, dataLength); + LOG(LS_VERBOSE) << "ModuleFileUtility::WriteWavData(out= " << &out + << ", buf= " << static_cast(buffer) + << ", dataLen= " << dataLength << ")"; if(buffer == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "WriteWavData: input buffer NULL!"); + LOG(LS_ERROR) << "WriteWavData: input buffer NULL!"; return -1; } @@ -790,14 +750,12 @@ int32_t ModuleFileUtility::InitPreEncodedReading(InStream& in, if(set_codec_info(cinst) != 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Pre-encoded file send codec mismatch!"); + LOG(LS_ERROR) << "Pre-encoded file send codec mismatch!"; return -1; } if(codecType != _codecId) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "Pre-encoded file format codec mismatch!"); + LOG(LS_ERROR) << "Pre-encoded file format codec mismatch!"; return -1; } memcpy(&codec_info_,&cinst,sizeof(CodecInst)); @@ -810,14 +768,13 @@ int32_t ModuleFileUtility::ReadPreEncodedData( int8_t* outData, const size_t bufferSize) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::ReadPreEncodedData(in= 0x%x, " - "outData= 0x%x, bufferSize= %" PRIuS ")", &in, outData, - bufferSize); + LOG(LS_VERBOSE) << "ModuleFileUtility::ReadPreEncodedData(in= " << &in + << ", outData= " << static_cast(outData) + << ", bufferSize= " << bufferSize << ")"; if(outData == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "output buffer NULL"); + LOG(LS_ERROR) << "output buffer NULL"; } size_t frameLen; @@ -840,9 +797,8 @@ int32_t ModuleFileUtility::ReadPreEncodedData( frameLen = buf[0] + buf[1] * 256; if(bufferSize < frameLen) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "buffer not large enough to read %" PRIuS " bytes of " - "pre-encoded data!", frameLen); + LOG(LS_ERROR) << "buffer not large enough to read " << frameLen + << " bytes of pre-encoded data!"; return -1; } return in.Read(outData, frameLen); @@ -855,7 +811,7 @@ int32_t ModuleFileUtility::InitPreEncodedWriting( if(set_codec_info(codecInst) != 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "CodecInst not recognized!"); + LOG(LS_ERROR) << "CodecInst not recognized!"; return -1; } _writing = true; @@ -869,14 +825,13 @@ int32_t ModuleFileUtility::WritePreEncodedData( const int8_t* buffer, const size_t dataLength) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::WritePreEncodedData(out= 0x%x, " - "inData= 0x%x, dataLen= %" PRIuS ")", &out, buffer, - dataLength); + LOG(LS_VERBOSE) << "ModuleFileUtility::WritePreEncodedData(out= " << &out + << " , inData= " << static_cast(buffer) + << ", dataLen= " << dataLength << ")"; if(buffer == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id,"buffer NULL"); + LOG(LS_ERROR) << "buffer NULL"; } size_t bytesWritten = 0; @@ -903,9 +858,8 @@ int32_t ModuleFileUtility::InitCompressedReading( const uint32_t start, const uint32_t stop) { - WEBRTC_TRACE(kTraceDebug, kTraceFile, _id, - "ModuleFileUtility::InitCompressedReading(in= 0x%x, " - "start= %d, stop= %d)", &in, start, stop); + LOG(LS_VERBOSE) << "ModuleFileUtility::InitCompressedReading(in= " << &in + << ", start= " << start << ", stop= " << stop << ")"; #if defined(WEBRTC_CODEC_ILBC) int16_t read_len = 0; @@ -992,15 +946,15 @@ int32_t ModuleFileUtility::ReadCompressedData(InStream& in, int8_t* outData, size_t bufferSize) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::ReadCompressedData(in=0x%x, outData=0x%x, " - "bytes=%" PRIuS ")", &in, outData, bufferSize); + LOG(LS_VERBOSE) << "ModuleFileUtility::ReadCompressedData(in=" << &in + << ", outData=" << static_cast(outData) << ", bytes=" + << bufferSize << ")"; int bytesRead = 0; if(! _reading) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "not currently reading!"); + LOG(LS_ERROR) << "not currently reading!"; return -1; } @@ -1019,9 +973,8 @@ int32_t ModuleFileUtility::ReadCompressedData(InStream& in, } if(bufferSize < byteSize) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "output buffer is too short to read ILBC compressed " - "data."); + LOG(LS_ERROR) + << "output buffer is too short to read ILBC compressed data."; assert(false); return -1; } @@ -1049,8 +1002,8 @@ int32_t ModuleFileUtility::ReadCompressedData(InStream& in, #endif if(bytesRead == 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadCompressedData() no bytes read, codec not supported"); + LOG(LS_ERROR) + << "ReadCompressedData() no bytes read, codec not supported"; return -1; } @@ -1074,9 +1027,8 @@ int32_t ModuleFileUtility::InitCompressedWriting( OutStream& out, const CodecInst& codecInst) { - WEBRTC_TRACE(kTraceDebug, kTraceFile, _id, - "ModuleFileUtility::InitCompressedWriting(out= 0x%x, " - "codecName= %s)", &out, codecInst.plname); + LOG(LS_VERBOSE) << "ModuleFileUtility::InitCompressedWriting(out= " << &out + << ", codecName= " << codecInst.plname << ")"; _writing = false; @@ -1095,8 +1047,7 @@ int32_t ModuleFileUtility::InitCompressedWriting( } else { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "codecInst defines unsupported compression codec!"); + LOG(LS_ERROR) << "codecInst defines unsupported compression codec!"; return -1; } memcpy(&codec_info_,&codecInst,sizeof(CodecInst)); @@ -1105,8 +1056,7 @@ int32_t ModuleFileUtility::InitCompressedWriting( } #endif - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "codecInst defines unsupported compression codec!"); + LOG(LS_ERROR) << "codecInst defines unsupported compression codec!"; return -1; } @@ -1115,13 +1065,13 @@ int32_t ModuleFileUtility::WriteCompressedData( const int8_t* buffer, const size_t dataLength) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::WriteCompressedData(out= 0x%x, buf= 0x%x, " - "dataLen= %" PRIuS ")", &out, buffer, dataLength); + LOG(LS_VERBOSE) << "ModuleFileUtility::WriteCompressedData(out= " << &out + << ", buf= " << static_cast(buffer) + << ", dataLen= " << dataLength << ")"; if(buffer == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id,"buffer NULL"); + LOG(LS_ERROR) << "buffer NULL"; } if(!out.Write(buffer, dataLength)) @@ -1136,9 +1086,9 @@ int32_t ModuleFileUtility::InitPCMReading(InStream& pcm, const uint32_t stop, uint32_t freq) { - WEBRTC_TRACE(kTraceInfo, kTraceFile, _id, - "ModuleFileUtility::InitPCMReading(pcm= 0x%x, start=%d, " - "stop=%d, freq=%d)", &pcm, start, stop, freq); + LOG(LS_VERBOSE) << "ModuleFileUtility::InitPCMReading(pcm= " << &pcm + << ", start=" << start << ", stop=" << stop << ", freq=" + << freq << ")"; int8_t dummy[320]; int read_len; @@ -1201,21 +1151,21 @@ int32_t ModuleFileUtility::ReadPCMData(InStream& pcm, int8_t* outData, size_t bufferSize) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::ReadPCMData(pcm= 0x%x, outData= 0x%x, " - "bufSize= %" PRIuS ")", &pcm, outData, bufferSize); + LOG(LS_VERBOSE) << "ModuleFileUtility::ReadPCMData(pcm= " << &pcm + << ", outData= " << static_cast(outData) + << ", bufSize= " << bufferSize << ")"; if(outData == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "buffer NULL"); + LOG(LS_ERROR) << "buffer NULL"; } // Readsize for 10ms of audio data (2 bytes per sample). size_t bytesRequested = static_cast(2 * codec_info_.plfreq / 100); if(bufferSize < bytesRequested) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadPCMData: buffer not long enough for a 10ms frame."); + LOG(LS_ERROR) + << "ReadPCMData: buffer not long enough for a 10ms frame."; assert(false); return -1; } @@ -1249,8 +1199,7 @@ int32_t ModuleFileUtility::ReadPCMData(InStream& pcm, } if(bytesRead <= 0) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "ReadPCMData: Failed to rewind audio file."); + LOG(LS_ERROR) << "ReadPCMData: Failed to rewind audio file."; return -1; } } @@ -1258,8 +1207,7 @@ int32_t ModuleFileUtility::ReadPCMData(InStream& pcm, if(bytesRead <= 0) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ReadPCMData: end of file"); + LOG(LS_VERBOSE) << "ReadPCMData: end of file"; return -1; } _playoutPositionMs += 10; @@ -1317,8 +1265,7 @@ int32_t ModuleFileUtility::InitPCMWriting(OutStream& out, uint32_t freq) (_codecId != kCodecL16_16kHz) && (_codecId != kCodecL16_32Khz)) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "CodecInst is not 8KHz PCM or 16KHz PCM!"); + LOG(LS_ERROR) << "CodecInst is not 8KHz PCM or 16KHz PCM!"; return -1; } _writing = true; @@ -1330,13 +1277,13 @@ int32_t ModuleFileUtility::WritePCMData(OutStream& out, const int8_t* buffer, const size_t dataLength) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::WritePCMData(out= 0x%x, buf= 0x%x, " - "dataLen= %" PRIuS ")", &out, buffer, dataLength); + LOG(LS_VERBOSE) << "ModuleFileUtility::WritePCMData(out= " << &out + << ", buf= " << static_cast(buffer) + << ", dataLen= " << dataLength << ")"; if(buffer == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "buffer NULL"); + LOG(LS_ERROR) << "buffer NULL"; } if(!out.Write(buffer, dataLength)) @@ -1350,13 +1297,12 @@ int32_t ModuleFileUtility::WritePCMData(OutStream& out, int32_t ModuleFileUtility::codec_info(CodecInst& codecInst) { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::codec_info(codecInst= 0x%x)", &codecInst); + LOG(LS_VERBOSE) << "ModuleFileUtility::codec_info(codecInst= " << &codecInst + << ")"; if(!_reading && !_writing) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "CodecInst: not currently reading audio file!"); + LOG(LS_ERROR) << "CodecInst: not currently reading audio file!"; return -1; } memcpy(&codecInst,&codec_info_,sizeof(CodecInst)); @@ -1437,7 +1383,7 @@ int32_t ModuleFileUtility::FileDurationMs(const char* fileName, if(fileName == NULL) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "filename NULL"); + LOG(LS_ERROR) << "filename NULL"; return -1; } @@ -1445,21 +1391,18 @@ int32_t ModuleFileUtility::FileDurationMs(const char* fileName, struct stat file_size; if(stat(fileName,&file_size) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "failed to retrieve file size with stat!"); + LOG(LS_ERROR) << "failed to retrieve file size with stat!"; return -1; } FileWrapper* inStreamObj = FileWrapper::Create(); if(inStreamObj == NULL) { - WEBRTC_TRACE(kTraceMemory, kTraceFile, _id, - "failed to create InStream object!"); + LOG(LS_INFO) << "failed to create InStream object!"; return -1; } if (!inStreamObj->OpenFile(fileName, true)) { delete inStreamObj; - WEBRTC_TRACE(kTraceError, kTraceFile, _id, "failed to open file %s!", - fileName); + LOG(LS_ERROR) << "failed to open file " << fileName << "!"; return -1; } @@ -1469,8 +1412,7 @@ int32_t ModuleFileUtility::FileDurationMs(const char* fileName, { if(ReadWavHeader(*inStreamObj) == -1) { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "failed to read WAV file header!"); + LOG(LS_ERROR) << "failed to read WAV file header!"; return -1; } time_in_ms = ((file_size.st_size - 44) / @@ -1534,13 +1476,11 @@ int32_t ModuleFileUtility::FileDurationMs(const char* fileName, } case kFileFormatPreencodedFile: { - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "cannot determine duration of Pre-Encoded file!"); + LOG(LS_ERROR) << "cannot determine duration of Pre-Encoded file!"; break; } default: - WEBRTC_TRACE(kTraceError, kTraceFile, _id, - "unsupported file format %d!", fileFormat); + LOG(LS_ERROR) << "unsupported file format " << fileFormat << "!"; break; } inStreamObj->CloseFile(); @@ -1550,8 +1490,7 @@ int32_t ModuleFileUtility::FileDurationMs(const char* fileName, uint32_t ModuleFileUtility::PlayoutPositionMs() { - WEBRTC_TRACE(kTraceStream, kTraceFile, _id, - "ModuleFileUtility::PlayoutPosition()"); + LOG(LS_VERBOSE) << "ModuleFileUtility::PlayoutPosition()"; return _reading ? _playoutPositionMs : 0; } diff --git a/webrtc/modules/media_file/media_file_utility.h b/webrtc/modules/media_file/media_file_utility.h index 52cd8078df..8139a7c449 100644 --- a/webrtc/modules/media_file/media_file_utility.h +++ b/webrtc/modules/media_file/media_file_utility.h @@ -25,7 +25,7 @@ class ModuleFileUtility { public: - ModuleFileUtility(const int32_t id); + ModuleFileUtility(); ~ModuleFileUtility(); // Prepare for playing audio from stream. @@ -257,8 +257,6 @@ private: // chunks if reading WAV. size_t _readSizeBytes; - int32_t _id; - uint32_t _stopPointInMs; uint32_t _startPointInMs; uint32_t _playoutPositionMs;