- allow avoid decoding in audio receiver (but produce network statistics)
This commit is contained in:
parent
2aff120468
commit
eb4d3237c0
|
|
@ -452,8 +452,12 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
if (mCodec && mFrameCount && !mCodecSettings.mSkipDecode)
|
||||
{
|
||||
// Do PLC to mDecodedFrame/mDecodedLength
|
||||
if ((int)options & (int)DecodeOptions::SkipDecode)
|
||||
mDecodedLength = 0;
|
||||
else
|
||||
mDecodedLength = mCodec->plc(mFrameCount, mDecodedFrame, sizeof mDecodedFrame);
|
||||
}
|
||||
|
||||
if (mDecodedLength)
|
||||
{
|
||||
processDecoded(output, options);
|
||||
|
|
@ -487,7 +491,11 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
int frames100ms = milliseconds / 100;
|
||||
for (int frameIndex = 0; frameIndex < frames100ms; frameIndex++)
|
||||
{
|
||||
if ((int)options & (int)DecodeOptions::SkipDecode)
|
||||
mDecodedLength = 0;
|
||||
else
|
||||
mDecodedLength = mCngDecoder.produce(mCodec->samplerate(), 100, (short*)mDecodedFrame, false);
|
||||
|
||||
if (mDecodedLength)
|
||||
processDecoded(output, options);
|
||||
}
|
||||
|
|
@ -495,7 +503,11 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
int tail = milliseconds % 100;
|
||||
if (tail)
|
||||
{
|
||||
if ((int)options & (int)DecodeOptions::SkipDecode)
|
||||
mDecodedLength = 0;
|
||||
else
|
||||
mDecodedLength = mCngDecoder.produce(mCodec->samplerate(), tail, (short*)mDecodedFrame, false);
|
||||
|
||||
if (mDecodedLength)
|
||||
processDecoded(output, options);
|
||||
}
|
||||
|
|
@ -512,6 +524,10 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
|
||||
// Check if it is CNG packet
|
||||
if ((p->GetPayloadType() == 0 || p->GetPayloadType() == 8) && p->GetPayloadLength() >= 1 && p->GetPayloadLength() <= 6)
|
||||
{
|
||||
if ((int)options & (int)DecodeOptions::SkipDecode)
|
||||
mDecodedLength = 0;
|
||||
else
|
||||
{
|
||||
mCngPacket = p;
|
||||
mCngDecoder.decode3389(p->GetPayloadData(), p->GetPayloadLength());
|
||||
|
|
@ -519,6 +535,7 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
mDecodedLength = mCngDecoder.produce(mCodec->samplerate(), mLastPacketTimeLength, (short*)mDecodedFrame, true);
|
||||
if (mDecodedLength)
|
||||
processDecoded(output, options);
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
|
|
@ -541,6 +558,10 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
|
||||
// Decode
|
||||
for (int i=0; i<mFrameCount && !mCodecSettings.mSkipDecode; i++)
|
||||
{
|
||||
if ((int)options & (int)DecodeOptions::SkipDecode)
|
||||
mDecodedLength = 0;
|
||||
else
|
||||
{
|
||||
// Decode frame by frame
|
||||
mDecodedLength = mCodec->decode(p->GetPayloadData() + i*mCodec->rtpLength(),
|
||||
|
|
@ -548,6 +569,7 @@ bool AudioReceiver::getAudio(Audio::DataWindow& output, DecodeOptions options, i
|
|||
if (mDecodedLength)
|
||||
processDecoded(output, options);
|
||||
}
|
||||
}
|
||||
result = mFrameCount > 0;
|
||||
|
||||
// Check for bitrate counter
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ namespace MT
|
|||
{
|
||||
ResampleToMainRate = 0,
|
||||
DontResample = 1,
|
||||
FillCngGap = 2
|
||||
FillCngGap = 2,
|
||||
SkipDecode = 4
|
||||
};
|
||||
|
||||
bool getAudio(Audio::DataWindow& output, DecodeOptions options = DecodeOptions::ResampleToMainRate, int* rate = nullptr);
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ bool SevanaPVQA::initializeLibrary(const std::string& pathToLicenseFile, const s
|
|||
return false;
|
||||
}
|
||||
|
||||
if (pathToConfigFile.size())
|
||||
{
|
||||
mLibraryConfiguration = PVQA_LoadCFGFile(const_cast<char*>(pathToConfigFile.c_str()), &mLibraryErrorCode);
|
||||
if (!mLibraryConfiguration)
|
||||
{
|
||||
|
|
@ -179,6 +181,7 @@ bool SevanaPVQA::initializeLibrary(const std::string& pathToLicenseFile, const s
|
|||
ICELogError(<< "Problem with PVQA configuration file.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
mPvqaLoaded = true;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -202,6 +205,8 @@ bool SevanaPVQA::initializeLibraryWithData(const void* license_buffer, size_t li
|
|||
return false;
|
||||
}
|
||||
|
||||
if (config_buffer && config_len)
|
||||
{
|
||||
mLibraryConfiguration = PVQA_LoadCFGData(config_buffer, config_len, &mLibraryErrorCode);
|
||||
if (!mLibraryConfiguration)
|
||||
{
|
||||
|
|
@ -209,6 +214,7 @@ bool SevanaPVQA::initializeLibraryWithData(const void* license_buffer, size_t li
|
|||
ICELogError(<< "Problem with PVQA configuration file.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
mPvqaLoaded = true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ public:
|
|||
#if defined(TARGET_ANDROID)
|
||||
static void setupAndroidEnvironment(void* environment, void* appcontext);
|
||||
#endif
|
||||
// Path to config file can be empty
|
||||
// In this case library will be considered initialized (but will produce zero MOS)
|
||||
static bool initializeLibrary(const std::string& pathToLicenseFile, const std::string& pathToConfigFile);
|
||||
static bool initializeLibraryWithData(const void* license_buffer, size_t license_len,
|
||||
const void* config_buffer, size_t config_len);
|
||||
|
|
|
|||
Loading…
Reference in New Issue