Project

General

Profile

Bug #5722 » rstlog-ok.patch

Laurent H., 2019-12-14 13:45

View differences:

src/parsers/message.c
272 272
  tvhlog_limit_reset(&pes->es_pcr_log);
273 273
}
274 274

  
275
static void
276
parser_do_rstlog(parser_t *prs)
277
{
278
  streaming_message_t *sm;
279
  th_pkt_t *pkt;
280
  while ((sm = TAILQ_FIRST(&prs->prs_rstlog)) != NULL) {
281
    TAILQ_REMOVE(&prs->prs_rstlog, sm, sm_link);
282
    pkt = sm->sm_data;
283
    pkt_trace(LS_PARSER, pkt, "deliver from rstlog");
284
    streaming_target_deliver2(prs->prs_output, streaming_msg_create_pkt(pkt));
285
    sm->sm_data = NULL;
286
    streaming_msg_free(sm);
287
  }
288
}
289

  
275 290
/**
276 291
 *
277 292
 */
......
300 315
    prs->prs_pcr_boundary = 6*90000;
301 316

  
302 317
  streaming_target_deliver2(prs->prs_output, sm);
318
  /* do_rstlog */
319
  if (!TAILQ_EMPTY(&prs->prs_rstlog)) {
320
    parser_do_rstlog(prs);
321
  }
303 322
}
304 323

  
305 324
/**
......
359 378
  prs->prs_output = output;
360 379
  prs->prs_subscription = ts;
361 380
  prs->prs_service = t;
381
  TAILQ_INIT(&prs->prs_rstlog);
362 382
  elementary_set_init(&prs->prs_components, LS_PARSER, service_nicename(t), t);
363 383
  streaming_target_init(&prs->prs_input, &parser_input_ops, prs, 0);
364 384
  return &prs->prs_input;
......
374 394
  parser_t *prs = (parser_t *)pad;
375 395
  elementary_stream_t *es;
376 396
  parser_es_t *pes;
397
  streaming_queue_clear(&prs->prs_rstlog);
377 398

  
378 399
  TAILQ_FOREACH(es, &prs->prs_components.set_all, es_link) {
379 400
    pes = (parser_es_t *)es;
src/parsers/parsers.c
92 92
  st->es_buf.sb_err = 0;
93 93
}
94 94

  
95

  
96

  
97
/**
98
 * prs_rstlog
99
 */
100
static void
101
parser_rstlog(parser_t *t, th_pkt_t *pkt)
102
{
103
  streaming_message_t *sm = streaming_msg_create_pkt(pkt);
104
  pkt_ref_dec(pkt); /* streaming_msg_create_pkt increses ref counter */
105
  streaming_message_t *clone = streaming_msg_clone(sm);
106
  TAILQ_INSERT_TAIL (&t->prs_rstlog, clone, sm_link);
107
}
108

  
95 109
/**
96 110
 *
97 111
 */
......
127 141
deliver:
128 142
  pkt->pkt_componentindex = st->es_index;
129 143

  
130
  pkt_trace(LS_PARSER, pkt, "deliver");
131

  
132 144
  if (SCT_ISVIDEO(pkt->pkt_type)) {
133 145
    pkt->v.pkt_aspect_num = st->es_aspect_num;
134 146
    pkt->v.pkt_aspect_den = st->es_aspect_den;
135 147
  }
136 148

  
137 149
  /* Forward packet */
138
  streaming_target_deliver2(t->prs_output, streaming_msg_create_pkt(pkt));
150
  if(atomic_get(&st->es_service->s_pending_restart) == 1) {
151
    /* Queue pkt to prs_rstlog if pending restart */
152
    pkt_trace(LS_PARSER, pkt, "deliver to rstlog");
153
    parser_rstlog(t, pkt);
154
  } else {
155
    pkt_trace(LS_PARSER, pkt, "deliver");
156
    streaming_target_deliver2(t->prs_output, streaming_msg_create_pkt(pkt));
157
  }
139 158

  
140 159
  /* Decrease our own reference to the packet */
141 160
  pkt_ref_dec(pkt);
src/parsers/parsers.h
98 98
  commercial_advice_t prs_tt_commercial_advice;
99 99
  time_t prs_tt_clock;   /* Network clock as determined by teletext decoder */
100 100

  
101
  /* restart_pending log */
102
  struct streaming_message_queue prs_rstlog;
101 103
};
102 104

  
103 105
static inline int64_t
(5-5/5)