From 6127958c6b157bcd1f2b9c4ff47e9703623c7307 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Thu, 23 Apr 2009 10:45:44 -0400 Subject: [PATCH] use timer set at framesize (#1143) --- sflphone-common/src/audio/audiortp.cpp | 12 +- .../src/audio/codecs/vorbiscodec.cpp | 118 ------------------ 2 files changed, 3 insertions(+), 127 deletions(-) delete mode 100644 sflphone-common/src/audio/codecs/vorbiscodec.cpp diff --git a/sflphone-common/src/audio/audiortp.cpp b/sflphone-common/src/audio/audiortp.cpp index 0de4e82252..1fb9847d14 100644 --- a/sflphone-common/src/audio/audiortp.cpp +++ b/sflphone-common/src/audio/audiortp.cpp @@ -574,8 +574,7 @@ AudioRtpRTX::run () { int timestamp = 0; // for mic int countTime = 0; // for receive - // TimerPort::setTimer(_layerFrameSize); - TimerPort::setTimer(5); + TimerPort::setTimer(_layerFrameSize); audiolayer->startStream(); _start.post(); @@ -613,13 +612,8 @@ AudioRtpRTX::run () { _ca->recAudio.recData(micData,_nSamplesMic); } - // Thread::sleep(TimerPort::getTimer()); - // TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms - - // Thread::sleep(TimerPort::getTimer()); - // TimerPort::incTimer(5); // 'frameSize' ms - - usleep(50); + Thread::sleep(TimerPort::getTimer()); + TimerPort::incTimer(_layerFrameSize); // 'frameSize' ms } diff --git a/sflphone-common/src/audio/codecs/vorbiscodec.cpp b/sflphone-common/src/audio/codecs/vorbiscodec.cpp deleted file mode 100644 index 2395fa2d20..0000000000 --- a/sflphone-common/src/audio/codecs/vorbiscodec.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2007-2009 Savoir-Faire Linux inc. - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@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. - */ - -#include "audiocodec.h" -#include <cstdio> -#include <math.h> -#include <vorbis/vorbis.h> -#include <vorbis/codec.h> -#include <vorbis/vorbisenc.h> - -class Vorbis : public AudioCodec{ - public: - Vorbis(int payload=0) - : AudioCodec(payload, "vorbis"), - _ogg_stream_state(), - _ogg_packet(), - _vorbis_info(), - _vorbis_comment(), - _vorbis_dsp_state(), - _vorbis_block() - { - _clockRate = 8000; - _channel = 1; - _bitrate = 0; - _bandwidth = 0; - initVorbis(); - } - - Vorbis( const Vorbis& ); - Vorbis& operator=(const Vorbis&); - - void initVorbis() { - - // init the encoder - vorbis_info_init(&_vorbis_info); - vorbis_encode_init_vbr(&_vorbis_info,0.5); - - vorbis_comment_init(&_vorbis_comment); - - vorbis_analysis_init(&_vorbis_dsp_state, &_vorbis_info); - - // random number for ogg serial number - srand(time(NULL)); - - } - - ~Vorbis() - { - terminateVorbis(); - } - - void terminateVorbis() { - - vorbis_block_clear(&_vorbis_block); - vorbis_dsp_clear(&_vorbis_dsp_state); - vorbis_comment_clear(&_vorbis_comment); - vorbis_info_clear(&_vorbis_info); - } - - virtual int codecDecode (short *dst, unsigned char *src, unsigned int size) - { - - - return 1; - } - - virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) - { - - return 1; - } - - private: - - // ogg-vorbis specific variables - ogg_sync_state oy; - - ogg_stream_state _ogg_stream_state; - - ogg_packet _ogg_packet; - - vorbis_info _vorbis_info; - - vorbis_comment _vorbis_comment; - - vorbis_dsp_state _vorbis_dsp_state; - - vorbis_block _vorbis_block; - - -}; - -// the class factories -extern "C" AudioCodec* create() { - return new Vorbis(117); -} - -extern "C" void destroy(AudioCodec* a) { - delete a; -} - -- GitLab