rtsp_client: don't wait if packet is over due

Check if the time difference is negative.  That would have caused
sleeping forever.
This commit is contained in:
Max Kellermann 2011-08-31 07:46:56 +02:00
parent f3ac8a7cd9
commit 2525d32e17
1 changed files with 3 additions and 2 deletions

View File

@ -623,8 +623,9 @@ send_audio_data(int fd, GError **error_r)
get_time_for_rtp(&raop_session->play_state, &rtp_time);
gettimeofday(&current_time, NULL);
int diff = difference(&current_time, &rtp_time);
g_usleep(-diff);
int diff = difference(&rtp_time, &current_time);
if (diff > 0)
g_usleep(diff);
gettimeofday(&raop_session->play_state.last_send, NULL);
while (rd) {