|
@@ -371,7 +371,7 @@ static int decoder_process(videortp_t *vrtp, uint8_t *input_buf, int input_len){
|
|
|
|
|
|
//decode
|
|
|
while (input_len > 0) {
|
|
|
- video_frame *decodered_frame;
|
|
|
+ video_frame *decodered_frame = NULL;
|
|
|
int key_frame = 0;
|
|
|
video_debug_write_play_file(AUDIO_DEC_IN, input_buf, input_len);
|
|
|
|
|
@@ -406,22 +406,23 @@ static int decoder_process(videortp_t *vrtp, uint8_t *input_buf, int input_len){
|
|
|
video_debug_write_play_file(VIDEO_RENDER_IN, video_debug_buf, length);
|
|
|
free(video_debug_buf);
|
|
|
}
|
|
|
-
|
|
|
- //rtpDbg(vrtp, "%s:%d: decodered_frame->format = %d", __FILE__, __LINE__, decodered_frame->format);
|
|
|
- //static int icount = 0;
|
|
|
- //if (icount == 0) {
|
|
|
- // video_frame_save_bmpfile("formattest.bmp", decodered_frame);
|
|
|
- // icount++;
|
|
|
- //}
|
|
|
}
|
|
|
|
|
|
//notify render
|
|
|
before_render_ms = TimeInMilliseconds();
|
|
|
if(vrtp->config.on_rx_frame){
|
|
|
- vrtp->config.on_rx_frame(decodered_frame, vrtp->config.user_data);
|
|
|
+ int iret = vrtp->config.on_rx_frame(decodered_frame, vrtp->config.user_data);
|
|
|
+ if (1 == iret){
|
|
|
+#ifdef _WIN32
|
|
|
+#else
|
|
|
+ video_frame_delete(decodered_frame);
|
|
|
+ decodered_frame = NULL;
|
|
|
+#endif
|
|
|
+ }
|
|
|
}else {
|
|
|
//render is null, we need delete self.
|
|
|
video_frame_delete(decodered_frame);
|
|
|
+ decodered_frame = NULL;
|
|
|
}
|
|
|
after_render_ms = TimeInMilliseconds();
|
|
|
video_stats_receiver_on_rendered_frame(after_render_ms, after_render_ms - before_render_ms);
|
|
@@ -1174,14 +1175,13 @@ void* recv_proc(void* arg)
|
|
|
{
|
|
|
int n;
|
|
|
{
|
|
|
+#ifdef _WIN32
|
|
|
unsigned rtcp_flags = 0;
|
|
|
int result = rtp_session_recv_rtcp(vrtp->rtp_sess, &rtcp_flags);
|
|
|
-#ifdef _WIN32
|
|
|
if (result >= 0) {
|
|
|
receiver_process_rtcp_packet(vrtp, rtcp_flags);
|
|
|
}
|
|
|
#endif
|
|
|
-
|
|
|
}
|
|
|
do {
|
|
|
unsigned short seq = 0;
|
|
@@ -1238,9 +1238,7 @@ void* recv_proc(void* arg)
|
|
|
//注意,cc中的ts是以真实时间毫秒为单位,rtp的时间戳是90000为1秒,这里需要转换
|
|
|
seg.timestamp = (send_time == 0 ? (ts / (VIDEO_CLOCK / 1000)) : send_time);
|
|
|
seg.data_size = n;
|
|
|
- rtpDbg(vrtp, "%s:%d ", __FUNCTION__, __LINE__);
|
|
|
sim_recv_video(&seg);
|
|
|
- rtpDbg(vrtp, "%s:%d ", __FUNCTION__, __LINE__);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -1254,10 +1252,10 @@ void* recv_proc(void* arg)
|
|
|
receiver_process_standard_h264_packet(vrtp, part_data, n, seq, mark, ts, pt);
|
|
|
}
|
|
|
rtp_timeout_cnt = 0;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
rtpframe_part_destroy(vrtp, part_data);
|
|
|
}
|
|
|
-
|
|
|
} while (n > 0);
|
|
|
|
|
|
{
|
|
@@ -2244,11 +2242,11 @@ void videortp_stop(videortp_t* vrtp)
|
|
|
sem_post(&vrtp->sem_evt);
|
|
|
if (0 != vrtp->recv_threadid) {
|
|
|
if (0 == pthread_join(vrtp->recv_threadid, NULL)){
|
|
|
+ rtpDbg(vrtp, "%s:%d vrtp receive thread %u thread join success.", __FUNCTION__, __LINE__, vrtp->recv_threadid);
|
|
|
vrtp->recv_threadid = 0;
|
|
|
- rtpDbg(vrtp, "%s:%d vrtp recv thread pthread join success.", __FUNCTION__, __LINE__);
|
|
|
}
|
|
|
else {
|
|
|
- rtpDbg(vrtp, "%s:%d vrtp recv thread pthread join failed for %s.", __FUNCTION__, __LINE__, strerror(errno));
|
|
|
+ rtpDbg(vrtp, "%s:%d vrtp receive thread thread join failed for %s.", __FUNCTION__, __LINE__, strerror(errno));
|
|
|
}
|
|
|
}
|
|
|
sem_destroy(&vrtp->sem_evt);
|