Project

General

Profile

Bug #900 » 0002-Fix-missing-PAT-PMT-packets-in-MPEG-TS.patch

Zdeněk Kopřivík, 2012-06-07 02:29

View differences:

src/dvr/dvr_rec.c 2012-06-07 01:42:39.000000000 +0200 → src/dvr/dvr_rec.c 2012-06-07 01:40:04.000000000 +0200
424 424
  dvr_config_t *cfg = dvr_config_find_by_name_default(de->de_config_name);
425 425
  streaming_tsbuf_t pat_pmt_tsbuf;
426 426
  struct mk_ts_pat_pmt pat_pmt_buf;
427
  int ts_packets_cnt = 1000;
427
  uint32_t ts_packets_cnt = 1000;
428
  uint8_t pat_pmt_packets_cnt = 0;
428 429
  int run = 1;
429 430

  
430 431
  pthread_mutex_lock(&sq->sq_mutex);
......
460 461
      if (strcmp(cfg->dvr_format, "mpegts") == 0) {
461 462
        struct streaming_start *ss = sm->sm_data;
462 463
        run = mk_ts_build_pat_pmt(&pat_pmt_buf, ss, de->de_s->ths_service->s_pmt_pid, de->de_s->ths_service->s_pcr_pid);
463

  
464 464
        pat_pmt_tsbuf.ts_data = (uint8_t *)&pat_pmt_buf;
465 465
        pat_pmt_tsbuf.ts_cnt = 2;
466 466
      }
......
541 541
        if(de->de_mkts != NULL) {
542 542
          streaming_tsbuf_t *tsbuf = sm->sm_data;
543 543

  
544
          ts_packets_cnt += tsbuf->ts_cnt;
545 544
          if(ts_packets_cnt >= 1000) {
546 545
            ts_packets_cnt = 0;
546

  
547
            pat_pmt_buf.pat_ts[3] = (pat_pmt_buf.pat_ts[3] & 0xf0) | (pat_pmt_packets_cnt & 0x0f);
548
            pat_pmt_buf.pmt_ts[3] = (pat_pmt_buf.pmt_ts[3] & 0xf0) | (pat_pmt_packets_cnt & 0x0f);
549
            pat_pmt_packets_cnt++;
550

  
547 551
            mk_ts_write(de->de_mkts, &pat_pmt_tsbuf);
548 552
          }
553
          ts_packets_cnt += tsbuf->ts_cnt;
549 554

  
550 555
          mk_ts_write(de->de_mkts, tsbuf);
551 556
        }
src/webui/webui.c 2012-06-07 01:41:55.000000000 +0200 → src/webui/webui.c 2012-06-07 01:40:04.000000000 +0200
134 134
  streaming_message_t *sm;
135 135
  mk_mux_t *mkm = NULL;
136 136
  struct mk_ts_pat_pmt pat_pmt_buf;
137
  int ts_packets_cnt = 1000;
137
  uint32_t ts_packets_cnt = 1000;
138
  uint8_t pat_pmt_packets_cnt = 0;
138 139
  int run = 1;
139 140
  int timeouts = 0;
140 141
  uint32_t event_id = 0;
......
237 238
        streaming_tsbuf_t *tsbuf = sm->sm_data;
238 239
        uint32_t size = tsbuf->ts_cnt * 188;
239 240

  
240
        ts_packets_cnt += tsbuf->ts_cnt;
241 241
        if (ts_packets_cnt >= 1000) {
242 242
          ts_packets_cnt = 0;
243

  
244
          pat_pmt_buf.pat_ts[3] = (pat_pmt_buf.pat_ts[3] & 0xf0) | (pat_pmt_packets_cnt & 0x0f);
245
          pat_pmt_buf.pmt_ts[3] = (pat_pmt_buf.pmt_ts[3] & 0xf0) | (pat_pmt_packets_cnt & 0x0f);
246
          pat_pmt_packets_cnt++;
247

  
243 248
          run = write(hc->hc_fd, pat_pmt_buf.pat_ts, 188) == 188;
244 249
          run = write(hc->hc_fd, pat_pmt_buf.pmt_ts, 188) == 188;
245 250
        }
251
        ts_packets_cnt += tsbuf->ts_cnt;
246 252

  
247 253
        if(!run)
248 254
          break;
(8-8/8)