]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
timeshift: remove atomic ops for ts->last_time, variable is protected using state_mutex
authorJaroslav Kysela <perex@perex.cz>
Sat, 2 Jan 2016 19:25:53 +0000 (20:25 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 2 Jan 2016 19:25:53 +0000 (20:25 +0100)
src/timeshift.c
src/timeshift/timeshift_reader.c

index 1b712ad5dffac6c9d54fcb254bdaaf809cd5251b..987fa81db92725d09ddea119dcaee496d75c05b8 100644 (file)
@@ -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);
   }
 
index c046402369d8339e19bfd3efd37538b34d6b5555..9024df9e964732aa82b2e8a03c84550392061972 100644 (file)
@@ -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 {