Commit 60b12263 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #9979: Don't do runtime assertions on data.

parent 21b349c7
......@@ -171,6 +171,7 @@ void AudioRtpRecordHandler::processDataDecode(unsigned char *spkrData, size_t si
return;
int inSamples = 0;
size = std::min(size, audioRtpRecord_.decData_.size());
SFLDataFormat *spkrDataDecoded = audioRtpRecord_.decData_.data();
{
ost::MutexLock lock(audioRtpRecord_.audioCodecMutex_);
......
......@@ -156,7 +156,7 @@ void AudioRtpSession::receiveSpeakerData()
return;
unsigned char* spkrDataIn = (unsigned char*) adu->getData(); // data in char
unsigned int size = adu->getSize(); // size in char
size_t size = adu->getSize(); // size in char
// DTMF over RTP, size must be over 4 in order to process it as voice data
if (size > 4)
......
......@@ -31,7 +31,6 @@
#include "sfl_types.h"
#include "audiocodec.h"
#include <cassert>
class Alaw : public sfl::AudioCodec {
......@@ -48,16 +47,14 @@ class Alaw : public sfl::AudioCodec {
private:
virtual int decode(SFLDataFormat *dst, unsigned char *src, size_t buf_size)
{
assert(buf_size == frameSize_ / 2 /* compression factor = 2:1 */ * sizeof(SFLDataFormat));
for (unsigned char* end = src + buf_size; src < end; ++src, ++dst)
*dst = ALawDecode(*src);
return frameSize_;
}
virtual int encode(unsigned char *dst, SFLDataFormat *src, size_t buf_size)
virtual int encode(unsigned char *dst, SFLDataFormat *src, size_t /*buf_size*/)
{
assert(buf_size >= frameSize_ / 2 /* compression factor = 2:1 */ * sizeof(SFLDataFormat));
for (unsigned char *end = dst + frameSize_; dst < end; ++src, ++dst)
*dst = ALawEncode(*src);
......
......@@ -36,7 +36,6 @@
#include <cstdlib>
#include <cstring>
#include <cassert>
class G722 : public sfl::AudioCodec {
......@@ -55,14 +54,12 @@ class G722 : public sfl::AudioCodec {
private:
virtual int decode(SFLDataFormat *dst, unsigned char *src, size_t buf_size)
{
assert(buf_size == frameSize_ / sizeof(SFLDataFormat) * encode_state_.bits_per_sample / 8);
return g722_decode(dst, (const uint8_t*) src, buf_size);
return g722_decode(dst, src, buf_size);
}
virtual int encode(unsigned char *dst, SFLDataFormat *src, size_t buf_size)
{
int out = g722_encode((uint8_t*) dst, src, frameSize_);
assert((size_t) out <= buf_size);
int out = g722_encode(dst, src, frameSize_);
return out;
}
......
......@@ -33,7 +33,6 @@
#include "audiocodec.h"
#include "sfl_types.h"
#include "noncopyable.h"
#include <cassert>
#include <stdexcept>
extern "C" {
......@@ -70,8 +69,6 @@ class Gsm : public sfl::AudioCodec {
virtual int decode(SFLDataFormat * dst, unsigned char * src, size_t buf_size)
{
assert(buf_size == 33);
if (gsm_decode(decode_gsmhandle_, (gsm_byte*) src, (gsm_signal*) dst) < 0)
throw std::runtime_error("ERROR: gsm_decode\n");
......@@ -80,7 +77,6 @@ class Gsm : public sfl::AudioCodec {
virtual int encode(unsigned char * dst, SFLDataFormat * src, size_t buf_size)
{
assert(buf_size >= 33);
gsm_encode(encode_gsmhandle_, (gsm_signal*) src, (gsm_byte*) dst);
return 33;
}
......
......@@ -32,7 +32,6 @@
#include "global.h"
#include "audiocodec.h"
#include "noncopyable.h"
#include <cstdio>
#include <speex/speex.h>
#include <cassert>
......@@ -71,8 +70,8 @@ class Speex : public sfl::AudioCodec {
speex_frame_size_(0) {
assert(payload >= 110 && payload <= 112);
assert(110 == PAYLOAD_CODEC_SPEEX_8000 &&
111 == PAYLOAD_CODEC_SPEEX_16000 &&
112 == PAYLOAD_CODEC_SPEEX_32000);
111 == PAYLOAD_CODEC_SPEEX_16000 &&
112 == PAYLOAD_CODEC_SPEEX_32000);
int type = payload - 110;
clockRate_ = clockRate[type];
......
......@@ -31,7 +31,6 @@
#include "audiocodec.h"
#include "sfl_types.h"
#include <cassert>
class Ulaw : public sfl::AudioCodec {
public:
......@@ -45,7 +44,6 @@ class Ulaw : public sfl::AudioCodec {
}
virtual int decode(SFLDataFormat *dst, unsigned char *src, size_t buf_size) {
assert(buf_size == frameSize_ / 2 /* compression factor = 2:1 */ * sizeof(SFLDataFormat));
for (unsigned char* end = src + buf_size; src < end; ++src, ++dst)
*dst = ULawDecode(*src);
......@@ -53,8 +51,7 @@ class Ulaw : public sfl::AudioCodec {
}
virtual int encode(unsigned char *dst, SFLDataFormat *src, size_t buf_size) {
assert(buf_size >= frameSize_ / 2 /* compression factor = 2:1 */ * sizeof(SFLDataFormat));
for (uint8* end = dst + frameSize_; dst < end; ++src, ++dst)
for (unsigned char * end = dst + frameSize_; dst < end; ++src, ++dst)
*dst = ULawEncode(*src);
return frameSize_ / 2 /* compression factor = 2:1 */ * sizeof(SFLDataFormat);;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment