Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000496 [Streamdev-Server] HTTP Streaming minor always 11-10-08 13:52 11-24-08 13:12
Reporter schmirl View Status public  
Assigned To schmirl
Priority normal Resolution fixed  
Status resolved  
Summary 0000496: Stream incompatible with Syabas PCH
Description http://www.linuxtv.org/pipermail/vdr/2008-November/018261.html [^]
Additional Information
Attached Files  patpmt_first_v4.diff [^] (4,531 bytes) 11-14-08 13:48
 patpmt_first_v5.diff [^] (3,804 bytes) 11-21-08 09:14

- Relationships

- Notes
(0000744)
schmirl
11-12-08 13:12

Problem could be that PMT must be broadcasted before actual stream data.

patpmt_first.diff is a crude hack to accomplish this. First packet will be the PAT. The patch doesn't guarantee that the PMT will be the second packet. The first PMT could even get filtered. A clean solution would send the PMT from within cStreamdevPatFilter::Process(). This however requires repacking and I don't want to do this without the ability to test if the packet is ok afterwards (I can't test ATM). Maybe someone can contribute a patch here.

If the PMT is filtered, try modifying

bool Syncing() const { return seen != (SI_PMT | SI_PAT); }

into

bool Syncing() const { return (seen & SI_PAT) == 0; }

So we only wait for the PAT to occur, PMT will not be the first packet, but it should show up earlier as without patch.
 
(0000747)
schmirl
11-12-08 15:34
edited on: 11-12-08 15:35

Refined patch patpmt_first_v2.diff guarantees that first packet is PAT, second is PMT. Untested!

 
(0000748)
schmirl
11-13-08 09:51

Previous patches didn't work. Patpmt_first_v3.diff hopefully fixes the problem (Untested!)
 
(0000750)
schmirl
11-14-08 14:02

patpmt_first_v4 fixes PMT generator
Minor fixes for PAT generator (reserved bits must be '1')
 
(0000751)
schmirl
11-18-08 08:43

Success with the following modifications on top of v4 patch:

*** Retransmit PAT (will give an other continuity error)
Two modifications in livestreamer.c: Around line 214, change

  if (Tid == 0x00 && !pmtPid) {
into
  if (Tid == 0x00) {
    int pmtPidBak = pmtPid;

And around line 275 change

  m_Streamer->SetPids(pmtPid);
  Add(pmtPid, 0x02);
  pmtVersion = -1;

into

  if (pmtPid != pmtPidBak) {
    m_Streamer->SetPids(pmtPid);
    Add(pmtPid, 0x02);
    pmtVersion = -1;
  }
 
(0000752)
rofafor
11-18-08 11:24

The pat repacker should utilize correct version number instead of zero:

--- livestreamer.c.orig 2008-11-18 12:23:51.000000000 +0200
+++ livestreamer.c 2008-11-18 12:26:24.000000000 +0200
@@ -250,7 +250,7 @@
                                 tspat_buf[7] = 12 + 1; // Section length (12 bit): PAT_TABLE_LEN + 1
                                 tspat_buf[8] = (ts_id >> 8); // Transport stream ID (bits 8-15)
                                 tspat_buf[9] = (ts_id & 0xff); // Transport stream ID (bits 0-7)
- tspat_buf[10] = 0xc1; // Version number 0, Current next indicator bit set
+ tspat_buf[10] = ((pat.getVersionNumber() << 1) & 0x3e) | 0xc1; // Version number, Current next indicator bit set
                                 tspat_buf[11] = 0x0; // Section number
                                 tspat_buf[12] = 0x0; // Last section number
                                 tspat_buf[13] = (pmtSid >> 8); // Program number (bits 8-15)
 
(0000753)
schmirl
11-18-08 11:39

Perfect - thanks. We should probably copy the current next indicator as well:

- tspat_buf[10] = 0xc1; // Version number 0, Current next indicator bit set
+ tspat_buf[10] = ((pat.getVersionNumber() << 1) & 0x3e) | pat.getCurrentNextIndicator() | 0xc0; // Version number, Current next indicator
 
(0000754)
rofafor
11-18-08 14:26

Ack for current next indicator modification, but I would move the "seen |= SI_PMT;" statement into inside of "if" block.
 
(0000755)
schmirl
11-18-08 14:34

That whole "seen" stuff was just a dirty hack to find out if PCH requires PAT/PMT at the very beginning of the stream. Odds are that this isn't necessary at all. Jori will test this tonight.
 
(0000756)
schmirl
11-21-08 09:19

Added patch v5 which contains the minimum changes I expect to be necessary (no feedback from Jori yet). With this patch the stream will no longer start with PAT and PMT. Basically all it does is send out a repacked PAT everytime one is received (plus some minor PAT fixups).

Added TS continuity counter to TS PAT packets:
+ static uint8_t ccounter = 0;
+ ccounter = (ccounter + 1) % 16;
...
+ tspat_buf[3] = 0x10 | ccounter; // Set payload flag, Continuity counter
 
(0000758)
schmirl
11-24-08 13:12

Commited
 

- Issue History
Date Modified Username Field Change
11-10-08 13:52 schmirl New Issue
11-12-08 12:42 schmirl File Added: patpmt_first.diff
11-12-08 12:58 schmirl File Deleted: patpmt_first.diff
11-12-08 12:59 schmirl File Added: patpmt_first.diff
11-12-08 13:12 schmirl Note Added: 0000744
11-12-08 13:12 schmirl Status new => feedback
11-12-08 15:34 schmirl File Added: patpmt_first_v2.diff
11-12-08 15:34 schmirl Note Added: 0000747
11-12-08 15:35 schmirl Note Edited: 0000747
11-13-08 09:49 schmirl File Added: patpmt_first_v3.diff
11-13-08 09:50 schmirl File Deleted: patpmt_first.diff
11-13-08 09:50 schmirl File Deleted: patpmt_first_v2.diff
11-13-08 09:51 schmirl Note Added: 0000748
11-14-08 13:48 schmirl File Added: patpmt_first_v4.diff
11-14-08 14:02 schmirl Note Added: 0000750
11-18-08 08:32 schmirl File Deleted: patpmt_first_v3.diff
11-18-08 08:43 schmirl Note Added: 0000751
11-18-08 11:24 rofafor Note Added: 0000752
11-18-08 11:39 schmirl Note Added: 0000753
11-18-08 14:26 rofafor Note Added: 0000754
11-18-08 14:34 schmirl Note Added: 0000755
11-21-08 09:14 schmirl File Added: patpmt_first_v5.diff
11-21-08 09:19 schmirl Note Added: 0000756
11-24-08 13:12 schmirl Status feedback => resolved
11-24-08 13:12 schmirl Resolution open => fixed
11-24-08 13:12 schmirl Assigned To  => schmirl
11-24-08 13:12 schmirl Note Added: 0000758
11-24-08 13:21 bdecord Issue Monitored: bdecord
11-24-08 13:21 bdecord Issue End Monitor: bdecord


Mantis 1.0.3[^]
Copyright © 2000 - 2006 Mantis Group
63 total queries executed.
37 unique queries executed.
Powered by Mantis Bugtracker