- more fixes from pvqa_server project
This commit is contained in:
parent
1bfd84ec34
commit
7efef755fa
|
|
@ -102,7 +102,8 @@ endif()
|
||||||
if (USE_PVQA_LIBRARY)
|
if (USE_PVQA_LIBRARY)
|
||||||
message("Use PVQA libraries")
|
message("Use PVQA libraries")
|
||||||
add_definitions( -DUSE_PVQA_LIBRARY )
|
add_definitions( -DUSE_PVQA_LIBRARY )
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/pvqa/include)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/pvqa/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libs/pvqa++/include)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set (RTPHONE_SOURCES
|
set (RTPHONE_SOURCES
|
||||||
|
|
@ -201,6 +202,10 @@ else ()
|
||||||
set (LIBS ${LIBS} dl uuid)
|
set (LIBS ${LIBS} dl uuid)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM MATCHES "Android")
|
||||||
|
set (LIBS ${LIBS} oboe)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (USE_AMR_CODEC)
|
if (USE_AMR_CODEC)
|
||||||
set (LIBS ${LIBS})
|
set (LIBS ${LIBS})
|
||||||
endif (USE_AMR_CODEC)
|
endif (USE_AMR_CODEC)
|
||||||
|
|
@ -215,7 +220,7 @@ target_link_libraries(rtphone
|
||||||
uuid
|
uuid
|
||||||
${OPENSSL_SSL}
|
${OPENSSL_SSL}
|
||||||
${OPENSSL_CRYPTO}
|
${OPENSSL_CRYPTO}
|
||||||
${LIBS} oboe)
|
${LIBS} )
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(rtphone
|
target_include_directories(rtphone
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#define AUDIO_CHANNELS 1
|
#define AUDIO_CHANNELS 1
|
||||||
|
|
||||||
// Samplerate must be 8 / 16 / 24 / 32 / 48 KHz
|
// Samplerate must be 8 / 16 / 24 / 32 / 48 KHz
|
||||||
#define AUDIO_SAMPLERATE 48000
|
#define AUDIO_SAMPLERATE 8000
|
||||||
#define AUDIO_MIC_BUFFER_COUNT 16
|
#define AUDIO_MIC_BUFFER_COUNT 16
|
||||||
#define AUDIO_MIC_BUFFER_LENGTH 10
|
#define AUDIO_MIC_BUFFER_LENGTH 10
|
||||||
#define AUDIO_MIC_BUFFER_SIZE (AUDIO_MIC_BUFFER_LENGTH * AUDIO_SAMPLERATE / 1000 * 2 * AUDIO_CHANNELS)
|
#define AUDIO_MIC_BUFFER_SIZE (AUDIO_MIC_BUFFER_LENGTH * AUDIO_SAMPLERATE / 1000 * 2 * AUDIO_CHANNELS)
|
||||||
|
|
@ -66,15 +66,15 @@
|
||||||
|
|
||||||
// AMR codec defines - it requires USE_AMR_CODEC defined
|
// AMR codec defines - it requires USE_AMR_CODEC defined
|
||||||
// #define USE_AMR_CODEC
|
// #define USE_AMR_CODEC
|
||||||
#define MT_AMRNB_PAYLOADTYPE 122
|
#define MT_AMRNB_PAYLOADTYPE 112
|
||||||
#define MT_AMRNB_CODECNAME "amr"
|
#define MT_AMRNB_CODECNAME "amr"
|
||||||
|
|
||||||
#define MT_AMRNB_OCTET_PAYLOADTYPE 123
|
#define MT_AMRNB_OCTET_PAYLOADTYPE 113
|
||||||
|
|
||||||
#define MT_AMRWB_PAYLOADTYPE 124
|
#define MT_AMRWB_PAYLOADTYPE 96
|
||||||
#define MT_AMRWB_CODECNAME "amr-wb"
|
#define MT_AMRWB_CODECNAME "amr-wb"
|
||||||
|
|
||||||
#define MT_AMRWB_OCTET_PAYLOADTYPE 125
|
#define MT_AMRWB_OCTET_PAYLOADTYPE 97
|
||||||
|
|
||||||
#define MT_GSMEFR_PAYLOADTYPE 126
|
#define MT_GSMEFR_PAYLOADTYPE 126
|
||||||
#define MT_GSMEFR_CODECNAME "GERAN-EFR"
|
#define MT_GSMEFR_CODECNAME "GERAN-EFR"
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,42 @@ using namespace MT;
|
||||||
using strx = StringHelper;
|
using strx = StringHelper;
|
||||||
|
|
||||||
// ---------------- EvsSpec ---------------
|
// ---------------- EvsSpec ---------------
|
||||||
|
|
||||||
|
std::string CodecList::Settings::toString() const
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << "wrap IuUP: " << mWrapIuUP << std::endl
|
||||||
|
<< "skip decode: " << mSkipDecode << std::endl;
|
||||||
|
for (int ptype: mAmrWbPayloadType)
|
||||||
|
oss << "AMR WB ptype: " << ptype << std::endl;
|
||||||
|
for (int ptype: mAmrWbOctetPayloadType)
|
||||||
|
oss << "AMR WB octet-aligned ptype: " << ptype << std::endl;
|
||||||
|
for (int ptype: mAmrNbPayloadType)
|
||||||
|
oss << "AMR NB ptype: " << ptype << std::endl;
|
||||||
|
for (int ptype: mAmrNbOctetPayloadType)
|
||||||
|
oss << "AMR NB octet-aligned ptype:" << ptype << std::endl;
|
||||||
|
|
||||||
|
oss << "ISAC 16Khz ptype: " << mIsac16KPayloadType << std::endl
|
||||||
|
<< "ISAC 32Khz ptype: " << mIsac32KPayloadType << std::endl
|
||||||
|
<< "iLBC 20ms ptype: " << mIlbc20PayloadType << std::endl
|
||||||
|
<< "iLBC 30ms ptype: " << mIlbc30PayloadType << std::endl
|
||||||
|
<< "GSM FR ptype: " << mGsmFrPayloadType << ", GSM FR plength: " << mGsmFrPayloadLength << std::endl
|
||||||
|
<< "GSM HR ptype: " << mGsmHrPayloadType << std::endl
|
||||||
|
<< "GSM EFR ptype: " << mGsmEfrPayloadType << std::endl;
|
||||||
|
|
||||||
|
for (auto& spec: mEvsSpec)
|
||||||
|
{
|
||||||
|
oss << "EVS ptype: " << spec.mPayloadType << ", bw: " << spec.mBandwidth << ", enc: " << (spec.mEncodingType == EvsSpec::Encoding_MIME ? "mime" : "g192") << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& spec: mOpusSpec)
|
||||||
|
{
|
||||||
|
oss << "OPUS ptype: " << spec.mPayloadType << ", rate: " << spec.mRate << ", channels: " << spec.mChannels << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
bool CodecList::Settings::EvsSpec::isValid() const
|
bool CodecList::Settings::EvsSpec::isValid() const
|
||||||
{
|
{
|
||||||
return mPayloadType >= 96 && mPayloadType <= 127;
|
return mPayloadType >= 96 && mPayloadType <= 127;
|
||||||
|
|
@ -125,14 +161,14 @@ CodecList::CodecList(const Settings& settings)
|
||||||
mFactoryList.push_back(new GsmEfrCodec::GsmEfrFactory(mSettings.mWrapIuUP, mSettings.mGsmEfrPayloadType));
|
mFactoryList.push_back(new GsmEfrCodec::GsmEfrFactory(mSettings.mWrapIuUP, mSettings.mGsmEfrPayloadType));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/*mFactoryList.push_back(new IsacCodec::IsacFactory16K(mSettings.mIsac16KPayloadType));
|
mFactoryList.push_back(new IsacCodec::IsacFactory16K(mSettings.mIsac16KPayloadType));
|
||||||
mFactoryList.push_back(new IlbcCodec::IlbcFactory(mSettings.mIlbc20PayloadType, mSettings.mIlbc30PayloadType));
|
mFactoryList.push_back(new IlbcCodec::IlbcFactory(mSettings.mIlbc20PayloadType, mSettings.mIlbc30PayloadType));
|
||||||
mFactoryList.push_back(new G711Codec::AlawFactory());
|
mFactoryList.push_back(new G711Codec::AlawFactory());
|
||||||
mFactoryList.push_back(new G711Codec::UlawFactory());
|
mFactoryList.push_back(new G711Codec::UlawFactory());
|
||||||
|
|
||||||
mFactoryList.push_back(new GsmCodec::GsmFactory(mSettings.mGsmFrPayloadLength == 32 ? GsmCodec::Type::Bytes_32 : GsmCodec::Type::Bytes_33, mSettings.mGsmFrPayloadType));
|
mFactoryList.push_back(new GsmCodec::GsmFactory(mSettings.mGsmFrPayloadLength == 32 ? GsmCodec::Type::Bytes_32 : GsmCodec::Type::Bytes_33, mSettings.mGsmFrPayloadType));
|
||||||
mFactoryList.push_back(new G722Codec::G722Factory());
|
mFactoryList.push_back(new G722Codec::G722Factory());
|
||||||
mFactoryList.push_back(new G729Codec::G729Factory());*/
|
mFactoryList.push_back(new G729Codec::G729Factory());
|
||||||
#ifndef TARGET_ANDROID
|
#ifndef TARGET_ANDROID
|
||||||
mFactoryList.push_back(new GsmHrCodec::GsmHrFactory(mSettings.mGsmHrPayloadType));
|
mFactoryList.push_back(new GsmHrCodec::GsmHrFactory(mSettings.mGsmHrPayloadType));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,9 @@ public:
|
||||||
};
|
};
|
||||||
std::vector<OpusSpec> mOpusSpec;
|
std::vector<OpusSpec> mOpusSpec;
|
||||||
|
|
||||||
|
// Textual representation - used in logging
|
||||||
|
std::string toString() const;
|
||||||
|
|
||||||
static Settings DefaultSettings;
|
static Settings DefaultSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,9 @@ public:
|
||||||
static void setupAndroidEnvironment(void* environment, void* appcontext);
|
static void setupAndroidEnvironment(void* environment, void* appcontext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Verbose run - dump debugging info to console
|
||||||
|
static void set_verbose(bool verbose = true);
|
||||||
|
|
||||||
// Path to config file can be empty
|
// Path to config file can be empty
|
||||||
// In this case library will be considered initialized (but will produce zero MOS)
|
// In this case library will be considered initialized (but will produce zero MOS)
|
||||||
static bool initialize(const std::string& pathToLicenseFile, const std::string& pathToConfigFile);
|
static bool initialize(const std::string& pathToLicenseFile, const std::string& pathToConfigFile);
|
||||||
|
|
@ -118,6 +121,8 @@ public:
|
||||||
const void* config_buffer, size_t config_len);
|
const void* config_buffer, size_t config_len);
|
||||||
static bool is_initialized();
|
static bool is_initialized();
|
||||||
|
|
||||||
|
static std::string get_copyright_string();
|
||||||
|
|
||||||
static int library_error();
|
static int library_error();
|
||||||
static void release();
|
static void release();
|
||||||
static int instance_counter() { return mInstanceCounter; }
|
static int instance_counter() { return mInstanceCounter; }
|
||||||
|
|
@ -145,6 +150,7 @@ public:
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
|
|
||||||
// Update/Get model. pcm_length is bytes.
|
// Update/Get model. pcm_length is bytes.
|
||||||
|
// Please - pcm_length must be a multiple of interval time!
|
||||||
bool update(const void* pcm_buffer, size_t pcm_length);
|
bool update(const void* pcm_buffer, size_t pcm_length);
|
||||||
int error() const;
|
int error() const;
|
||||||
|
|
||||||
|
|
@ -153,7 +159,7 @@ public:
|
||||||
{
|
{
|
||||||
float mMos = 0.0f;
|
float mMos = 0.0f;
|
||||||
std::string mReport;
|
std::string mReport;
|
||||||
size_t mIntervals = 0, mPoorIntervals = 0;
|
size_t mIntervals = 0, mPoorIntervals = 0, mUncertainIntervals = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool get_result(result& r, size_t last_milliseconds = 0);
|
bool get_result(result& r, size_t last_milliseconds = 0);
|
||||||
|
|
@ -171,6 +177,7 @@ public:
|
||||||
|
|
||||||
// Combines update & get_result calls
|
// Combines update & get_result calls
|
||||||
bool singleshot(result& r, const void* pcm_buffer, size_t pcm_length);
|
bool singleshot(result& r, const void* pcm_buffer, size_t pcm_length);
|
||||||
|
bool singleshot_file(result& r, const std::string& path);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace
|
} // end of namespace
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ typedef struct
|
||||||
|
|
||||||
long dNumPoorIntervals;
|
long dNumPoorIntervals;
|
||||||
long dNumTotalIntervals;
|
long dNumTotalIntervals;
|
||||||
|
long dNumUncertainIntervals;
|
||||||
|
|
||||||
double dTimeShift;
|
double dTimeShift;
|
||||||
} TPVQA_Results;
|
} TPVQA_Results;
|
||||||
|
|
@ -38,7 +39,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
long dSampleRate; // Sample rate of signal
|
long dSampleRate; // Sample rate of signal
|
||||||
long dNChannels; // Number of sound channels in audio
|
long dNChannels; // Number of sound channels in audio
|
||||||
short * pSamples; // Pointer to the samples of signal
|
const short * pSamples; // Pointer to the samples of signal
|
||||||
long dNSamples; // Number of samples
|
long dNSamples; // Number of samples
|
||||||
} TPVQA_AudioItem;
|
} TPVQA_AudioItem;
|
||||||
|
|
||||||
|
|
@ -82,7 +83,7 @@ PVQA_API int PVQA_AudioQualityAnalyzerCreateDelayLine(void * aPVQA_ID, long aSam
|
||||||
PVQA_API int PVQA_StartRecordingWave(void * aPVQA_ID, const char * aPWavFName, long aSampleRate, long aNChannels);
|
PVQA_API int PVQA_StartRecordingWave(void * aPVQA_ID, const char * aPWavFName, long aSampleRate, long aNChannels);
|
||||||
|
|
||||||
// Performs audio file quality estimation
|
// Performs audio file quality estimation
|
||||||
PVQA_API int PVQA_OnTestAudioFile(void * aPVQA_ID, const char * aPFileName);
|
PVQA_API int PVQA_OnTestAudioFile(void * aPVQA_ID, const char * aPFileName, double offset_begin, double offset_end);
|
||||||
|
|
||||||
// Process loaded in memory audio data
|
// Process loaded in memory audio data
|
||||||
PVQA_API int PVQA_OnTestAudioData(void * aPVQA_ID, TPVQA_AudioItem * aPVQA_PAudio);
|
PVQA_API int PVQA_OnTestAudioData(void * aPVQA_ID, TPVQA_AudioItem * aPVQA_PAudio);
|
||||||
|
|
@ -95,7 +96,6 @@ PVQA_API int PVQA_OnStartStreamData(void * aPVQA_ID);
|
||||||
|
|
||||||
// Process streaming Audio data
|
// Process streaming Audio data
|
||||||
PVQA_API int PVQA_OnAddStreamAudioData(void * aPVQA_ID, TPVQA_AudioItem * aPVQA_PAudio);
|
PVQA_API int PVQA_OnAddStreamAudioData(void * aPVQA_ID, TPVQA_AudioItem * aPVQA_PAudio);
|
||||||
PVQA_API int PVQA_OnAddStreamAudioDataHex(void * aPVQA_ID, int rate, int channels, const char* samples);
|
|
||||||
|
|
||||||
// Updates quality results data
|
// Updates quality results data
|
||||||
PVQA_API int PVQA_OnUpdateStreamQualityResults(void * aPVQA_ID, int rate, int millisecondsFromEnd);
|
PVQA_API int PVQA_OnUpdateStreamQualityResults(void * aPVQA_ID, int rate, int millisecondsFromEnd);
|
||||||
|
|
@ -104,7 +104,6 @@ PVQA_API int PVQA_OnUpdateStreamQualityResults(void * aPVQA_ID, int rate, int mi
|
||||||
PVQA_API int PVQA_OnFinalizeStream(void * aPVQA_ID, long aSampleRate);
|
PVQA_API int PVQA_OnFinalizeStream(void * aPVQA_ID, long aSampleRate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// Displaying audio quality testing results
|
// Displaying audio quality testing results
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
|
|
@ -129,7 +128,10 @@ PVQA_API const char ** PVQA_GetProcessorValuesNamesList(void * aPVQA_ID, const c
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
// number of columns and rows
|
||||||
int columns, rows;
|
int columns, rows;
|
||||||
|
|
||||||
|
// data itself
|
||||||
float* data;
|
float* data;
|
||||||
} PVQA_Array2D;
|
} PVQA_Array2D;
|
||||||
|
|
||||||
|
|
@ -137,6 +139,7 @@ typedef struct
|
||||||
// Returned value has to be released via PVQA_ReleaseArray2D
|
// Returned value has to be released via PVQA_ReleaseArray2D
|
||||||
PVQA_API PVQA_Array2D* PVQA_GetProcessorValuesList(void * aPVQA_ID, const char * aPDetectorName, long aStartTime,
|
PVQA_API PVQA_Array2D* PVQA_GetProcessorValuesList(void * aPVQA_ID, const char * aPDetectorName, long aStartTime,
|
||||||
long aStopTime, const char * aStatType, int * errCode);
|
long aStopTime, const char * aStatType, int * errCode);
|
||||||
|
|
||||||
// Release allocated 2D array
|
// Release allocated 2D array
|
||||||
PVQA_API void PVQA_ReleaseArray2D(PVQA_Array2D* array);
|
PVQA_API void PVQA_ReleaseArray2D(PVQA_Array2D* array);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue