这篇教程C++ switch_core_codec_ready函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中switch_core_codec_ready函数的典型用法代码示例。如果您正苦于以下问题:C++ switch_core_codec_ready函数的具体用法?C++ switch_core_codec_ready怎么用?C++ switch_core_codec_ready使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了switch_core_codec_ready函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: channel_on_destroystatic switch_status_t channel_on_destroy(switch_core_session_t *session){ switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; void *pop; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); if (tech_pvt) { switch_core_timer_destroy(&tech_pvt->timer); if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } if (switch_core_codec_ready(&tech_pvt->write_codec)) { switch_core_codec_destroy(&tech_pvt->write_codec); } if (tech_pvt->write_frame) { switch_frame_free(&tech_pvt->write_frame); } while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { switch_frame_t *frame = (switch_frame_t *) pop; switch_frame_free(&frame); } } return SWITCH_STATUS_SUCCESS;}
开发者ID:kgrofelnik,项目名称:mod_portaudio-endpoints,代码行数:35,
示例2: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec, switch_codec_t *other_codec, void *decoded_data, uint32_t decoded_data_len, uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag){ switch_status_t status; switch_assert(codec != NULL); switch_assert(encoded_data != NULL); switch_assert(decoded_data != NULL); if (!codec->implementation || !switch_core_codec_ready(codec)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!/n"); return SWITCH_STATUS_NOT_INITALIZED; } if (!switch_test_flag(codec, SWITCH_CODEC_FLAG_ENCODE)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec encoder is not initialized!/n"); return SWITCH_STATUS_NOT_INITALIZED; } if (codec->mutex) switch_mutex_lock(codec->mutex); status = codec->implementation->encode(codec, other_codec, decoded_data, decoded_data_len, decoded_rate, encoded_data, encoded_data_len, encoded_rate, flag); if (codec->mutex) switch_mutex_unlock(codec->mutex); return status;}
开发者ID:hsaid,项目名称:FreeSWITCH,代码行数:31,
示例3: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session_t *session, switch_media_bug_t **bug){ switch_media_bug_t *bp = NULL, *last = NULL; switch_status_t status = SWITCH_STATUS_FALSE; switch_thread_rwlock_wrlock(session->bug_rwlock); if (session->bugs) { for (bp = session->bugs; bp; bp = bp->next) { if ((!bp->thread_id || bp->thread_id == switch_thread_self()) && bp->ready && bp == *bug) { if (last) { last->next = bp->next; } else { session->bugs = bp->next; } break; } last = bp; } } if (!session->bugs && switch_core_codec_ready(&session->bug_codec)) { switch_core_codec_destroy(&session->bug_codec); } switch_thread_rwlock_unlock(session->bug_rwlock); if (bp) { status = switch_core_media_bug_close(&bp); } return status;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:33,
示例4: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(switch_core_session_t *session, const char *function){ switch_media_bug_t *bp; switch_status_t status = SWITCH_STATUS_FALSE; if (session->bugs) { switch_thread_rwlock_wrlock(session->bug_rwlock); for (bp = session->bugs; bp; bp = bp->next) { if ((bp->thread_id && bp->thread_id != switch_thread_self()) || switch_test_flag(bp, SMBF_LOCK)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "BUG is thread locked skipping./n"); continue; } if (!zstr(function) && strcmp(bp->function, function)) { continue; } if (bp->callback) { bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_CLOSE); } switch_core_media_bug_destroy(bp); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Removing BUG from %s/n", switch_channel_get_name(session->channel)); } session->bugs = NULL; switch_thread_rwlock_unlock(session->bug_rwlock); status = SWITCH_STATUS_SUCCESS; } if (switch_core_codec_ready(&session->bug_codec)) { switch_core_codec_destroy(&session->bug_codec); } return status;}
开发者ID:benlangfeld,项目名称:FreeSWITCH,代码行数:35,
示例5: switch_log_printfvoid WSClientParser::DestroyChannel(WSChannel* wsChannel) { switch_log_printf( SWITCH_CHANNEL_UUID_LOG(this->GetUUID()), SWITCH_LOG_INFO, "WSClientParser::DestroyChannel( " "this : %p, " "wsChannel : %p " ") /n", this, mpChannel ); if( wsChannel ) { // Audio if (switch_core_codec_ready(&wsChannel->read_codec)) { switch_core_codec_destroy(&wsChannel->read_codec); } if (switch_core_codec_ready(&wsChannel->write_codec)) { switch_core_codec_destroy(&wsChannel->write_codec); } // Video if (switch_core_codec_ready(&wsChannel->video_read_codec)) { switch_core_codec_destroy(&wsChannel->video_read_codec); } if (switch_core_codec_ready(&wsChannel->video_write_codec)) { switch_core_codec_destroy(&wsChannel->video_write_codec); } if( wsChannel->video_readbuf_mutex ) { switch_mutex_destroy(wsChannel->video_readbuf_mutex); wsChannel->video_readbuf_mutex = NULL; } if( wsChannel->session ) { switch_media_handle_destroy(wsChannel->session); wsChannel->session = NULL; } if( wsChannel->video_readbuf ) { switch_buffer_destroy(&wsChannel->video_readbuf); wsChannel->video_readbuf = NULL; } }}
开发者ID:KingsleyYau,项目名称:CamShareMiddleware,代码行数:47,
示例6: tech_initstatic switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session){ const char *iananame = "L16"; int rate = 8000; int interval = 20; switch_status_t status = SWITCH_STATUS_SUCCESS; switch_channel_t *channel = switch_core_session_get_channel(session); const switch_codec_implementation_t *read_impl; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d/n", switch_channel_get_name(channel), iananame, rate, interval); status = switch_core_codec_init(&tech_pvt->read_codec, iananame, NULL, rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)); if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) { goto end; } status = switch_core_codec_init(&tech_pvt->write_codec, iananame, NULL, rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)); if (status != SWITCH_STATUS_SUCCESS) { switch_core_codec_destroy(&tech_pvt->read_codec); goto end; } tech_pvt->read_frame.data = tech_pvt->databuf; tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf); tech_pvt->read_frame.codec = &tech_pvt->read_codec; tech_pvt->read_frame.flags = SFF_NONE; switch_core_session_set_read_codec(session, &tech_pvt->read_codec); switch_core_session_set_write_codec(session, &tech_pvt->write_codec); read_impl = tech_pvt->read_codec.implementation; switch_core_timer_init(&tech_pvt->timer, "soft", read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet, switch_core_session_get_pool(session)); switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); switch_core_session_set_private(session, tech_pvt); tech_pvt->session = session; tech_pvt->channel = switch_core_session_get_channel(session); end: return status;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:56,
示例7: webm_file_closestatic switch_status_t webm_file_close(switch_file_handle_t *handle){ webm_file_context_t *context = (webm_file_context_t *)handle->private_info; context->segment->Finalize(); delete context->segment; delete context->writer; if (switch_core_codec_ready(&context->audio_codec)) switch_core_codec_destroy(&context->audio_codec); if (switch_core_codec_ready(&context->video_codec)) switch_core_codec_destroy(&context->video_codec); if (context->timer.interval) { switch_core_timer_destroy(&context->timer); } switch_buffer_destroy(&context->buf); switch_buffer_destroy(&context->audio_buffer); return SWITCH_STATUS_SUCCESS;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:20,
示例8: mp4_file_closestatic switch_status_t mp4_file_close(switch_file_handle_t *handle){ mp4_file_context_t *context = handle->private_info; if (context->fd) { MP4Close(context->fd, 0); context->fd = NULL; } if (switch_core_codec_ready(&context->audio_codec)) switch_core_codec_destroy(&context->audio_codec); if (switch_core_codec_ready(&context->video_codec)) switch_core_codec_destroy(&context->video_codec); if (context->timer.interval) { switch_core_timer_destroy(&context->timer); } switch_img_free(&context->last_img); switch_buffer_destroy(&context->buf); return SWITCH_STATUS_SUCCESS;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:21,
示例9: channel_on_destroystatic switch_status_t channel_on_destroy(switch_core_session_t *session){ switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; channel = switch_core_session_get_channel(session); assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); if (tech_pvt) { if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } if (switch_core_codec_ready(&tech_pvt->write_codec)) { switch_core_codec_destroy(&tech_pvt->write_codec); } } return SWITCH_STATUS_SUCCESS;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:22,
示例10: channel_on_destroystatic switch_status_t channel_on_destroy(switch_core_session_t *session){ switch_channel_t *channel = NULL; loopback_private_t *tech_pvt = NULL; switch_event_t *vars; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); if ((vars = (switch_event_t *) switch_channel_get_private(channel, "__loopback_vars__"))) { switch_channel_set_private(channel, "__loopback_vars__", NULL); switch_event_destroy(&vars); } if (tech_pvt) { switch_core_timer_destroy(&tech_pvt->timer); if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } if (switch_core_codec_ready(&tech_pvt->write_codec)) { switch_core_codec_destroy(&tech_pvt->write_codec); } if (tech_pvt->write_frame) { switch_frame_free(&tech_pvt->write_frame); } clear_queue(tech_pvt); } return SWITCH_STATUS_SUCCESS;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:37,
示例11: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec, switch_codec_t *other_codec, void *encoded_data, uint32_t encoded_data_len, uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag){ switch_status_t status; switch_assert(codec != NULL); switch_assert(encoded_data != NULL); switch_assert(decoded_data != NULL); if (!codec->implementation || !switch_core_codec_ready(codec)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!/n"); abort(); return SWITCH_STATUS_NOT_INITALIZED; } if (!switch_test_flag(codec, SWITCH_CODEC_FLAG_DECODE)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec decoder is not initialized!/n"); return SWITCH_STATUS_NOT_INITALIZED; } if (codec->implementation->encoded_bytes_per_packet) { uint32_t frames = encoded_data_len / codec->implementation->encoded_bytes_per_packet; if (frames && codec->implementation->decoded_bytes_per_packet * frames > *decoded_data_len) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Buffer size sanity check failed! edl:%u ebpp:%u fr:%u ddl:%u/n", encoded_data_len, codec->implementation->encoded_bytes_per_packet, frames, *decoded_data_len); *decoded_data_len = codec->implementation->decoded_bytes_per_packet; memset(decoded_data, 255, *decoded_data_len); return SWITCH_STATUS_SUCCESS; } } if (codec->mutex) switch_mutex_lock(codec->mutex); status = codec->implementation->decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate, decoded_data, decoded_data_len, decoded_rate, flag); if (codec->mutex) switch_mutex_unlock(codec->mutex); return status;}
开发者ID:AricGod,项目名称:FreeSWITCH,代码行数:43,
示例12: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec){ switch_mutex_t *mutex; switch_memory_pool_t *pool; int free_pool = 0; switch_assert(codec != NULL); if (!codec->implementation || !switch_core_codec_ready(codec)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec is not initialized!/n"); return SWITCH_STATUS_NOT_INITALIZED; } if (switch_test_flag(codec, SWITCH_CODEC_FLAG_FREE_POOL)) { free_pool = 1; } pool = codec->memory_pool; mutex = codec->mutex; if (mutex) switch_mutex_lock(mutex); codec->implementation->destroy(codec); switch_clear_flag(codec, SWITCH_CODEC_FLAG_READY); UNPROTECT_INTERFACE(codec->codec_interface); if (mutex) switch_mutex_unlock(mutex); if (free_pool) { switch_core_destroy_memory_pool(&pool); } return SWITCH_STATUS_SUCCESS;}
开发者ID:sl33nyc,项目名称:freeswitch,代码行数:37,
示例13: read_stream_threadstatic void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj){ portaudio_stream_source_t *source = obj; portaudio_stream_context_t *cp; int samples = 0; int bused, bytesToWrite; switch_mutex_lock(globals.mutex); globals.threads++; switch_mutex_unlock(globals.mutex); if (!source->prebuf) { source->prebuf = DEFAULT_PREBUFFER_SIZE; } switch_mutex_lock(globals.mutex); switch_core_hash_insert(globals.source_hash, source->sourcename, source); switch_mutex_unlock(globals.mutex); switch_thread_rwlock_create(&source->rwlock, source->pool); if (engage_device(source, 0) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Dev %d cant be engaged !/n", (int) source->sourcedev); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " Dev %d engaged at %d rate!/n", (int) source->sourcedev, (int) source->rate); if (globals.running && !source->stopped) { source->ready = 1; if (!source->audio_stream) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Audio Stream wops!/n"); source->stopped = 0; source->ready = 0; } else { while (globals.running && !source->stopped) { samples = 0; switch_mutex_lock(source->device_lock); samples = ReadAudioStream(source->audio_stream, source->databuf, source->read_codec.implementation->samples_per_packet, 0, &source->timer); switch_mutex_unlock(source->device_lock); if (samples) { bytesToWrite = source->samples; if (samples < bytesToWrite) { bytesToWrite = samples; } bytesToWrite *= source->audio_stream->bytesPerFrame; if (source->total) { switch_mutex_lock(source->mutex); for (cp = source->context_list; cp; cp = cp->next) { switch_mutex_lock(cp->audio_mutex); bused = switch_buffer_inuse(cp->audio_buffer); if (bused > source->samples * 768) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d] %d used %d max/n", cp->func, cp->file, cp->line, (int) bused, (int) (source->samples * 768)); switch_buffer_zero(cp->audio_buffer); } else { switch_buffer_write(cp->audio_buffer, source->databuf, bytesToWrite); } switch_mutex_unlock(cp->audio_mutex); } switch_mutex_unlock(source->mutex); } } } } } } source->ready = 0; switch_mutex_lock(globals.mutex); switch_core_hash_delete(globals.source_hash, source->sourcename); switch_mutex_unlock(globals.mutex); switch_thread_rwlock_wrlock(source->rwlock); switch_thread_rwlock_unlock(source->rwlock); switch_mutex_lock(source->device_lock); CloseAudioStream(source->audio_stream); if (switch_core_codec_ready(&source->read_codec)) { switch_core_codec_destroy(&source->read_codec); switch_core_codec_destroy(&source->write_codec); } if (switch_core_codec_ready(&source->write_codec)) { switch_core_codec_destroy(&source->write_codec);//.........这里部分代码省略.........
开发者ID:crazypenguincode,项目名称:freeswitch,代码行数:101,
示例14: engage_devicestatic switch_status_t engage_device(portaudio_stream_source_t *source, int restart){ PaStreamParameters inputParameters, outputParameters; PaError err; int sample_rate = source->rate; int codec_ms = source->interval; switch_mutex_init(&source->device_lock, SWITCH_MUTEX_NESTED, module_pool); if (source->timer.timer_interface) { switch_core_timer_sync(&source->timer); } if (source->audio_stream) { return SWITCH_STATUS_SUCCESS; } 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, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?/n"); return SWITCH_STATUS_FALSE; } } switch_assert(source->read_codec.implementation); if (!switch_core_codec_ready(&source->write_codec)) { if (switch_core_codec_init(&source->write_codec, "L16", NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?/n"); switch_core_codec_destroy(&source->read_codec); return SWITCH_STATUS_FALSE; } } if (!source->timer.timer_interface) { if (switch_core_timer_init(&source->timer, source->timer_name, codec_ms, source->read_codec.implementation->samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!/n"); switch_core_codec_destroy(&source->read_codec); switch_core_codec_destroy(&source->write_codec); return SWITCH_STATUS_FALSE; } } source->read_frame.rate = sample_rate; source->read_frame.codec = &source->read_codec; switch_mutex_lock(source->device_lock); /* LOCKED ************************************************************************************************** */ inputParameters.device = source->sourcedev; inputParameters.channelCount = 1; inputParameters.sampleFormat = SAMPLE_TYPE; inputParameters.suggestedLatency = Pa_GetDeviceInfo(inputParameters.device)->defaultLowInputLatency; inputParameters.hostApiSpecificStreamInfo = NULL; outputParameters.device = source->sourcedev; outputParameters.channelCount = 1; outputParameters.sampleFormat = SAMPLE_TYPE; outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; err = OpenAudioStream(&source->audio_stream, &inputParameters, NULL, sample_rate, paClipOff, source->read_codec.implementation->samples_per_packet, 0); /* UNLOCKED ************************************************************************************************* */ if (err != paNoError) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying/n"); switch_yield(1000000); err = OpenAudioStream(&source->audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff, source->read_codec.implementation->samples_per_packet, 0); } switch_mutex_unlock(source->device_lock); if (err != paNoError) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device/n"); switch_core_codec_destroy(&source->read_codec); switch_core_timer_destroy(&source->timer); return SWITCH_STATUS_FALSE; } return SWITCH_STATUS_SUCCESS;}
开发者ID:crazypenguincode,项目名称:freeswitch,代码行数:89,
示例15: tech_initstatic switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session, switch_codec_t *codec){ const char *iananame = "L16"; int rate = 8000; int interval = 20; switch_status_t status = SWITCH_STATUS_SUCCESS; switch_channel_t *channel = switch_core_session_get_channel(session); const switch_codec_implementation_t *read_impl; if (codec) { iananame = codec->implementation->iananame; rate = codec->implementation->samples_per_second; interval = codec->implementation->microseconds_per_packet / 1000; } if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } if (switch_core_codec_ready(&tech_pvt->write_codec)) { switch_core_codec_destroy(&tech_pvt->write_codec); } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d/n", switch_channel_get_name(channel), iananame, rate, interval); status = switch_core_codec_init(&tech_pvt->read_codec, iananame, NULL, rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)); if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) { goto end; } status = switch_core_codec_init(&tech_pvt->write_codec, iananame, NULL, rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)); if (status != SWITCH_STATUS_SUCCESS) { switch_core_codec_destroy(&tech_pvt->read_codec); goto end; } tech_pvt->read_frame.data = tech_pvt->databuf; tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf); tech_pvt->read_frame.codec = &tech_pvt->read_codec; tech_pvt->cng_frame.data = tech_pvt->cng_databuf; tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf); //switch_set_flag((&tech_pvt->cng_frame), SFF_CNG); tech_pvt->cng_frame.datalen = 2; tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second / tech_pvt->read_codec.implementation->samples_per_packet) * 3; switch_core_session_set_read_codec(session, &tech_pvt->read_codec); switch_core_session_set_write_codec(session, &tech_pvt->write_codec); if (tech_pvt->flag_mutex) { switch_core_timer_destroy(&tech_pvt->timer); } read_impl = tech_pvt->read_codec.implementation; switch_core_timer_init(&tech_pvt->timer, "soft", read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session)); if (!tech_pvt->flag_mutex) { switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); switch_core_session_set_private(session, tech_pvt); switch_queue_create(&tech_pvt->frame_queue, FRAME_QUEUE_LEN, switch_core_session_get_pool(session)); tech_pvt->session = session; tech_pvt->channel = switch_core_session_get_channel(session); } end: return status;}
开发者ID:gujun,项目名称:sscore,代码行数:85,
注:本文中的switch_core_codec_ready函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ switch_core_destroy_memory_pool函数代码示例 C++ switch_clear_flag函数代码示例 |