}
static void
-timeshift_packet( timeshift_t *ts, th_pkt_t *pkt )
+timeshift_packet( timeshift_t *ts, streaming_message_t *sm )
{
- streaming_message_t *sm;
+ th_pkt_t *pkt = sm->sm_data;
int64_t time;
if (pkt->pkt_componentindex >= TIMESHIFT_BACKLOG_MAX)
return;
- sm = streaming_msg_create_pkt(pkt);
-
time = ts_rescale(pkt->pkt_pts, 1000000);
if (time > ts->last_time) {
ts->last_time = time;
{
int type = sm->sm_type;
timeshift_t *ts = opaque;
- th_pkt_t *pkt = sm->sm_data, *pkt2;
+ th_pkt_t *pkt, *pkt2;
/* Control */
if (type == SMT_SKIP) {
/* Change PTS/DTS offsets */
else if (ts->packet_mode && ts->start_pts && type == SMT_PACKET) {
+ pkt = sm->sm_data;
pkt2 = pkt_copy_shallow(pkt);
pkt_ref_dec(pkt);
- sm->sm_data = pkt = pkt2;
- pkt->pkt_pts += ts->start_pts;
- pkt->pkt_dts += ts->start_pts;
+ sm->sm_data = pkt2;
+ pkt2->pkt_pts += ts->start_pts;
+ pkt2->pkt_dts += ts->start_pts;
}
/* Check for exit */
if (ts->packet_mode) {
sm->sm_time = ts->last_wr_time;
if (type == SMT_PACKET) {
- timeshift_packet(ts, pkt);
- streaming_msg_free(sm);
+ timeshift_packet(ts, sm);
goto _exit;
}
} else {