Experimentally, discard flush request that come before the first packet -- TuneBlade bug workaround

This commit is contained in:
Mike Brady
2016-02-05 09:25:21 +00:00
parent c84f3dd058
commit c8af40e9ca
2 changed files with 13 additions and 0 deletions
+8
View File
@@ -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();
+5
View File
@@ -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.");