Skip to content

Commit 105299a

Browse files
committed
Remove watchdog stuff. Move the pthreadtestcancel into the loop inside buffergetframe() -- somethime the player can stay inside that loop indefinitely.
1 parent bccf077 commit 105299a

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

player.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
921921
pthread_cleanup_push(buffer_get_frame_cleanup_handler,
922922
(void *)conn); // undo what's been done so far
923923
do {
924-
924+
pthread_testcancel(); // even if no packets are coming in...
925925
// get the time
926926
local_time_now = get_absolute_time_in_ns(); // type okay
927927
// debug(3, "buffer_get_frame is iterating");
@@ -2269,9 +2269,7 @@ void *player_thread_func(void *arg) {
22692269
if (conn->input_bytes_per_frame == 0)
22702270
debug(1, "conn->input_bytes_per_frame is zero!");
22712271

2272-
pthread_testcancel(); // allow a pthread_cancel request to take effect.
2273-
abuf_t *inframe = buffer_get_frame(conn); // this has cancellation point(s), but it's not
2274-
// guaranteed that they'll always be executed
2272+
abuf_t *inframe = buffer_get_frame(conn); // this has a (needed!) deliberate cancellation point in it.
22752273
uint64_t local_time_now = get_absolute_time_in_ns(); // types okay
22762274
config.last_access_to_volume_info_time =
22772275
local_time_now; // ensure volume info remains seen as valid
@@ -3233,14 +3231,6 @@ void *player_thread_func(void *arg) {
32333231
frames_seen_in_this_logging_interval = 0;
32343232
}
32353233

3236-
// update the watchdog
3237-
if ((config.dont_check_timeout == 0) && (config.timeout != 0)) {
3238-
uint64_t time_now = get_absolute_time_in_ns();
3239-
debug_mutex_lock(&conn->watchdog_mutex, 1000, 0);
3240-
conn->watchdog_bark_time = time_now;
3241-
debug_mutex_unlock(&conn->watchdog_mutex, 0);
3242-
}
3243-
32443234
// debug(1,"Sync error %lld frames. Amount to stuff %d." ,sync_error,amount_to_stuff);
32453235

32463236
// new stats calculation. We want a running average of sync error, drift, adjustment,

0 commit comments

Comments
 (0)