Changeset 3901 for pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
- Timestamp:
- Dec 7, 2011 10:43:28 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
r3898 r3901 69 69 #endif 70 70 71 71 72 /** 72 73 * Media channel. … … 124 125 pjmedia_event fmt_event; /**< Buffered fmt_changed event 125 126 to avoid deadlock */ 127 pjmedia_event miss_keyframe_event; 128 /**< Buffered missing keyframe 129 event for delayed republish*/ 126 130 127 131 unsigned frame_size; /**< Size of encoded base frame.*/ … … 131 135 pjmedia_frame *rx_frames; /**< Temp. buffer for incoming 132 136 frame assembly. */ 137 138 pj_bool_t force_keyframe;/**< Forced to encode keyframe? */ 133 139 134 140 #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0 … … 352 358 pj_memcpy(&stream->fmt_event, event, sizeof(*event)); 353 359 return PJ_SUCCESS; 360 361 case PJMEDIA_EVENT_KEYFRAME_MISSING: 362 /* Republish this event later from get_frame(). */ 363 pj_memcpy(&stream->miss_keyframe_event, event, sizeof(*event)); 364 return PJ_SUCCESS; 365 354 366 default: 355 367 break; … … 764 776 pj_bool_t has_more_data = PJ_FALSE; 765 777 pj_size_t total_sent = 0; 766 778 pjmedia_vid_encode_opt enc_opt; 767 779 768 780 #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA != 0 … … 797 809 frame_out.size = 0; 798 810 811 /* Init encoding option */ 812 pj_bzero(&enc_opt, sizeof(enc_opt)); 813 if (stream->force_keyframe) { 814 /* Force encoder to generate keyframe */ 815 enc_opt.force_keyframe = PJ_TRUE; 816 stream->force_keyframe = PJ_FALSE; 817 TRC_((channel->port.info.name.ptr, 818 "Forcing encoder to generate keyframe")); 819 } 820 799 821 /* Encode! */ 800 status = pjmedia_vid_codec_encode_begin(stream->codec, frame,822 status = pjmedia_vid_codec_encode_begin(stream->codec, &enc_opt, frame, 801 823 channel->buf_size - 802 824 sizeof(pjmedia_rtp_hdr), … … 1080 1102 } 1081 1103 1104 if (stream->miss_keyframe_event.type != PJMEDIA_EVENT_NONE) { 1105 pjmedia_event_publish(NULL, port, &stream->miss_keyframe_event, 1106 PJMEDIA_EVENT_PUBLISH_POST_EVENT); 1107 stream->miss_keyframe_event.type = PJMEDIA_EVENT_NONE; 1108 } 1109 1082 1110 pj_mutex_lock( stream->jb_mutex ); 1083 1111 … … 1425 1453 1426 1454 /* Set up jitter buffer */ 1427 pjmedia_jbuf_set_adaptive( 1428 //pjmedia_jbuf_enable_discard(stream->jb, PJ_FALSE);1455 pjmedia_jbuf_set_adaptive(stream->jb, jb_init, jb_min_pre, jb_max_pre); 1456 pjmedia_jbuf_set_discard(stream->jb, PJMEDIA_JB_DISCARD_NONE); 1429 1457 1430 1458 /* Init RTCP session: */ … … 2091 2119 } 2092 2120 2121 2122 /* 2123 * Force stream to send video keyframe. 2124 */ 2125 PJ_DEF(pj_status_t) pjmedia_vid_stream_send_keyframe( 2126 pjmedia_vid_stream *stream) 2127 { 2128 PJ_ASSERT_RETURN(stream, PJ_EINVAL); 2129 2130 if (!pjmedia_vid_stream_is_running(stream, PJMEDIA_DIR_ENCODING)) 2131 return PJ_EINVALIDOP; 2132 2133 stream->force_keyframe = PJ_TRUE; 2134 2135 return PJ_SUCCESS; 2136 } 2137 2138 2093 2139 #endif /* PJMEDIA_HAS_VIDEO */
Note: See TracChangeset
for help on using the changeset viewer.