[asterisk-commits] dvossel: branch dvossel/opus_codec_ftw r329784 - in /team/dvossel/opus_codec_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 27 14:35:14 CDT 2011


Author: dvossel
Date: Wed Jul 27 14:35:10 2011
New Revision: 329784

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=329784
Log:
Fixes an issue with determining samplerate of OPUS format.

Modified:
    team/dvossel/opus_codec_ftw/codecs/codec_opus.c
    team/dvossel/opus_codec_ftw/include/asterisk/opus.h

Modified: team/dvossel/opus_codec_ftw/codecs/codec_opus.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/opus_codec_ftw/codecs/codec_opus.c?view=diff&rev=329784&r1=329783&r2=329784
==============================================================================
--- team/dvossel/opus_codec_ftw/codecs/codec_opus.c (original)
+++ team/dvossel/opus_codec_ftw/codecs/codec_opus.c Wed Jul 27 14:35:10 2011
@@ -119,6 +119,11 @@
 	enc->frame_size = opus_rate / (1000 / DEFAULT_TIME_PERIOD);
 	enc->sample_rate = opus_rate;
 
+	pvt->samples = 0;
+	memset(enc->frame_offsets, 0, sizeof(enc->frame_offsets));
+	enc->frame_offsets_num = 0;
+	enc->frame_offsets_numbytes = OUTBUF_SIZE;
+
 	enc->init = 1;
 
 	return 0;
@@ -210,6 +215,8 @@
 	slin_data = enc->slin_buf;
 	opus_data = (unsigned char *) pvt->outbuf.c;
 
+	ast_log(LOG_NOTICE, "SLIN SAMPLES: %d  NEEDED SAMPLES %d\n", enc->slin_samples, enc->frame_size);
+
 	for ( ; enc->slin_samples >= enc->frame_size; enc->slin_samples -= enc->frame_size) {
 		num_bytes = opus_encode(enc->enc, slin_data, enc->frame_size, opus_data, enc->frame_offsets_numbytes);
 
@@ -228,7 +235,6 @@
 		enc->frame_offsets_numbytes += num_bytes;
 
 		pvt->samples += enc->frame_size;
-
 		slin_data += enc->frame_size; /* increments by int16_t samples */
 		opus_data += num_bytes; /* increments by bytes */
 	}
@@ -268,10 +274,11 @@
 		}
 	}
 
-
 	pvt->samples = 0;
 	memset(enc->frame_offsets, 0, sizeof(enc->frame_offsets));
 	enc->frame_offsets_num = 0;
+	enc->frame_offsets_numbytes = OUTBUF_SIZE;\
+
 	return frame;
 }
 

Modified: team/dvossel/opus_codec_ftw/include/asterisk/opus.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/opus_codec_ftw/include/asterisk/opus.h?view=diff&rev=329784&r1=329783&r2=329784
==============================================================================
--- team/dvossel/opus_codec_ftw/include/asterisk/opus.h (original)
+++ team/dvossel/opus_codec_ftw/include/asterisk/opus.h Wed Jul 27 14:35:10 2011
@@ -35,11 +35,11 @@
 };
 
 enum opus_attr_vals {
-	OPUS_ATTR_VAL_SAMP_8KHZ = (1 << 0),
-	OPUS_ATTR_VAL_SAMP_12KHZ = (1 << 1),
-	OPUS_ATTR_VAL_SAMP_16KHZ = (1 << 2),
-	OPUS_ATTR_VAL_SAMP_24KHZ = (1 << 3),
-	OPUS_ATTR_VAL_SAMP_48KHZ = (1 << 4),
+	OPUS_ATTR_VAL_SAMP_8KHZ = 8000,
+	OPUS_ATTR_VAL_SAMP_12KHZ = 12000,
+	OPUS_ATTR_VAL_SAMP_16KHZ = 16000,
+	OPUS_ATTR_VAL_SAMP_24KHZ = 24000,
+	OPUS_ATTR_VAL_SAMP_48KHZ = 48000,
 };
 
 #endif /* _AST_FORMAT_OPUS_H */




More information about the asterisk-commits mailing list