[Freeswitch-svn] [commit] r1695 - in freeswitch/trunk/src: . mod/codecs/mod_l16
Freeswitch SVN
anthm at freeswitch.org
Wed Jun 28 15:12:56 EDT 2006
Author: anthm
Date: Wed Jun 28 15:12:56 2006
New Revision: 1695
Modified:
freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c
freeswitch/trunk/src/switch_core.c
Log:
core tweaks
Modified: freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c Wed Jun 28 15:12:56 2006
@@ -57,7 +57,6 @@
void *encoded_data,
uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
{
-
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
if (codec && other_codec && codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
memcpy(encoded_data, decoded_data, decoded_data_len);
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Wed Jun 28 15:12:56 2006
@@ -1057,9 +1057,13 @@
int timeout, int stream_id)
{
switch_io_event_hook_read_frame_t *ptr;
- switch_status_t status = SWITCH_STATUS_FALSE;
- int need_codec = 0, perfect = 0;
-
+ switch_status_t status;
+ int need_codec, perfect;
+ top:
+
+ status = SWITCH_STATUS_FALSE;
+ need_codec = perfect = 0;
+
assert(session != NULL);
*frame = NULL;
@@ -1180,18 +1184,22 @@
session->raw_read_frame.rate = (*frame)->rate;
} else {
session->raw_read_frame.datalen = (uint32_t)switch_buffer_read(session->raw_read_buffer,
- session->raw_read_frame.data,
- session->read_codec->implementation->
- bytes_per_frame);
+ session->raw_read_frame.data,
+ session->read_codec->implementation->bytes_per_frame);
+
session->raw_read_frame.rate = session->read_codec->implementation->samples_per_second;
enc_frame = &session->raw_read_frame;
}
session->enc_read_frame.datalen = session->enc_read_frame.buflen;
+ assert(session->read_codec != NULL);
+ assert(enc_frame != NULL);
+ assert(enc_frame->data != NULL);
+
status = switch_core_codec_encode(session->read_codec,
enc_frame->codec,
enc_frame->data,
enc_frame->datalen,
- enc_frame->codec->implementation->samples_per_second,
+ session->read_codec->implementation->samples_per_second,
session->enc_read_frame.data,
&session->enc_read_frame.datalen,
&session->enc_read_frame.rate,
@@ -1215,6 +1223,8 @@
status = SWITCH_STATUS_GENERR;
break;
}
+ } else {
+ goto top;
}
}
}
More information about the Freeswitch-svn
mailing list