Commit c8932198 authored by Guillaume Carmel-Archambault's avatar Guillaume Carmel-Archambault
Browse files
parents 85385193 ed424321
...@@ -35,6 +35,8 @@ AC_CONFIG_FILES([libs/Makefile \ ...@@ -35,6 +35,8 @@ AC_CONFIG_FILES([libs/Makefile \
AC_CONFIG_FILES([src/Makefile \ AC_CONFIG_FILES([src/Makefile \
src/sflphone \ src/sflphone \
src/audio/Makefile \ src/audio/Makefile \
src/audio/codecs/Makefile
src/audio/codecs/ilbc/Makefile \
src/config/Makefile \ src/config/Makefile \
src/dbus/Makefile \ src/dbus/Makefile \
src/zeroconf/Makefile]) src/zeroconf/Makefile])
......
...@@ -587,7 +587,7 @@ sflphone_fill_codec_list() ...@@ -587,7 +587,7 @@ sflphone_fill_codec_list()
gchar** order = (gchar**)dbus_get_active_codec_list(); gchar** order = (gchar**)dbus_get_active_codec_list();
gchar** details; gchar** details;
gchar** pl; gchar** pl;
for(pl=order; *order; order++) for(pl=order; *order; order++)
{ {
codec_t * c = g_new0(codec_t, 1); codec_t * c = g_new0(codec_t, 1);
...@@ -601,7 +601,7 @@ sflphone_fill_codec_list() ...@@ -601,7 +601,7 @@ sflphone_fill_codec_list()
c->_bandwidth = atof(details[3]); c->_bandwidth = atof(details[3]);
codec_list_add(c); codec_list_add(c);
} }
for(pl=codecs; *codecs; codecs++) for(pl=codecs; *codecs; codecs++)
{ {
details = (gchar **)dbus_codec_details(atoi(*codecs)); details = (gchar **)dbus_codec_details(atoi(*codecs));
......
/*
* Copyright (C) 2005 Savoir-Faire Linux inc.
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CODEC_SPEEX_H_
#define __CODEC_SPEEX_H_
#include "audiocodec.h"
#include <speex/speex.h>
class CodecSpeex : public AudioCodec
{
public:
CodecSpeex(int payload);
~CodecSpeex();
int codecDecode(short *, unsigned char *, unsigned int);
int codecEncode(unsigned char *, short *, unsigned int);
// only for speex
int getFrameSize() { return _speex_frame_size; }
private:
unsigned int _clockRate;
unsigned int _channel;
void initSpeex();
void terminateSpeex();
const SpeexMode* _speexModePtr;
SpeexBits _speex_dec_bits;
SpeexBits _speex_enc_bits;
void *_speex_dec_state;
void *_speex_enc_state;
int _speex_frame_size;
};
#endif // __CODEC_SPEEX_H_
sflcodecdir = $(libdir)/sflphone/codecs/ sflcodecdir = $(libdir)/sflphone/codecs
noinst_LTLIBRARIES = libaudio.la noinst_LTLIBRARIES = libaudio.la
noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_gsm.so libcodec_speex.so
libcodec_ulaw_so_SOURCES = ulaw.cpp SUBDIRS = codecs
libcodec_ulaw_so_CFLAGS = -fPIC -g -Wall
libcodec_ulaw_so_LDFLAGS = -shared -lc
libcodec_alaw_so_SOURCES = alaw.cpp libaudio_la_SOURCES = audiofile.cpp tonelist.cpp \
libcodec_alaw_so_CFLAGS = -fPIC -g -Wall
libcodec_alaw_so_LDFLAGS = -shared -lc
libcodec_gsm_so_SOURCES = gsmcodec.cpp
libcodec_gsm_so_CFLAGS = -fPIC -g -Wall
libcodec_gsm_so_LDFLAGS = -shared -lc -lgsm
libcodec_speex_so_SOURCES = CodecSpeex.cpp
libcodec_speex_so_CFLAGS = -fPIC -g -Wall
libcodec_speex_so_LDFLAGS = -shared -lc -lspeex
if USE_SPEEX
SPEEX_SOURCES_CPP=CodecSpeex.cpp
SPEEX_FLAG=-DHAVE_SPEEX
SPEEX_LIB=-lspeex
else
SPEEX_SOURCES_CPP=
SPEEX_FLAG=
SPEEX_LIB=
endif
#SUBDIRS = ilbc
libaudio_la_SOURCES = audiofile.cpp tonelist.cpp \
audiortp.cpp dtmf.cpp tone.cpp audiolayer.cpp audiodevice.cpp dtmfgenerator.cpp \ audiortp.cpp dtmf.cpp tone.cpp audiolayer.cpp audiodevice.cpp dtmfgenerator.cpp \
tonegenerator.cpp codecDescriptor.cpp \ tonegenerator.cpp codecDescriptor.cpp \
audioloop.cpp ringbuffer.cpp $(SPEEX_SOURCES_CPP) audioloop.cpp ringbuffer.cpp $(SPEEX_SOURCES_CPP)
...@@ -40,31 +13,8 @@ AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $ ...@@ -40,31 +13,8 @@ AM_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libs $(libccext2_CFLAGS) $
-DCODECS_DIR=\""$(sflcodecdir)"\" -DCODECS_DIR=\""$(sflcodecdir)"\"
libaudio_la_CPPFLAGS = $(SPEEX_FLAG) libaudio_la_CPPFLAGS = $(SPEEX_FLAG)
noinst_HEADERS = audioloop.h common.h ringbuffer.h audiofile.h \ noinst_HEADERS = audioloop.h common.h ringbuffer.h audiofile.h \
tonelist.h audiortp.h audiocodec.h audiolayer.h audiodevice.h \ tonelist.h audiortp.h audiolayer.h audiodevice.h \
dtmfgenerator.h tonegenerator.h \ dtmfgenerator.h tonegenerator.h \
codecDescriptor.h dtmf.h tone.h \ codecDescriptor.h dtmf.h tone.h
CodecSpeex.h
install-exec-local: install-libcodec_ulaw_so install-libcodec_alaw_so install-libcodec_gsm_so install-libcodec_speex_so
uninstall-local: uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_so
install-libcodec_ulaw_so: libcodec_ulaw.so
mkdir -p $(sflcodecdir)
$(INSTALL_PROGRAM) libcodec_ulaw.so $(sflcodecdir)
install-libcodec_alaw_so: libcodec_alaw.so
$(INSTALL_PROGRAM) libcodec_alaw.so $(sflcodecdir)
install-libcodec_gsm_so: libcodec_gsm.so
$(INSTALL_PROGRAM) libcodec_gsm.so $(sflcodecdir)
install-libcodec_speex_so: libcodec_speex.so
$(INSTALL_PROGRAM) libcodec_speex.so $(sflcodecdir)
uninstall-libcodec_ulaw_so:
rm -f $(sflcodecdir)/libcodec_ulaw.so
uninstall-libcodec_alaw_so:
rm -f $(sflcodecdir)/libcodec_alaw.so
uninstall-libcodec_gsm_so:
rm -f $(sflcodecdir)/libcodec_gsm.so
uninstall-libcodec_speex_so:
rm -f $(sflcodecdir)/libcodec_speex.so
rm -rf $(sflcodecdir)
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define __AUDIOFILE_H__ #define __AUDIOFILE_H__
#include "audioloop.h" #include "audioloop.h"
#include "audiocodec.h" #include "codecs/audiocodec.h"
/** /**
@author Yan Morin <yan.morin@savoirfairelinux.com> @author Yan Morin <yan.morin@savoirfairelinux.com>
......
...@@ -97,13 +97,12 @@ AudioRtp::closeRtpSession () { ...@@ -97,13 +97,12 @@ AudioRtp::closeRtpSession () {
// AudioRtpRTX Class // // AudioRtpRTX Class //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym) AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym)
: _fstream("/tmp/audio.dat", std::ofstream::binary|std::ios::out|std::ios::app) : _fstream("/tmp/audio.gsm", std::ofstream::binary|std::ios::out|std::ios::app)
{ {
setCancel(cancelDeferred); setCancel(cancelDeferred);
time = new ost::Time(); time = new ost::Time();
_ca = sipcall; _ca = sipcall;
_sym = sym; _sym = sym;
//std::string s = "snd.dat";
// AudioRtpRTX should be close if we change sample rate // AudioRtpRTX should be close if we change sample rate
//_codecSampleRate = _ca->getAudioCodec()->getClockRate(); //_codecSampleRate = _ca->getAudioCodec()->getClockRate();
...@@ -141,7 +140,6 @@ AudioRtpRTX::~AudioRtpRTX () { ...@@ -141,7 +140,6 @@ AudioRtpRTX::~AudioRtpRTX () {
} }
//_debug("terminate audiortprtx ended...\n"); //_debug("terminate audiortprtx ended...\n");
_ca = 0; _ca = 0;
//fd = fopen("snd_data", "wa");
if (!_sym) { if (!_sym) {
delete _sessionRecv; _sessionRecv = NULL; delete _sessionRecv; _sessionRecv = NULL;
delete _sessionSend; _sessionSend = NULL; delete _sessionSend; _sessionSend = NULL;
...@@ -184,8 +182,7 @@ AudioRtpRTX::initAudioRtpSession (void) ...@@ -184,8 +182,7 @@ AudioRtpRTX::initAudioRtpSession (void)
try { try {
if (_ca == 0) { return; } if (_ca == 0) { return; }
AudioCodec* audiocodec = loadCodec(_ca->getAudioCodec()); _codecSampleRate = _audiocodec->getClockRate();
_codecSampleRate = audiocodec->getClockRate();
_debug("Init audio RTP session\n"); _debug("Init audio RTP session\n");
ost::InetHostAddress remote_ip(_ca->getRemoteIp().c_str()); ost::InetHostAddress remote_ip(_ca->getRemoteIp().c_str());
...@@ -217,12 +214,12 @@ AudioRtpRTX::initAudioRtpSession (void) ...@@ -217,12 +214,12 @@ AudioRtpRTX::initAudioRtpSession (void)
} }
bool payloadIsSet = false; bool payloadIsSet = false;
if (audiocodec) { if (_audiocodec) {
if (audiocodec->hasDynamicPayload()) { if (_audiocodec->hasDynamicPayload()) {
payloadIsSet = _sessionRecv->setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) audiocodec->getPayload(), audiocodec->getClockRate())); payloadIsSet = _sessionRecv->setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) _audiocodec->getPayload(), _audiocodec->getClockRate()));
} else { } else {
payloadIsSet= _sessionRecv->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) audiocodec->getPayload())); payloadIsSet= _sessionRecv->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) _audiocodec->getPayload()));
payloadIsSet = _sessionSend->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) audiocodec->getPayload())); payloadIsSet = _sessionSend->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) _audiocodec->getPayload()));
} }
} }
_sessionSend->setMark(true); _sessionSend->setMark(true);
...@@ -235,22 +232,21 @@ AudioRtpRTX::initAudioRtpSession (void) ...@@ -235,22 +232,21 @@ AudioRtpRTX::initAudioRtpSession (void)
} }
bool payloadIsSet = false; bool payloadIsSet = false;
if (audiocodec) { if (_audiocodec) {
if (audiocodec->hasDynamicPayload()) { if (_audiocodec->hasDynamicPayload()) {
payloadIsSet = _session->setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) audiocodec->getPayload(), audiocodec->getClockRate())); payloadIsSet = _session->setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) _audiocodec->getPayload(), _audiocodec->getClockRate()));
} else { } else {
payloadIsSet = _session->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) audiocodec->getPayload())); payloadIsSet = _session->setPayloadFormat(ost::StaticPayloadFormat((ost::StaticPayloadType) _audiocodec->getPayload()));
} }
} }
} }
unloadCodec(audiocodec);
} catch(...) { } catch(...) {
_debugException("! ARTP Failure: initialisation failed"); _debugException("! ARTP Failure: initialisation failed");
throw; throw;
} }
} }
AudioCodec* void
AudioRtpRTX::loadCodec(int payload) AudioRtpRTX::loadCodec(int payload)
{ {
using std::cerr; using std::cerr;
...@@ -282,11 +278,12 @@ AudioRtpRTX::loadCodec(int payload) ...@@ -282,11 +278,12 @@ AudioRtpRTX::loadCodec(int payload)
if(dlsym_error){ if(dlsym_error){
cerr << "Cannot load symbol create: " << dlsym_error << '\n'; cerr << "Cannot load symbol create: " << dlsym_error << '\n';
} }
return create_codec();
_audiocodec = create_codec();
} }
void void
AudioRtpRTX::unloadCodec(AudioCodec* audiocodec) AudioRtpRTX::unloadCodec()
{ {
using std::cerr; using std::cerr;
destroy_t* destroy_codec = (destroy_t*)dlsym(handle_codec, "destroy"); destroy_t* destroy_codec = (destroy_t*)dlsym(handle_codec, "destroy");
...@@ -294,7 +291,7 @@ AudioRtpRTX::unloadCodec(AudioCodec* audiocodec) ...@@ -294,7 +291,7 @@ AudioRtpRTX::unloadCodec(AudioCodec* audiocodec)
if(dlsym_error){ if(dlsym_error){
cerr << "Cannot load symbol destroy" << dlsym_error << '\n'; cerr << "Cannot load symbol destroy" << dlsym_error << '\n';
} }
destroy_codec(audiocodec); destroy_codec(_audiocodec);
dlclose(handle_codec); dlclose(handle_codec);
} }
...@@ -302,7 +299,6 @@ AudioRtpRTX::unloadCodec(AudioCodec* audiocodec) ...@@ -302,7 +299,6 @@ AudioRtpRTX::unloadCodec(AudioCodec* audiocodec)
void void
AudioRtpRTX::sendSessionFromMic(int timestamp) AudioRtpRTX::sendSessionFromMic(int timestamp)
{ {
AudioCodec* audiocodec = loadCodec(_ca->getAudioCodec());
// STEP: // STEP:
// 1. get data from mic // 1. get data from mic
// 2. convert it to int16 - good sample, good rate // 2. convert it to int16 - good sample, good rate
...@@ -316,25 +312,21 @@ try { ...@@ -316,25 +312,21 @@ try {
AudioLayer* audiolayer = Manager::instance().getAudioDriver(); AudioLayer* audiolayer = Manager::instance().getAudioDriver();
if (!audiolayer) { _debug(" !ARTP: No audiolayer available for mic\n"); return; } if (!audiolayer) { _debug(" !ARTP: No audiolayer available for mic\n"); return; }
//AudioCodec* audiocodec = _ca->getAudioCodec(); if (!_audiocodec) { _debug(" !ARTP: No audiocodec available for mic\n"); return; }
if (!audiocodec) { _debug(" !ARTP: No audiocodec available for mic\n"); return; }
// we have to get 20ms of data from the mic *20/1000 = /50 // we have to get 20ms of data from the mic *20/1000 = /50
int maxBytesToGet = _layerSampleRate * _layerFrameSize * sizeof(SFLDataFormat) / 1000; int maxBytesToGet = _layerSampleRate * _layerFrameSize * sizeof(SFLDataFormat) / 1000;
// available bytes inside ringbuffer // available bytes inside ringbuffer
int availBytesFromMic = audiolayer->canGetMic(); int availBytesFromMic = audiolayer->canGetMic();
// take the lowest // take the lowest
int bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet; int bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
//printf("clock rate = %i\n", audiocodec->getClockRate());
// Get bytes from micRingBuffer to data_from_mic // Get bytes from micRingBuffer to data_from_mic
int nbSample = audiolayer->getMic(_dataAudioLayer, bytesAvail) / sizeof(SFLDataFormat); int nbSample = audiolayer->getMic(_dataAudioLayer, bytesAvail) / sizeof(SFLDataFormat);
int nb_sample_up = nbSample; int nb_sample_up = nbSample;
int nbSamplesMax = _layerFrameSize * audiocodec->getClockRate() / 1000; int nbSamplesMax = _layerFrameSize * _audiocodec->getClockRate() / 1000;
//_fstream.write((char*) _dataAudioLayer, nbSample);
nbSample = reSampleData(audiocodec->getClockRate(), nb_sample_up, DOWN_SAMPLING); nbSample = reSampleData(_audiocodec->getClockRate(), nb_sample_up, DOWN_SAMPLING);
toSIP = _intBufferDown; toSIP = _intBufferDown;
...@@ -348,7 +340,7 @@ try { ...@@ -348,7 +340,7 @@ try {
//_debug("AR: Nb sample: %d int, [0]=%d [1]=%d [2]=%d\n", nbSample, toSIP[0], toSIP[1], toSIP[2]); //_debug("AR: Nb sample: %d int, [0]=%d [1]=%d [2]=%d\n", nbSample, toSIP[0], toSIP[1], toSIP[2]);
// for the mono: range = 0 to RTP_FRAME2SEND * sizeof(int16) // for the mono: range = 0 to RTP_FRAME2SEND * sizeof(int16)
// codecEncode(char *dest, int16* src, size in bytes of the src) // codecEncode(char *dest, int16* src, size in bytes of the src)
int compSize = audiocodec->codecEncode(_sendDataEncoded, toSIP, nbSample*sizeof(int16)); int compSize = _audiocodec->codecEncode(_sendDataEncoded, toSIP, nbSample*sizeof(int16));
//printf("jusqu'ici tout vas bien\n"); //printf("jusqu'ici tout vas bien\n");
// encode divise by two // encode divise by two
...@@ -364,7 +356,6 @@ try { ...@@ -364,7 +356,6 @@ try {
_debugException("! ARTP: sending failed"); _debugException("! ARTP: sending failed");
throw; throw;
} }
unloadCodec(audiocodec);
} }
...@@ -373,7 +364,6 @@ void ...@@ -373,7 +364,6 @@ void
AudioRtpRTX::receiveSessionForSpkr (int& countTime) AudioRtpRTX::receiveSessionForSpkr (int& countTime)
{ {
AudioCodec* audiocodec;
if (_ca == 0) { return; } if (_ca == 0) { return; }
try { try {
...@@ -396,12 +386,11 @@ try { ...@@ -396,12 +386,11 @@ try {
int payload = adu->getType(); // codec type int payload = adu->getType(); // codec type
unsigned char* data = (unsigned char*)adu->getData(); // data in char unsigned char* data = (unsigned char*)adu->getData(); // data in char
unsigned int size = adu->getSize(); // size in char unsigned int size = adu->getSize(); // size in char
//_fstream.write((char*) data, size); //_fstream.write((char*) data, size);
audiocodec = loadCodec(payload);
// Decode data with relevant codec // Decode data with relevant codec
_codecSampleRate = audiocodec->getClockRate(); int max = (int)(_codecSampleRate * _layerFrameSize / 1000);
int max = (int)(_codecSampleRate * _layerFrameSize);
if ( size > max ) { if ( size > max ) {
_debug("We have received from RTP a packet larger than expected: %s VS %s\n", size, max); _debug("We have received from RTP a packet larger than expected: %s VS %s\n", size, max);
...@@ -411,8 +400,11 @@ try { ...@@ -411,8 +400,11 @@ try {
//printf("size = %i\n", size); //printf("size = %i\n", size);
if (audiocodec != NULL) { if (_audiocodec != NULL) {
int expandedSize = audiocodec->codecDecode(_receiveDataDecoded, data, size);
int expandedSize = _audiocodec->codecDecode(_receiveDataDecoded, data, size);
// printf("%i\n", expandedSize);
//_fstream.write((char*) _receiveDataDecoded, );
//buffer _receiveDataDecoded ----> short int or int16, coded on 2 bytes //buffer _receiveDataDecoded ----> short int or int16, coded on 2 bytes
int nbInt16 = expandedSize / sizeof(int16); int nbInt16 = expandedSize / sizeof(int16);
//nbInt16 represents the number of samples we just decoded //nbInt16 represents the number of samples we just decoded
...@@ -455,7 +447,6 @@ try { ...@@ -455,7 +447,6 @@ try {
throw; throw;
} }
unloadCodec(audiocodec);
} }
...@@ -527,6 +518,7 @@ AudioRtpRTX::run () { ...@@ -527,6 +518,7 @@ AudioRtpRTX::run () {
//mic, we receive from soundcard in stereo, and we send encoded //mic, we receive from soundcard in stereo, and we send encoded
//encoding before sending //encoding before sending
AudioLayer *audiolayer = Manager::instance().getAudioDriver(); AudioLayer *audiolayer = Manager::instance().getAudioDriver();
loadCodec(_ca->getAudioCodec());
_layerFrameSize = audiolayer->getFrameSize(); // en ms _layerFrameSize = audiolayer->getFrameSize(); // en ms
_layerSampleRate = audiolayer->getSampleRate(); _layerSampleRate = audiolayer->getSampleRate();
...@@ -569,7 +561,8 @@ try { ...@@ -569,7 +561,8 @@ try {
Thread::sleep(TimerPort::getTimer()); Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms
} }
//_fstream.close(); _fstream.close();
unloadCodec();
//_debug("stop stream for audiortp loop\n"); //_debug("stop stream for audiortp loop\n");
audiolayer->stopStream(); audiolayer->stopStream();
} catch(std::exception &e) { } catch(std::exception &e) {
......
...@@ -123,19 +123,22 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort { ...@@ -123,19 +123,22 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
/** Pointer on function to handle codecs **/ /** Pointer on function to handle codecs **/
void* handle_codec; void* handle_codec;
AudioCodec* _audiocodec;
/** /**
* Load dynamically a codec (.so library) * Load dynamically a codec (.so library)
* @param payload The payload of the codec you want to load * @param payload The payload of the codec you want to load
* @return AudioCodec* A pointer on a audio codec object * @return AudioCodec* A pointer on a audio codec object
*/ */
AudioCodec* loadCodec(int payload); void loadCodec(int payload);
/** /**
* Destroy and close dynamically a codec (.so library) * Destroy and close dynamically a codec (.so library)
* @param audiocodec The audio codec you want to unload * @param audiocodec The audio codec you want to unload
*/ */
void unloadCodec(AudioCodec* audiocodec); void unloadCodec(void);
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -22,11 +22,7 @@ ...@@ -22,11 +22,7 @@
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
#include "audiocodec.h"
#include "codecDescriptor.h" #include "codecDescriptor.h"
/*#ifdef HAVE_SPEEX
#include "CodecSpeex.h"
#endif*/
CodecDescriptor::CodecDescriptor() CodecDescriptor::CodecDescriptor()
{ {
...@@ -112,7 +108,7 @@ CodecDescriptor::getBitRate(CodecType payload) ...@@ -112,7 +108,7 @@ CodecDescriptor::getBitRate(CodecType payload)
case PAYLOAD_CODEC_ILBC_20: case PAYLOAD_CODEC_ILBC_20:
return 15.2; return 15.2;
case PAYLOAD_CODEC_ILBC_30: case PAYLOAD_CODEC_ILBC_30:
return 15.2; return 13.3;
} }
return 0.0; return 0.0;
......
...@@ -50,7 +50,7 @@ typedef enum { ...@@ -50,7 +50,7 @@ typedef enum {
PAYLOAD_CODEC_SPEEX_32000 = 112 PAYLOAD_CODEC_SPEEX_32000 = 112
} CodecType; } CodecType;
#include "audiocodec.h" #include "codecs/audiocodec.h"
/* A codec is identified by its payload. A payload is associated with a name. */ /* A codec is identified by its payload. A payload is associated with a name. */
typedef std::map<CodecType, std::string> CodecMap; typedef std::map<CodecType, std::string> CodecMap;
......
sflcodecdir = $(libdir)/sflphone/codecs
noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so libcodec_gsm.so libcodec_speex.so libcodec_ilbc.so
noinst_HEADERS = audiocodec.h
libcodec_ulaw_so_SOURCES = ulaw.cpp
libcodec_ulaw_so_CFLAGS = -fPIC -g -Wall
libcodec_ulaw_so_LDFLAGS = -shared -lc
libcodec_alaw_so_SOURCES = alaw.cpp
libcodec_alaw_so_CFLAGS = -fPIC -g -Wall
libcodec_alaw_so_LDFLAGS = -shared -lc
libcodec_gsm_so_SOURCES = gsmcodec.cpp
libcodec_gsm_so_CFLAGS = -fPIC -g -Wall
libcodec_gsm_so_LDFLAGS = -shared -lc -lgsm
libcodec_speex_so_SOURCES = speexcodec.cpp
libcodec_speex_so_CFLAGS = -fPIC -g -Wall
libcodec_speex_so_LDFLAGS = -shared -lc -lspeex
libcodec_ilbc_so_SOURCES = ilbc.cpp
libcodec_ilbc_so_CFLAGS = -fPIC -g -Wall
libcodec_ilbc_so_LDFLAGS = -shared ilbc/*.o -lc
SUBDIRS = ilbc