This commit is contained in:
Dmytro Bogovych 2018-07-23 09:19:43 +03:00
parent f94960ebbb
commit 5b3c57b750
4 changed files with 696 additions and 696 deletions

View File

@ -33,7 +33,7 @@ WaveFormatEx;
#define LOG_SUBSYSTEM "WavFileReader" #define LOG_SUBSYSTEM "WavFileReader"
#define LOCK std::unique_lock<std::mutex> lock(mFileMtx); #define LOCK std::unique_lock<std::recursive_mutex> lock(mFileMtx);
using namespace Audio; using namespace Audio;

View File

@ -28,7 +28,7 @@ namespace Audio
short mBits; short mBits;
int mRate; int mRate;
std::tstring mFileName; std::tstring mFileName;
mutable std::mutex mFileMtx; mutable std::recursive_mutex mFileMtx;
unsigned mDataOffset; unsigned mDataOffset;
unsigned mDataLength; unsigned mDataLength;
Resampler mResampler; Resampler mResampler;
@ -57,12 +57,13 @@ namespace Audio
class WavFileWriter class WavFileWriter
{ {
protected: protected:
FILE* mHandle; /// Handle of audio file. FILE* mHandle; /// Handle of audio file.
std::tstring mFileName; /// Path to requested audio file. std::tstring mFileName; /// Path to requested audio file.
std::mutex mFileMtx; /// Mutex to protect this instance. std::recursive_mutex mFileMtx; /// Mutex to protect this instance.
int mWritten; /// Amount of written data (in bytes) int mWritten; /// Amount of written data (in bytes)
int mLengthOffset; /// Position of length field. int mLengthOffset; /// Position of length field.
int mRate, mChannels; int mRate,
mChannels;
void checkWriteResult(int result); void checkWriteResult(int result);

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
using namespace MT; using namespace MT;
SingleAudioStream::SingleAudioStream(const CodecList::Settings& codecSettings, Statistics& stat) SingleAudioStream::SingleAudioStream(const CodecList::Settings& codecSettings, Statistics& stat)
:mReceiver(codecSettings, stat), mDtmfReceiver(stat) :mReceiver(codecSettings, stat), mDtmfReceiver(stat)
{ {
} }
@ -23,20 +23,20 @@ SingleAudioStream::~SingleAudioStream()
void SingleAudioStream::process(std::shared_ptr<jrtplib::RTPPacket> packet) void SingleAudioStream::process(std::shared_ptr<jrtplib::RTPPacket> packet)
{ {
ICELogMedia(<< "Processing incoming RTP/RTCP packet"); ICELogMedia(<< "Processing incoming RTP/RTCP packet");
if (packet->GetPayloadType() == 101/*resip::Codec::TelephoneEvent.payloadType()*/) if (packet->GetPayloadType() == 101/*resip::Codec::TelephoneEvent.payloadType()*/)
mDtmfReceiver.add(packet); mDtmfReceiver.add(packet);
else else
mReceiver.add(packet); mReceiver.add(packet);
} }
void SingleAudioStream::copyPcmTo(Audio::DataWindow& output, int needed) void SingleAudioStream::copyPcmTo(Audio::DataWindow& output, int needed)
{ {
while (output.filled() < needed) while (output.filled() < needed)
if (!mReceiver.getAudio(output)) if (!mReceiver.getAudio(output))
break; break;
if (output.filled() < needed) if (output.filled() < needed)
ICELogError(<< "Not enough data for speaker's mixer"); ICELogError(<< "Not enough data for speaker's mixer");
} }