From c8af40e9ca18433714dc76144212ecede7223521 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 5 Feb 2016 09:25:21 +0000 Subject: [PATCH] Experimentally, discard flush request that come before the first packet -- TuneBlade bug workaround --- player.c | 8 ++++++++ rtsp.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/player.c b/player.c index 348eac63..35dd3e5a 100644 --- a/player.c +++ b/player.c @@ -301,6 +301,14 @@ static void free_buffer(void) { void player_put_packet(seq_t seqno, uint32_t timestamp, uint8_t *data, int len) { + // ignore a request to flush that has been made before the first packet... + if (packet_count==0) { + pthread_mutex_lock(&flush_mutex); + flush_requested = 0; + flush_rtp_timestamp = 0; + pthread_mutex_unlock(&flush_mutex); + } + pthread_mutex_lock(&ab_mutex); packet_count++; time_of_last_audio_packet = get_absolute_time_in_fp(); diff --git a/rtsp.c b/rtsp.c index c3f00730..07d5ebd9 100644 --- a/rtsp.c +++ b/rtsp.c @@ -237,8 +237,12 @@ int pc_queue_get_item(pc_queue *the_queue, void *the_stuff) { // determine if we are the currently playing thread static inline int rtsp_playing(void) { if (pthread_mutex_trylock(&playing_mutex)) { + // if playing_mutex is locked... + // return 0 if the threads are different, non-zero if the threads are the same return pthread_equal(playing_thread, pthread_self()); } else { + // you actually acquired the playing_mutex, implying that there is no currently playing thread + // so unlock it return 0, implying you are not playing pthread_mutex_unlock(&playing_mutex); return 0; } @@ -1694,6 +1698,7 @@ static void *rtsp_conversation_thread_func(void *pconn) { rtp_shutdown(); pthread_mutex_unlock(&play_lock); pthread_mutex_unlock(&playing_mutex); + // usleep(1000000); } // else { //debug(1, "This RTSP conversation thread doesn't think it's playing for a " // "close RTSP connection.");