]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Experimentally, discard flush request that come before the first packet -- TuneBlade...
authorMike Brady <mikebrady@eircom.net>
Fri, 5 Feb 2016 09:25:21 +0000 (09:25 +0000)
committerMike Brady <mikebrady@eircom.net>
Fri, 5 Feb 2016 09:25:21 +0000 (09:25 +0000)
player.c
rtsp.c

index 348eac63fa100b5daa214336c3c294bf0e152eca..35dd3e5aa66f5db225a81cd34569869bb0488329 100644 (file)
--- 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 c3f00730db8b98aef8f58ed9e570d9f2277debce..07d5ebd9c0e5ee169fa63418d63c986fd282d5ee 100644 (file)
--- 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.");