Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPEG TS output doesn't appear to continue sending PAT and PMT #1052

Open
brilthor opened this issue Apr 20, 2024 · 2 comments
Open

MPEG TS output doesn't appear to continue sending PAT and PMT #1052

brilthor opened this issue Apr 20, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@brilthor
Copy link

When pulling a TS output stream (http://go2rtc:1984/api/stream.ts?src=hdpvr) it looks like the PAT and PMT only get sent at the start as opposed to at least every 100ms.

I took a dive into the code and it looks like

func (m *Muxer) GetHeader() []byte {
	bw := bits.NewWriter(nil)
	m.writePAT(bw)
	m.writePMT(bw)
	return bw.Bytes()
}

is the only time the writePAT and writePMT get called and that in turn is only called at the initial consumer response:

func (c *Consumer) WriteTo(wr io.Writer) (int64, error) {
	b := c.muxer.GetHeader()
	if _, err := wr.Write(b); err != nil {
		return 0, err
	}

	return c.wr.WriteTo(wr)
}

this appears to be backed up by analyzing the output:

===============================================================================
|  TABLES & SECTIONS ANALYSIS REPORT                                          |
|=============================================================================|
|  PID: 0x0000 (0)                                                       PAT  |
|-----------------------------------------------------------------------------|
|  0x00 (0, PAT)                                                              |
|      Repetition: ...... 0  pkt  Section cnt: ....... 55                     |
|      Min repet.: ...... 0  pkt                                              |
|      Max repet.: ...... 0  pkt                                              |
|-----------------------------------------------------------------------------|
|  0x00 (0, PAT), TID ext: 0x0001 (1)                                         |
|      Repetition: ...... 0  pkt  Section cnt: ........ 1                     |
|      Min repet.: ...... 0  pkt  Table cnt: .......... 1                     |
|      Max repet.: ...... 0  pkt  Version: ............ 0                     |
|=============================================================================|
|  PID: 0x1000 (4096)                                                    PMT  |
|  Service: 0x0001 (1) (unknown)                                              |
|-----------------------------------------------------------------------------|
|  0x00 (0, PAT)                                                              |
|      Repetition: ...... 0  pkt  Section cnt: ....... 52                     |
|      Min repet.: ...... 0  pkt                                              |
|      Max repet.: ...... 0  pkt                                              |
|-----------------------------------------------------------------------------|
|  0x02 (2, PMT), TID ext: 0x0001 (1)                                         |
|      Repetition: ...... 0  pkt  Section cnt: ........ 1                     |
|      Min repet.: ...... 0  pkt  Table cnt: .......... 1                     |
|      Max repet.: ...... 0  pkt  Version: ............ 0                     |
===============================================================================

vs from an ATSC TS via hdhr

===============================================================================
|  TABLES & SECTIONS ANALYSIS REPORT                                          |
|=============================================================================|
|  PID: 0x0000 (0)                                                       PAT  |
|-----------------------------------------------------------------------------|
|  0x00 (0, PAT), TID ext: 0x4329 (17193)                                     |
|      Repetition: ...... 74  ms  Section cnt: ...... 135                     |
|      Min repet.: ....... 0  ms  Table cnt: ........ 135                     |
|      Max repet.: ...... 76  ms  Version: ............ 0                     |
|=============================================================================|
|  PID: 0x0030 (48)                                                      PMT  |
|  Service: 0x0003 (3) (unknown)                                              |
|-----------------------------------------------------------------------------|
|  0x02 (2, PMT), TID ext: 0x0003 (3)                                         |
|      Repetition: ..... 375  ms  Section cnt: ....... 27                     |
|      Min repet.: ..... 373  ms  Table cnt: ......... 27                     |
|      Max repet.: ..... 378  ms  Version: ........... 26                     |
===============================================================================

@AlexxIT AlexxIT added the question Further information is requested label Apr 20, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 20, 2024

Which software need to send PAT and PMT regularly? Go2rtc implements a modern version of stream handling.

@brilthor
Copy link
Author

I came across the issue while trying to debug why tvheadend was saying it was an failed scan / invalid stream

@AlexxIT AlexxIT added enhancement New feature or request and removed question Further information is requested labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants