Convert WEBRTC_TRACE to LOG in utility.

BUG=3153
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/11099004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5886 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
asapersson@webrtc.org 2014-04-11 07:59:43 +00:00
parent b884eb6118
commit 8b2ec15d1e
6 changed files with 57 additions and 162 deletions

View File

@ -9,7 +9,7 @@
*/
#include "webrtc/modules/utility/source/file_player_impl.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/system_wrappers/interface/logging.h"
#ifdef WEBRTC_MODULE_UTILITY_VIDEO
#include "frame_scaler.h"
@ -35,8 +35,6 @@ FilePlayer* FilePlayer::CreateFilePlayer(uint32_t instanceID,
#ifdef WEBRTC_MODULE_UTILITY_VIDEO
return new VideoFilePlayerImpl(instanceID, fileFormat);
#else
WEBRTC_TRACE(kTraceError, kTraceFile, -1,
"Invalid file format: %d", kFileFormatAviFile);
assert(false);
return NULL;
#endif
@ -114,10 +112,9 @@ int32_t FilePlayerImpl::Get10msAudioFromFile(
{
if(_codec.plfreq == 0)
{
WEBRTC_TRACE(kTraceWarning, kTraceVoice, _instanceID,
"FilePlayerImpl::Get10msAudioFromFile() playing not started!\
codecFreq = %d, wantedFreq = %d",
_codec.plfreq, frequencyInHz);
LOG(LS_WARNING) << "Get10msAudioFromFile() playing not started!"
<< " codec freq = " << _codec.plfreq
<< ", wanted freq = " << frequencyInHz;
return -1;
}
@ -175,8 +172,7 @@ int32_t FilePlayerImpl::Get10msAudioFromFile(
if(_resampler.ResetIfNeeded(unresampledAudioFrame.sample_rate_hz_,
frequencyInHz, kResamplerSynchronous))
{
WEBRTC_TRACE(kTraceWarning, kTraceVoice, _instanceID,
"FilePlayerImpl::Get10msAudioFromFile() unexpected codec");
LOG(LS_WARNING) << "Get10msAudioFromFile() unexpected codec.";
// New sampling frequency. Update state.
outLen = frequencyInHz / 100;
@ -214,8 +210,7 @@ int32_t FilePlayerImpl::SetAudioScaling(float scaleFactor)
_scaling = scaleFactor;
return 0;
}
WEBRTC_TRACE(kTraceWarning, kTraceVoice, _instanceID,
"FilePlayerImpl::SetAudioScaling() not allowed scale factor");
LOG(LS_WARNING) << "SetAudioScaling() non-allowed scale factor.";
return -1;
}
@ -255,9 +250,8 @@ int32_t FilePlayerImpl::StartPlayingFile(const char* fileName,
codecInstL16.pacsize = 160;
} else
{
WEBRTC_TRACE(kTraceError, kTraceVoice, _instanceID,
"FilePlayerImpl::StartPlayingFile() sample frequency\
specifed not supported for PCM format.");
LOG(LS_ERROR) << "StartPlayingFile() sample frequency not "
<< "supported for PCM format.";
return -1;
}
@ -266,12 +260,8 @@ int32_t FilePlayerImpl::StartPlayingFile(const char* fileName,
startPosition,
stopPosition) == -1)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() failed to initialize file\
%s playout.", fileName);
LOG(LS_WARNING) << "StartPlayingFile() failed to initialize "
<< "pcm file " << fileName;
return -1;
}
SetAudioScaling(volumeScaling);
@ -280,13 +270,8 @@ int32_t FilePlayerImpl::StartPlayingFile(const char* fileName,
if (_fileModule.StartPlayingAudioFile(fileName, notification, loop,
_fileFormat, codecInst) == -1)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingPreEncodedFile() failed to\
initialize pre-encoded file %s playout.",
fileName);
LOG(LS_WARNING) << "StartPlayingFile() failed to initialize "
<< "pre-encoded file " << fileName;
return -1;
}
} else
@ -297,12 +282,8 @@ int32_t FilePlayerImpl::StartPlayingFile(const char* fileName,
startPosition,
stopPosition) == -1)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() failed to initialize file\
%s playout.", fileName);
LOG(LS_WARNING) << "StartPlayingFile() failed to initialize file "
<< fileName;
return -1;
}
SetAudioScaling(volumeScaling);
@ -350,12 +331,8 @@ int32_t FilePlayerImpl::StartPlayingFile(InStream& sourceStream,
codecInstL16.pacsize = 160;
}else
{
WEBRTC_TRACE(
kTraceError,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() sample frequency specifed\
not supported for PCM format.");
LOG(LS_ERROR) << "StartPlayingFile() sample frequency not "
<< "supported for PCM format.";
return -1;
}
if (_fileModule.StartPlayingAudioStream(sourceStream, notification,
@ -363,12 +340,8 @@ int32_t FilePlayerImpl::StartPlayingFile(InStream& sourceStream,
startPosition,
stopPosition) == -1)
{
WEBRTC_TRACE(
kTraceError,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() failed to initialize stream\
playout.");
LOG(LS_ERROR) << "StartPlayingFile() failed to initialize stream "
<< "playout.";
return -1;
}
@ -377,12 +350,8 @@ int32_t FilePlayerImpl::StartPlayingFile(InStream& sourceStream,
if (_fileModule.StartPlayingAudioStream(sourceStream, notification,
_fileFormat, codecInst) == -1)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() failed to initialize stream\
playout.");
LOG(LS_ERROR) << "StartPlayingFile() failed to initialize stream "
<< "playout.";
return -1;
}
} else {
@ -392,9 +361,8 @@ int32_t FilePlayerImpl::StartPlayingFile(InStream& sourceStream,
startPosition,
stopPosition) == -1)
{
WEBRTC_TRACE(kTraceError, kTraceVoice, _instanceID,
"FilePlayerImpl::StartPlayingFile() failed to initialize\
stream playout.");
LOG(LS_ERROR) << "StartPlayingFile() failed to initialize stream "
<< "playout.";
return -1;
}
}
@ -430,23 +398,14 @@ int32_t FilePlayerImpl::SetUpAudioDecoder()
{
if ((_fileModule.codec_info(_codec) == -1))
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() failed to retrieve Codec info\
of file data.");
LOG(LS_WARNING) << "Failed to retrieve codec info of file data.";
return -1;
}
if( STR_CASE_CMP(_codec.plname, "L16") != 0 &&
_audioDecoder.SetDecodeCodec(_codec,AMRFileStorage) == -1)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FilePlayerImpl::StartPlayingFile() codec %s not supported",
_codec.plname);
LOG(LS_WARNING) << "SetUpAudioDecoder() codec " << _codec.plname
<< " not supported.";
return -1;
}
_numberOf10MsPerFrame = _codec.pacsize / (_codec.plfreq / 100);
@ -627,12 +586,7 @@ int32_t VideoFilePlayerImpl::TimeUntilNextVideoFrame()
reinterpret_cast< int8_t*>(_encodedData.payloadData),
encodedBufferLengthInBytes) != 0)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVideo,
_instanceID,
"FilePlayerImpl::TimeUntilNextVideoFrame() error reading\
video data");
LOG(LS_WARNING) << "Error reading video data.";
return -1;
}
_encodedData.payloadSize = encodedBufferLengthInBytes;
@ -685,23 +639,16 @@ int32_t VideoFilePlayerImpl::SetUpVideoDecoder()
{
if (_fileModule.VideoCodecInst(video_codec_info_) != 0)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVideo,
_instanceID,
"FilePlayerImpl::SetVideoDecoder() failed to retrieve Codec info of\
file data.");
LOG(LS_WARNING) << "SetVideoDecoder() failed to retrieve codec info of "
<< "file data.";
return -1;
}
int32_t useNumberOfCores = 1;
if (video_decoder_->SetDecodeCodec(video_codec_info_, useNumberOfCores) !=
0) {
WEBRTC_TRACE(kTraceWarning,
kTraceVideo,
_instanceID,
"FilePlayerImpl::SetUpVideoDecoder() codec %s not supported",
video_codec_info_.plName);
LOG(LS_WARNING) << "SetUpVideoDecoder() codec "
<< video_codec_info_.plName << " not supported.";
return -1;
}

View File

@ -12,7 +12,7 @@
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/media_file/interface/media_file.h"
#include "webrtc/modules/utility/source/file_recorder_impl.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/system_wrappers/interface/logging.h"
#ifdef WEBRTC_MODULE_UTILITY_VIDEO
#include "critical_section_wrapper.h"
@ -38,8 +38,6 @@ FileRecorder* FileRecorder::CreateFileRecorder(uint32_t instanceID,
#ifdef WEBRTC_MODULE_UTILITY_VIDEO
return new AviRecorder(instanceID, fileFormat);
#else
WEBRTC_TRACE(kTraceError, kTraceFile, -1,
"Invalid file format: %d", kFileFormatAviFile);
assert(false);
return NULL;
#endif
@ -115,13 +113,8 @@ int32_t FileRecorderImpl::StartRecordingAudioFile(
}
if( retVal != 0)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FileRecorder::StartRecording() failed to initialize file %s for\
recording.",
fileName);
LOG(LS_WARNING) << "Failed to initialize file " << fileName
<< " for recording.";
if(IsRecording())
{
@ -152,12 +145,7 @@ int32_t FileRecorderImpl::StartRecordingAudioFile(
}
if( retVal != 0)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FileRecorder::StartRecording() failed to initialize outStream for\
recording.");
LOG(LS_WARNING) << "Failed to initialize outStream for recording.";
if(IsRecording())
{
@ -184,12 +172,8 @@ int32_t FileRecorderImpl::RecordAudioToFile(
{
if (codec_info_.plfreq == 0)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FileRecorder::RecordAudioToFile() recording audio is not turned\
on");
LOG(LS_WARNING) << "RecordAudioToFile() recording audio is not "
<< "turned on.";
return -1;
}
AudioFrame tempAudioFrame;
@ -250,13 +234,9 @@ int32_t FileRecorderImpl::RecordAudioToFile(
if (_audioEncoder.Encode(*ptrAudioFrame, _audioBuffer,
encodedLenInBytes) == -1)
{
WEBRTC_TRACE(
kTraceWarning,
kTraceVoice,
_instanceID,
"FileRecorder::RecordAudioToFile() codec %s not supported or\
failed to encode stream",
codec_info_.plname);
LOG(LS_WARNING) << "RecordAudioToFile() codec "
<< codec_info_.plname
<< " not supported or failed to encode stream.";
return -1;
}
} else {
@ -309,12 +289,8 @@ int32_t FileRecorderImpl::SetUpAudioEncoder()
{
if(_audioEncoder.SetEncodeCodec(codec_info_,_amrFormat) == -1)
{
WEBRTC_TRACE(
kTraceError,
kTraceVoice,
_instanceID,
"FileRecorder::StartRecording() codec %s not supported",
codec_info_.plname);
LOG(LS_ERROR) << "SetUpAudioEncoder() codec "
<< codec_info_.plname << " not supported.";
return -1;
}
}
@ -600,8 +576,8 @@ bool AviRecorder::Process()
error = EncodeAndWriteVideoToFile( *frameToProcess);
if( error != 0)
{
WEBRTC_TRACE(kTraceError, kTraceVideo, _instanceID,
"AviRecorder::Process() error writing to file.");
LOG(LS_ERROR) << "AviRecorder::Process() error writing to "
<< "file.";
break;
} else {
uint32_t frameLengthMS = 1000 /
@ -640,8 +616,7 @@ bool AviRecorder::Process()
error = EncodeAndWriteVideoToFile( *frameToProcess);
if(error != 0)
{
WEBRTC_TRACE(kTraceError, kTraceVideo, _instanceID,
"AviRecorder::Process() error writing to file.");
LOG(LS_ERROR) << "AviRecorder::Process() error writing to file.";
} else {
_writtenVideoMS += frameLengthMS;
}
@ -692,17 +667,12 @@ int32_t AviRecorder::EncodeAndWriteVideoToFile(I420VideoFrame& videoFrame)
(int8_t*)(_videoEncodedData.payloadData),
_videoEncodedData.payloadSize))
{
WEBRTC_TRACE(kTraceError, kTraceVideo, _instanceID,
"Error writing AVI file");
LOG(LS_ERROR) << "Error writing AVI file.";
return -1;
}
} else {
WEBRTC_TRACE(
kTraceError,
kTraceVideo,
_instanceID,
"FileRecorder::RecordVideoToFile() frame dropped by encoder bitrate\
likely to low.");
LOG(LS_ERROR) << "FileRecorder::RecordVideoToFile() frame dropped by "
<< "encoder, bitrate likely too low.";
}
return 0;
}

View File

@ -13,7 +13,6 @@
#ifdef WEBRTC_MODULE_UTILITY_VIDEO
#include "webrtc/common_video/libyuv/include/scaler.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {

View File

@ -10,7 +10,7 @@
#include "webrtc/modules/interface/module.h"
#include "webrtc/modules/utility/source/process_thread_impl.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
ProcessThread::~ProcessThread()
@ -32,14 +32,12 @@ ProcessThreadImpl::ProcessThreadImpl()
_critSectModules(CriticalSectionWrapper::CreateCriticalSection()),
_thread(NULL)
{
WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1, "%s created", __FUNCTION__);
}
ProcessThreadImpl::~ProcessThreadImpl()
{
delete _critSectModules;
delete &_timeEvent;
WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1, "%s deleted", __FUNCTION__);
}
int32_t ProcessThreadImpl::Start()
@ -101,9 +99,7 @@ int32_t ProcessThreadImpl::RegisterModule(Module* module)
}
_modules.push_front(module);
WEBRTC_TRACE(kTraceInfo, kTraceUtility, -1,
"number of registered modules has increased to %d",
_modules.size());
// Wake the thread calling ProcessThreadImpl::Process() to update the
// waiting time. The waiting time for the just registered module may be
// shorter than all other registered modules.
@ -119,9 +115,6 @@ int32_t ProcessThreadImpl::DeRegisterModule(const Module* module)
if(module == *iter)
{
_modules.erase(iter);
WEBRTC_TRACE(kTraceInfo, kTraceUtility, -1,
"number of registered modules has decreased to %d",
_modules.size());
return 0;
}
}

View File

@ -14,7 +14,7 @@
#include <stdio.h>
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/system_wrappers/interface/logging.h"
#if defined(_WIN32)
#include <Windows.h>
@ -71,7 +71,6 @@ RtpDumpImpl::RtpDumpImpl()
_file(*FileWrapper::Create()),
_startTime(0)
{
WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1, "%s created", __FUNCTION__);
}
RtpDump::~RtpDump()
@ -84,7 +83,6 @@ RtpDumpImpl::~RtpDumpImpl()
_file.CloseFile();
delete &_file;
delete _critSect;
WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1, "%s deleted", __FUNCTION__);
}
int32_t RtpDumpImpl::Start(const char* fileNameUTF8)
@ -100,8 +98,7 @@ int32_t RtpDumpImpl::Start(const char* fileNameUTF8)
_file.CloseFile();
if (_file.OpenFile(fileNameUTF8, false, false, false) == -1)
{
WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
"failed to open the specified file");
LOG(LS_ERROR) << "Failed to open file.";
return -1;
}
@ -113,8 +110,7 @@ int32_t RtpDumpImpl::Start(const char* fileNameUTF8)
sprintf(magic, "#!rtpplay%s \n", RTPFILE_VERSION);
if (_file.WriteText(magic) == -1)
{
WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
"error writing to file");
LOG(LS_ERROR) << "Error writing to file.";
return -1;
}
@ -129,8 +125,7 @@ int32_t RtpDumpImpl::Start(const char* fileNameUTF8)
memset(dummyHdr, 0, 16);
if (!_file.Write(dummyHdr, sizeof(dummyHdr)))
{
WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
"error writing to file");
LOG(LS_ERROR) << "Error writing to file.";
return -1;
}
return 0;
@ -198,14 +193,12 @@ int32_t RtpDumpImpl::DumpPacket(const uint8_t* packet, uint16_t packetLength)
if (!_file.Write(&hdr, sizeof(hdr)))
{
WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
"error writing to file");
LOG(LS_ERROR) << "Error writing to file.";
return -1;
}
if (!_file.Write(packet, packetLength))
{
WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
"error writing to file");
LOG(LS_ERROR) << "Error writing to file.";
return -1;
}

View File

@ -16,8 +16,8 @@
#include "webrtc/common_video/interface/texture_video_frame.h"
#include "webrtc/modules/interface/module_common_types.h"
#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
VideoFramesQueue::VideoFramesQueue()
@ -56,16 +56,9 @@ int32_t VideoFramesQueue::AddFrame(const I420VideoFrame& newFrame) {
if (!ptrFrameToAdd) {
if (_emptyFrames.size() + _incomingFrames.size() >
KMaxNumberOfFrames) {
WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, -1,
"%s: too many frames, limit: %d", __FUNCTION__,
KMaxNumberOfFrames);
LOG(LS_WARNING) << "Too many frames, limit: " << KMaxNumberOfFrames;
return -1;
}
WEBRTC_TRACE(kTraceMemory, kTraceVideoRenderer, -1,
"%s: allocating buffer %d", __FUNCTION__,
_emptyFrames.size() + _incomingFrames.size());
ptrFrameToAdd = new I420VideoFrame();
}
ptrFrameToAdd->CopyFrame(newFrame);