* #20661: opus: ensure that HAVE_OPUS is defined

This commit is contained in:
Tristan Matthews
2013-07-08 14:58:34 -04:00
parent bc787648c4
commit 9dc8964150
2 changed files with 15 additions and 8 deletions

View File

@ -25,6 +25,12 @@ else
SPEEXCODEC= SPEEXCODEC=
endif endif
if BUILD_OPUS
OPUSCODEC=-DHAVE_OPUS
else
OPUSCODEC=
endif
if BUILD_GSM if BUILD_GSM
GSMCODEC=-DHAVE_GSM_CODEC GSMCODEC=-DHAVE_GSM_CODEC
else else
@ -46,8 +52,9 @@ AM_CPPFLAGS = \
-DCODECS_DIR=\""$(sflcodecdir)"\" \ -DCODECS_DIR=\""$(sflcodecdir)"\" \
-DPLUGINS_DIR=\""$(sflplugindir)"\" \ -DPLUGINS_DIR=\""$(sflplugindir)"\" \
-DENABLE_TRACE \ -DENABLE_TRACE \
$(SPEEXCODEC) \ $(SPEEXCODEC) \
$(GSMCODEC) $(GSMCODEC) \
$(OPUSCODEC)
indent: indent:

View File

@ -40,9 +40,9 @@
#include <algorithm> #include <algorithm>
//#ifdef HAVE_OPUS #ifdef HAVE_OPUS
#include "audio/codecs/opus.h" #include "audio/codecs/opus.h"
//#endif #endif
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
#include "video/libav_utils.h" #include "video/libav_utils.h"
@ -255,7 +255,7 @@ Sdp::setMediaDescriptorLines(bool audio)
rtpmap.enc_name = pj_str((char*) enc_name.c_str()); rtpmap.enc_name = pj_str((char*) enc_name.c_str());
rtpmap.clock_rate = clock_rate; rtpmap.clock_rate = clock_rate;
// #ifdef HAVE_OPUS #ifdef HAVE_OPUS
// Opus sample rate is allways declared as 48000 and channel num is allways 2 in rtpmap as per // Opus sample rate is allways declared as 48000 and channel num is allways 2 in rtpmap as per
// http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03#section-6.2 // http://tools.ietf.org/html/draft-spittka-payload-rtp-opus-03#section-6.2
if(payload == Opus::PAYLOAD_TYPE) { if(payload == Opus::PAYLOAD_TYPE) {
@ -263,7 +263,7 @@ Sdp::setMediaDescriptorLines(bool audio)
rtpmap.param.ptr = ((char* const)"2"); rtpmap.param.ptr = ((char* const)"2");
rtpmap.param.slen = 1; rtpmap.param.slen = 1;
} else } else
// #endif #endif
{ {
rtpmap.param.ptr = ((char* const)""); rtpmap.param.ptr = ((char* const)"");
rtpmap.param.slen = 0; rtpmap.param.slen = 0;
@ -274,14 +274,14 @@ Sdp::setMediaDescriptorLines(bool audio)
med->attr[med->attr_count++] = attr; med->attr[med->attr_count++] = attr;
// #ifdef HAVE_OPUS #ifdef HAVE_OPUS
// Declare stereo support for opus // Declare stereo support for opus
if(payload == Opus::PAYLOAD_TYPE) { if(payload == Opus::PAYLOAD_TYPE) {
std::ostringstream os; std::ostringstream os;
os << "fmtp:" << payload << " stereo=1; sprop-stereo=" << (channels>1 ? 1 : 0); os << "fmtp:" << payload << " stereo=1; sprop-stereo=" << (channels>1 ? 1 : 0);
med->attr[med->attr_count++] = pjmedia_sdp_attr_create(memPool_, os.str().c_str(), NULL); med->attr[med->attr_count++] = pjmedia_sdp_attr_create(memPool_, os.str().c_str(), NULL);
} }
// #endif #endif
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
if (enc_name == "H264") { if (enc_name == "H264") {
std::ostringstream os; std::ostringstream os;