Skip to content

Commit

Permalink
Experimentally, discard flush request that come before the first pack…
Browse files Browse the repository at this point in the history
…et -- TuneBlade bug workaround
  • Loading branch information
mikebrady committed Feb 5, 2016
1 parent c84f3dd commit c8af40e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.");
Expand Down

0 comments on commit c8af40e

Please sign in to comment.