Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +switch_codec_implementation_t* add_codec(switch_core_session_t *session, char * name){
- + switch_codec_implementation_t* codec = switch_core_alloc(switch_core_session_get_pool(session), sizeof(switch_codec_implementation_t));
- + codec->iananame = name;
- + return codec;
- +}
- +
- switch_status_t rtmp_tech_init(rtmp_private_t *tech_pvt, rtmp_session_t *rtmp_session, switch_core_session_t *session)
- {
- +
- switch_assert(rtmp_session && session && tech_pvt);
- tech_pvt->read_frame.data = tech_pvt->databuf;
- @@ -100,12 +107,32 @@ switch_status_t rtmp_tech_init(rtmp_private_t *tech_pvt, rtmp_session_t *rtmp_se
- switch_buffer_create_dynamic(&tech_pvt->readbuf, 512, 512, 1024000);
- //switch_buffer_add_mutex(tech_pvt->readbuf, tech_pvt->readbuf_mutex);
- + //TODO: probably need to init this once a codec is negotiated
- switch_core_timer_init(&tech_pvt->timer, "soft", 20, (16000 / (1000 / 20)), switch_core_session_get_pool(session));
- tech_pvt->session = session;
- tech_pvt->rtmp_session = rtmp_session;
- tech_pvt->channel = switch_core_session_get_channel(session);
- -
- + tech_pvt->num_codecs = 0;
- +
- + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codecs: %i\n", tech_pvt->rtmp_session->audioCodecs);
- + if((tech_pvt->rtmp_session->audioCodecs | SUPPORT_SND_G711A) == tech_pvt->rtmp_session->audioCodecs){
- + tech_pvt->codecs[tech_pvt->num_codecs++] = add_codec(session, "PCMA");
- + }
- +
- + if((tech_pvt->rtmp_session->audioCodecs | SUPPORT_SND_G711U) == tech_pvt->rtmp_session->audioCodecs){
- + tech_pvt->codecs[tech_pvt->num_codecs++] = add_codec(session, "PCMU");
- + }
- +
- + if((tech_pvt->rtmp_session->audioCodecs | SUPPORT_SND_SPEEX) == tech_pvt->rtmp_session->audioCodecs){
- + tech_pvt->codecs[tech_pvt->num_codecs++] = add_codec(session, "SPEEX");
- + }
- +
- + for(int i = 0; i < tech_pvt->num_codecs; i++){
- + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Supported %s\n", tech_pvt->codecs[i]->iananame);
- + }
- +
Add Comment
Please, Sign In to add comment