fixes for Opus encoder by Christian Franke <nobody@nowhere.ws>

This commit is contained in:
rafael@riseup.net 2013-12-13 20:40:37 +00:00
parent ab48aa3071
commit 40fd8cc0cf
3 changed files with 9 additions and 3 deletions

View File

@ -260,10 +260,11 @@ dnl make sure at least one of lame and vorbis present
dnl----------------------------------------------------------------------------- dnl-----------------------------------------------------------------------------
if test "x${LAME_LDFLAGS}" = "x" \ if test "x${LAME_LDFLAGS}" = "x" \
-a "x${VORBIS_LDFLAGS}" = "x" \ -a "x${VORBIS_LDFLAGS}" = "x" \
-a "x${OPUS_LDFLAGS}" = "x" \
-a "x${FAAC_LDFLAGS}" = "x" \ -a "x${FAAC_LDFLAGS}" = "x" \
-a "x${AACPLUS_LDFLAGS}" = "x" \ -a "x${AACPLUS_LDFLAGS}" = "x" \
-a "x${TWOLAME_LDFLAGS}" = "x"; then -a "x${TWOLAME_LDFLAGS}" = "x"; then
AC_MSG_ERROR([neither lame, Ogg Vorbis, faac, aac+ nor twolame configured]) AC_MSG_ERROR([neither lame, Ogg Vorbis, opus, faac, aac+ nor twolame configured])
fi fi

View File

@ -36,6 +36,9 @@
// compile only if configured for Ogg / Opus // compile only if configured for Ogg / Opus
#ifdef HAVE_OPUS_LIB #ifdef HAVE_OPUS_LIB
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "Exception.h" #include "Exception.h"
#include "Util.h" #include "Util.h"
@ -474,10 +477,10 @@ OpusLibEncoder :: flush ( void )
int opusBufferSize = (1275*3+7)*getOutChannel(); int opusBufferSize = (1275*3+7)*getOutChannel();
unsigned char * opusBuffer = new unsigned char[opusBufferSize]; unsigned char * opusBuffer = new unsigned char[opusBufferSize];
short int * shortBuffer = new short int[480]; short int * shortBuffer = new short int[480*getInChannel()];
// Send an empty audio packet along to flush out the stream. // Send an empty audio packet along to flush out the stream.
memset( shortBuffer, 0, 480); memset( shortBuffer, 0, 480*getInChannel()*sizeof(*shortBuffer));
memset( opusBuffer, 0, opusBufferSize); memset( opusBuffer, 0, opusBufferSize);
int encBytes = opus_encode( opusEncoder, shortBuffer, 480, opusBuffer, opusBufferSize); int encBytes = opus_encode( opusEncoder, shortBuffer, 480, opusBuffer, opusBufferSize);
if( encBytes == -1 ) { if( encBytes == -1 ) {

View File

@ -40,6 +40,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <stdlib.h>
#ifdef HAVE_OPUS_LIB #ifdef HAVE_OPUS_LIB
#include <opus/opus.h> #include <opus/opus.h>
#include <ogg/ogg.h> #include <ogg/ogg.h>