started OPUS integration by just creating the OPUS objects and do nothing with them right now

This commit is contained in:
Volker Fischer 2013-02-16 10:54:40 +00:00
parent 0c2ec12af0
commit f0d46f4fc0
4 changed files with 73 additions and 0 deletions

View file

@ -51,6 +51,8 @@ CClient::CClient ( const quint16 iPortNumber ) :
bUseDefaultCentralServerAddress ( true ),
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL )
{
int iOpusError;
// init audio encoder/decoder (mono)
CeltModeMono = cc6_celt_mode_create (
SYSTEM_SAMPLE_RATE_HZ, 1, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
@ -64,6 +66,21 @@ CClient::CClient ( const quint16 iPortNumber ) :
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif
OpusEncoderMono = opus_encoder_create ( SYSTEM_SAMPLE_RATE_HZ,
1,
OPUS_APPLICATION_RESTRICTED_LOWDELAY,
&iOpusError );
OpusDecoderMono = opus_decoder_create ( SYSTEM_SAMPLE_RATE_HZ,
1,
&iOpusError );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity
opus_encoder_ctl ( OpusEncoderMono,
OPUS_SET_COMPLEXITY ( 1 ) );
#endif
// init audio encoder/decoder (stereo)
CeltModeStereo = cc6_celt_mode_create (
SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
@ -77,6 +94,21 @@ CClient::CClient ( const quint16 iPortNumber ) :
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif
OpusEncoderStereo = opus_encoder_create ( SYSTEM_SAMPLE_RATE_HZ,
2,
OPUS_APPLICATION_RESTRICTED_LOWDELAY,
&iOpusError );
OpusDecoderStereo = opus_decoder_create ( SYSTEM_SAMPLE_RATE_HZ,
2,
&iOpusError );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity
opus_encoder_ctl ( OpusEncoderStereo,
OPUS_SET_COMPLEXITY ( 1 ) );
#endif
// Connections -------------------------------------------------------------
// connection for protocol

View file

@ -31,6 +31,7 @@
#include <QDateTime>
#include <QMessageBox>
#include "cc6_celt.h"
#include "opus.h"
#include "global.h"
#include "socket.h"
#include "channel.h"
@ -271,6 +272,10 @@ protected:
cc6_CELTMode* CeltModeStereo;
cc6_CELTEncoder* CeltEncoderStereo;
cc6_CELTDecoder* CeltDecoderStereo;
OpusEncoder* OpusEncoderMono;
OpusDecoder* OpusDecoderMono;
OpusEncoder* OpusEncoderStereo;
OpusDecoder* OpusDecoderStereo;
int iCeltNumCodedBytes;
bool bCeltDoHighQuality;
bool bUseStereo;

View file

@ -186,6 +186,7 @@ CServer::CServer ( const int iNewNumChan,
bAutoRunMinimized ( false ),
strWelcomeMessage ( strNewWelcomeMessage )
{
int iOpusError;
int i;
// create CELT encoder/decoder for each channel (must be done before
@ -206,6 +207,21 @@ CServer::CServer ( const int iNewNumChan,
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif
OpusEncoderMono[i] = opus_encoder_create ( SYSTEM_SAMPLE_RATE_HZ,
1,
OPUS_APPLICATION_RESTRICTED_LOWDELAY,
&iOpusError );
OpusDecoderMono[i] = opus_decoder_create ( SYSTEM_SAMPLE_RATE_HZ,
1,
&iOpusError );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity
opus_encoder_ctl ( OpusEncoderMono[i],
OPUS_SET_COMPLEXITY ( 1 ) );
#endif
// init audio endocder/decoder (stereo)
CeltModeStereo[i] = cc6_celt_mode_create (
SYSTEM_SAMPLE_RATE_HZ, 2, SYSTEM_FRAME_SIZE_SAMPLES, NULL );
@ -218,6 +234,21 @@ CServer::CServer ( const int iNewNumChan,
cc6_celt_encoder_ctl ( CeltEncoderStereo[i],
cc6_CELT_SET_COMPLEXITY_REQUEST, cc6_celt_int32_t ( 1 ) );
#endif
OpusEncoderStereo[i] = opus_encoder_create ( SYSTEM_SAMPLE_RATE_HZ,
2,
OPUS_APPLICATION_RESTRICTED_LOWDELAY,
&iOpusError );
OpusDecoderStereo[i] = opus_decoder_create ( SYSTEM_SAMPLE_RATE_HZ,
2,
&iOpusError );
#ifdef USE_LOW_COMPLEXITY_CELT_ENC
// set encoder low complexity
opus_encoder_ctl ( OpusEncoderStereo[i],
OPUS_SET_COMPLEXITY ( 1 ) );
#endif
}
// define colors for chat window identifiers

View file

@ -30,6 +30,7 @@
#include <QDateTime>
#include <QHostAddress>
#include "cc6_celt.h"
#include "opus.h"
#include "global.h"
#include "socket.h"
#include "channel.h"
@ -213,6 +214,10 @@ protected:
cc6_CELTMode* CeltModeStereo[MAX_NUM_CHANNELS];
cc6_CELTEncoder* CeltEncoderStereo[MAX_NUM_CHANNELS];
cc6_CELTDecoder* CeltDecoderStereo[MAX_NUM_CHANNELS];
OpusEncoder* OpusEncoderMono[MAX_NUM_CHANNELS];
OpusDecoder* OpusDecoderMono[MAX_NUM_CHANNELS];
OpusEncoder* OpusEncoderStereo[MAX_NUM_CHANNELS];
OpusDecoder* OpusDecoderStereo[MAX_NUM_CHANNELS];
CVector<QString> vstrChatColors;