[Freeswitch-dev] two rtp questions - rtp debug and non block rtp read
cmrienzo at gmail.com
cmrienzo at gmail.com
Mon Aug 5 16:54:28 MSD 2013
For question 1, you can use SWITCH_CHANNEL_SESSION_LOG if you have a NULL session pointer.
Chris
On Aug 4, 2013, at 8:54 PM, Seven Du <dujinfang at gmail.com> wrote:
> Hi,
>
> 1) when use switch_rtp without a session SWITCH_RTP_FLAG_DEBUG_RTP_READ complaining no session attached because it use SWITCH_CHANNEL_SESSION_LOG.
>
> Suggested fix:
>
> use SWITCH_CHANNEL_SESSION_LOG where possible and SWITCH_CHANNEL_LOG when no session.
>
> also, I think the following code is wrong because there's no rtp_session->session:
>
> if (!rtp_session->session) {
> rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ] = 0;
> switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
> } else {
> ...
>
> I can fix and push if confirmed.
>
> 2) switch_rtp_zerocopy_read_frame() blocks forever if no RTP comes. Anyway to make it non block? I tried the following code it blocks even with SWITCH_IO_FLAG_NOBLOCK.
>
> I tried the following code in mod_skel, I can make a diff if necessary.
>
>
> rtp_flag[SWITCH_RTP_FLAG_IO] = 1;
> rtp_flag[SWITCH_RTP_FLAG_AUTOADJ] = 1;
> rtp_flag[SWITCH_RTP_FLAG_DATAWAIT] = 0;
> rtp_flag[SWITCH_RTP_FLAG_VIDEO] = 1;
> rtp_flag[SWITCH_RTP_FLAG_NOBLOCK] = 1;
> rtp_flag[SWITCH_RTP_FLAG_AUTO_CNG] = 1;
> // rtp_flag[SWITCH_RTP_FLAG_DEBUG_RTP_READ] = 1;
> // rtp_flag[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE] = 1;
>
> rtp_session = switch_rtp_new(IP, //local
> 50002, //recv port
> IP,
> 42000, //remote, doesn't matter for us, but can't be 0
> 96, // payload_type
> 1,
> 90000,
> rtp_flag,
> NULL, &err, pool);
>
> if (!rtp_session) {
> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error: %s\n", err);
> goto done;
> }
>
> while(!done) {
> // status = switch_rtp_zerocopy_read_frame(rtp_session, &read_frame, SWITCH_IO_FLAG_NOBLOCK);
> status = switch_rtp_zerocopy_read_frame(rtp_session, &read_frame, SWITCH_IO_FLAG_NONE);
> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "read %d\n", read_frame.packetlen);
> switch_yield(100000);
> }
>
> Thanks for help.
>
>
> --
> Seven Du
> http://www.freeswitch.org.cn
> http://about.me/dujinfang
> http://www.dujinfang.com
>
> Sent with Sparrow
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20130805/f6bce2f6/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev
mailing list