mkv: make sure the first cluster timecode is 'close to zero'.
when recording to disk, the subscription is started ~30s before the scheduled event actually starts. This causes the pts time stamps to have an offset of about 30s. This patch moves the start time filter condition from the end of the pipeline to be a configurable property of the tsfix pipe.
This commit is contained in:
parent
0b7ac3ff01
commit
ca68f94304
3 changed files with 18 additions and 5 deletions
|
@ -81,6 +81,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
|
|||
streaming_queue_init(&de->de_sq, 0);
|
||||
de->de_gh = globalheaders_create(&de->de_sq.sq_st);
|
||||
de->de_tsfix = tsfix_create(de->de_gh);
|
||||
tsfix_set_start_time(de->de_tsfix, de->de_start - (60 * de->de_start_extra));
|
||||
st = de->de_tsfix;
|
||||
flags = 0;
|
||||
}
|
||||
|
@ -419,10 +420,8 @@ dvr_thread(void *aux)
|
|||
switch(sm->sm_type) {
|
||||
case SMT_MPEGTS:
|
||||
case SMT_PACKET:
|
||||
if(started &&
|
||||
dispatch_clock > de->de_start - (60 * de->de_start_extra)) {
|
||||
if(started) {
|
||||
dvr_rec_set_state(de, DVR_RS_RUNNING, 0);
|
||||
|
||||
muxer_write_pkt(de->de_mux, sm->sm_type, sm->sm_data);
|
||||
sm->sm_data = NULL;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ typedef struct tsfix {
|
|||
struct tfstream_list tf_streams;
|
||||
int tf_hasvideo;
|
||||
int64_t tf_tsref;
|
||||
time_t tf_start_time;
|
||||
|
||||
struct th_pktref_queue tf_ptsq;
|
||||
|
||||
|
@ -309,12 +310,11 @@ tsfix_input_packet(tsfix_t *tf, streaming_message_t *sm)
|
|||
tfstream_t *tfs = tfs_find(tf, pkt);
|
||||
streaming_msg_free(sm);
|
||||
|
||||
if(tfs == NULL) {
|
||||
if(tfs == NULL || dispatch_clock < tf->tf_start_time) {
|
||||
pkt_ref_dec(pkt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(tf->tf_tsref == PTS_UNSET &&
|
||||
(!tf->tf_hasvideo ||
|
||||
(SCT_ISVIDEO(tfs->tfs_type) && pkt->pkt_frametype == PKT_I_FRAME))) {
|
||||
|
@ -387,10 +387,22 @@ tsfix_create(streaming_target_t *output)
|
|||
TAILQ_INIT(&tf->tf_ptsq);
|
||||
|
||||
tf->tf_output = output;
|
||||
tf->tf_start_time = dispatch_clock;
|
||||
|
||||
streaming_target_init(&tf->tf_input, tsfix_input, tf, 0);
|
||||
return &tf->tf_input;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void tsfix_set_start_time(streaming_target_t *pad, time_t start)
|
||||
{
|
||||
tsfix_t *tf = (tsfix_t *)pad;
|
||||
|
||||
tf->tf_start_time = start;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
streaming_target_t *tsfix_create(streaming_target_t *output);
|
||||
|
||||
void tsfix_set_start_time(streaming_target_t *pad, time_t start);
|
||||
|
||||
void tsfix_destroy(streaming_target_t *gh);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue