From: Jaroslav Kysela Date: Sat, 2 Jan 2016 19:25:53 +0000 (+0100) Subject: timeshift: remove atomic ops for ts->last_time, variable is protected using state_mutex X-Git-Tag: v4.2.1~1245 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46375ddce1b00c3be72ed4371faecd9ccf9a233d;p=thirdparty%2Ftvheadend.git timeshift: remove atomic ops for ts->last_time, variable is protected using state_mutex --- diff --git a/src/timeshift.c b/src/timeshift.c index 1b712ad5d..987fa81db 100644 --- a/src/timeshift.c +++ b/src/timeshift.c @@ -271,7 +271,7 @@ timeshift_packet( timeshift_t *ts, th_pkt_t *pkt, int deliver ) time = ts_rescale(pkt->pkt_pts, 1000000); if (time > ts->last_time) { - atomic_exchange_s64(&ts->last_time, time); + ts->last_time = time; timeshift_packet_flush(ts, time, deliver); } diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index c04640236..9024df9e9 100644 --- a/src/timeshift/timeshift_reader.c +++ b/src/timeshift/timeshift_reader.c @@ -647,7 +647,7 @@ void *timeshift_reader ( void *p ) i64 = tmp_file->last; tmp_file->refcount--; } else { - i64 = atomic_add_s64(&ts->last_time, 0); + i64 = ts->last_time; } cur_file = timeshift_filemgr_get(ts, i64); if (cur_file != NULL) { @@ -655,7 +655,7 @@ void *timeshift_reader ( void *p ) pause_time = cur_file->last; last_time = pause_time; } else { - pause_time = atomic_add_s64(&ts->last_time, 0); + pause_time = i64; last_time = pause_time; } pthread_mutex_unlock(&ts->rdwr_mutex); @@ -739,7 +739,7 @@ void *timeshift_reader ( void *p ) cur_file->roff = cur_file->size; last_time = cur_file->last; } else { - last_time = atomic_add_s64(&ts->last_time, 0); + last_time = ts->last_time; } skip_delivered = 0; pthread_mutex_unlock(&ts->rdwr_mutex); @@ -753,7 +753,7 @@ void *timeshift_reader ( void *p ) /* Live (stage2) */ if (ts->state == TS_LIVE) { - if (skip_time >= atomic_add_s64(&ts->last_time, 0) - TIMESHIFT_PLAY_BUF) { + if (skip_time >= ts->last_time - TIMESHIFT_PLAY_BUF) { tvhlog(LOG_DEBUG, "timeshift", "ts %d skip ignored, already live", ts->id); skip = NULL; } else {