Changeset 5825 for pjproject/trunk/pjmedia/src/pjmedia/stream.c
- Timestamp:
- Jul 17, 2018 8:11:17 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r5820 r5825 249 249 250 250 /* RTCP Feedback */ 251 pj_bool_t send_rtcp_fb_nack;/**< Should we send NACK? */ 252 pjmedia_rtcp_fb_nack rtcp_fb_nack; /**< NACK state. */ 251 pj_bool_t send_rtcp_fb_nack; /**< Send NACK? */ 252 pjmedia_rtcp_fb_nack rtcp_fb_nack; /**< TX NACK state. */ 253 int rtcp_fb_nack_cap_idx; /**< RX NACK cap idx. */ 253 254 254 255 … … 1725 1726 const void *payload; 1726 1727 unsigned payloadlen; 1727 pjmedia_rtp_status seq_st = {0};1728 pjmedia_rtp_status seq_st; 1728 1729 pj_status_t status; 1729 1730 pj_bool_t pkt_discarded = PJ_FALSE; … … 1768 1769 1769 1770 /* Ignore the packet if decoder is paused */ 1771 pj_bzero(&seq_st, sizeof(seq_st)); 1770 1772 if (channel->paused) 1771 1773 goto on_return; … … 2193 2195 2194 2196 /* 2197 * Handle events. 2198 */ 2199 static pj_status_t stream_event_cb(pjmedia_event *event, 2200 void *user_data) 2201 { 2202 pjmedia_stream *stream = (pjmedia_stream*)user_data; 2203 2204 /* Set RTCP FB capability in the event */ 2205 if (event->type==PJMEDIA_EVENT_RX_RTCP_FB && 2206 event->epub==&stream->rtcp) 2207 { 2208 pjmedia_event_rx_rtcp_fb_data *data = (pjmedia_event_rx_rtcp_fb_data*) 2209 event->data.ptr; 2210 2211 /* Application not configured to listen to NACK, discard this event */ 2212 if (stream->rtcp_fb_nack_cap_idx < 0) 2213 return PJ_SUCCESS; 2214 2215 data->cap = stream->si.loc_rtcp_fb.caps[stream->rtcp_fb_nack_cap_idx]; 2216 } 2217 2218 /* Republish events */ 2219 return pjmedia_event_publish(NULL, stream, event, 0); 2220 } 2221 2222 2223 /* 2195 2224 * Create media stream. 2196 2225 */ … … 2569 2598 stream->rtcp.stat.rtp_tx_last_ts = info->rtp_ts; 2570 2599 } 2600 2601 /* Subscribe to RTCP events */ 2602 pjmedia_event_subscribe(NULL, &stream_event_cb, stream, 2603 &stream->rtcp); 2571 2604 } 2572 2605 … … 2665 2698 #endif 2666 2699 2667 /* Check if RTCP-FB generic NACK is enabledfor this codec */2700 /* Check if we should send RTCP-FB generic NACK for this codec */ 2668 2701 if (stream->si.rem_rtcp_fb.cap_count) { 2669 2702 pjmedia_rtcp_fb_info *rfi = &stream->si.rem_rtcp_fb; … … 2679 2712 { 2680 2713 stream->send_rtcp_fb_nack = PJ_TRUE; 2714 break; 2715 } 2716 } 2717 } 2718 2719 /* Check if we handle incoming RTCP-FB generic NACK for this codec */ 2720 stream->rtcp_fb_nack_cap_idx = -1; 2721 if (stream->si.loc_rtcp_fb.cap_count) { 2722 pjmedia_rtcp_fb_info *lfi = &stream->si.loc_rtcp_fb; 2723 char cid[32]; 2724 unsigned i; 2725 2726 pjmedia_codec_info_to_id(&stream->si.fmt, cid, sizeof(cid)); 2727 2728 for (i = 0; i < lfi->cap_count; ++i) { 2729 if (lfi->caps[i].type == PJMEDIA_RTCP_FB_NACK && 2730 (!pj_strcmp2( &lfi->caps[i].codec_id, "*") || 2731 !pj_stricmp2(&lfi->caps[i].codec_id, cid))) 2732 { 2733 stream->rtcp_fb_nack_cap_idx = i; 2681 2734 break; 2682 2735 } … … 2796 2849 } 2797 2850 } 2851 2852 /* Unsubscribe from RTCP session events */ 2853 pjmedia_event_unsubscribe(NULL, &stream_event_cb, stream, 2854 &stream->rtcp); 2798 2855 2799 2856 /* Detach from transport
Note: See TracChangeset
for help on using the changeset viewer.