timeshift: minor mod to htsp to flush output buffer on skip

This commit is contained in:
Adam Sutton 2013-03-07 15:10:37 +00:00
parent 5d8af1a209
commit c862269c62
2 changed files with 12 additions and 2 deletions

View 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)

View 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) */