From 8e92da35b2a5f34dd9ca4f16f26b29a99a40fbd9 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 1 Jun 2018 11:58:31 +0100 Subject: [PATCH] move get_frame iteration message and enable error messaging if condwait timeout. --- player.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/player.c b/player.c index b2c35efc..95e6c2cb 100644 --- a/player.c +++ b/player.c @@ -793,6 +793,8 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) { do { // get the time local_time_now = get_absolute_time_in_fp(); // type okay + debug(3, "buffer_get_frame is iterating"); + // if config.timeout (default 120) seconds have elapsed since the last audio packet was // received, then we should stop. // config.timeout of zero means don't check..., but iTunes may be confused by a long gap @@ -1200,7 +1202,6 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) { (!conn->player_thread_please_stop); if (wait) { - debug(3, "buffer_get_frame is iterating"); uint64_t time_to_wait_for_wakeup_fp = ((uint64_t)1 << 32) / conn->input_rate; // this is time period of one frame time_to_wait_for_wakeup_fp *= 4 * 352; // four full 352-frame packets @@ -1214,10 +1215,10 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) { struct timespec time_of_wakeup; time_of_wakeup.tv_sec = sec; time_of_wakeup.tv_nsec = nsec; - pthread_cond_timedwait(&conn->flowcontrol, &conn->ab_mutex, &time_of_wakeup); -// int rc = pthread_cond_timedwait(&flowcontrol,&ab_mutex,&time_of_wakeup); -// if (rc!=0) -// debug(1,"pthread_cond_timedwait returned error code %d.",rc); +// pthread_cond_timedwait(&conn->flowcontrol, &conn->ab_mutex, &time_of_wakeup); + int rc = pthread_cond_timedwait(&conn->flowcontrol,&conn->ab_mutex,&time_of_wakeup); + if (rc!=0) + debug(3,"pthread_cond_timedwait returned error code %d.",rc); #endif #ifdef COMPILE_FOR_OSX uint64_t sec = time_to_wait_for_wakeup_fp >> 32;