]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
timeshift: minor mod to htsp to flush output buffer on skip
authorAdam Sutton <dev@adamsutton.me.uk>
Thu, 7 Mar 2013 15:10:37 +0000 (15:10 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Thu, 7 Mar 2013 15:10:37 +0000 (15:10 +0000)
src/htsp_server.c
src/timeshift/timeshift_reader.c

index 7e5d8c0d2ba70cd88d54c3601df0d9b37652143c..3d0eb9cfcec996fdab9f18b4e7c4c067acd782fc 100644 (file)
@@ -267,6 +267,10 @@ htsp_flush_queue(htsp_connection_t *htsp, htsp_msg_q_t *hmq)
     TAILQ_REMOVE(&hmq->hmq_q, hm, hm_link);
     htsp_msg_destroy(hm);
   }
+
+  // reset
+  hmq->hmq_length = 0;
+  hmq->hmq_payload = 0;
   pthread_mutex_unlock(&htsp->htsp_out_mutex);
 }
 
@@ -2434,6 +2438,11 @@ htsp_subscription_skip(htsp_subscription_t *hs, streaming_skip_t *skip)
   htsmsg_t *m = htsmsg_create_map();
   htsmsg_add_str(m, "method", "subscriptionSkip");
   htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
+
+  /* Flush pkt buffers */
+  if (skip->type != SMT_SKIP_ERROR)
+    htsp_flush_queue(hs->hs_htsp, &hs->hs_q);
+
   if (skip->type == SMT_SKIP_ABS_TIME || skip->type == SMT_SKIP_ABS_SIZE)
     htsmsg_add_u32(m, "absolute", 1);
   if (skip->type == SMT_SKIP_ERROR)
index 1e9e54838dac35a10074a4c797363ae02de29278..1f9e739bfc53498317d6f3b8985aa12597cca51a 100644 (file)
@@ -545,7 +545,7 @@ void *timeshift_reader ( void *p )
 
               /* Convert */
               skip_time =  ts_rescale(skip->time, 1000000);
-              tvhlog(LOG_DEBUG, "timeshift", "ts %d skip %"PRId64" requested", ts->id, skip->time);
+              tvhlog(LOG_DEBUG, "timeshift", "ts %d skip %"PRId64" requested %"PRId64, ts->id, skip_time, skip->time);
 
               /* Live playback (stage1) */
               if (ts->state == TS_LIVE) {
@@ -562,7 +562,8 @@ void *timeshift_reader ( void *p )
 
               /* May have failed */
               if (skip) {
-                tvhlog(LOG_DEBUG, "timeshift", "ts %d skip last_time %"PRId64, ts->id, last_time);
+                tvhlog(LOG_DEBUG, "timeshift", "ts %d skip last_time %"PRId64" pts_delta %"PRId64,
+                       ts->id, last_time, ts->pts_delta);
                 skip_time += (skip->type == SMT_SKIP_ABS_TIME) ? ts->pts_delta : last_time;
 
                /* Live (stage2) */