FSCORE-349 add flag to denote if a codec is init or not

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12961 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-04-09 17:17:12 +00:00
1 parent 2840f826f0
commit 68b0359cfb
25 files changed
+90 -78

No files matched your search

@@ -171,7 +171,7 @@ static switch_status_t engage_device(portaudio_stream_source_t *source,int resta
return SWITCH_STATUS_SUCCESS;
}
if (!source->read_codec.implementation) {
if (!switch_core_codec_ready(&source->read_codec)) {
if (switch_core_codec_init(&source->read_codec,
"L16",
NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
@@ -183,7 +183,7 @@ static switch_status_t engage_device(portaudio_stream_source_t *source,int resta
switch_assert(source->read_codec.implementation);
if (!source->write_codec.implementation) {
if (!switch_core_codec_ready(&source->write_codec) {
if (switch_core_codec_init(&source->write_codec,
"L16",
NULL,
@@ -340,11 +340,11 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
switch_mutex_lock(source->device_lock);
CloseAudioStream(source->audio_stream);
if (source->read_codec.implementation) {
if (switch_core_codec_ready(&source->read_codec)) {
switch_core_codec_destroy(&source->read_codec);
switch_core_codec_destroy(&source->write_codec);
}
if (source->write_codec.implementation) {
if (switch_core_codec_ready(&source->write_codec) {
switch_core_codec_destroy(&source->write_codec);
}
switch_mutex_unlock(source->device_lock);