Bug #4789
PCR issue for IPTV
0%
Description
Hi,
I discovered the cause why the TS-FILE config isn't stored in the configuration: the function iptv_mux_config_save() is empty
We need this enabled for saving the SAT>IP frequency when applying #4784.
I feel this function isn't fully implemented because the TS-FILE is only enabled (at time) using the command-line. However, until this input will be enhanced, a simple map like TSFILE1, TSFILE2, etc. based on the apperance order in the commandline will be sufficient.
You agree?
History
Updated by Mono Polimorph almost 7 years ago
Hi Jarsolav,
I see another function that has an empty implementation:
https://github.com/tvheadend/tvheadend/blob/817f67e7b5d54a05d04ec2766ba1487a58337e1c/src/input/mpegts/tsfile/tsfile.c#L37
Regarding the "command-line only" support for TS-Files, I like to know your opinion:
- You agree to add to the General/Config section an entry for storing the value of "--tsfile_tuners". Then enable the option to manually adding muxers of TSFiles implementing the same behaviour of "--tsfile"?
The idea is go ahead and convert the current TSFile support in a mainstream functionality.
Please, comment your opinion about this.
Regards.
Updated by Mono Polimorph almost 7 years ago
Hi Jaroslav,
Now I see that this "class" of TSFile Input is only for debug. The IPTV network has one implementation for the "file://" handler. So, it's not needed to implement the config save for this class.
However, I have another problem: Using the TSFile Input using a testing .TS file (recorded from a broadcast multiplex removing only the NULL packet stuff) all works great. However, when I create a mux in my IPTV network and I add this file (URL as "file:///home/user/test1.ts"), it doesn't play! Not with HTTP or SAT>IP protocols. The mux can be scanned and the services are listed. However, when I want to play it I see this in the log (enabling full trace of iptv):
2017-12-13 14:08:02.023 [ TRACE]:iptv-pcr: pcr: last 5713734603, time end 172906319331 2017-12-13 14:08:02.023 [ TRACE]:iptv-pcr: pcr: last 5713738390, time end 172906361408 2017-12-13 14:08:02.024 [ TRACE]:iptv-pcr: pcr: last 5713744544, time end 172906429786 2017-12-13 14:08:02.024 [ TRACE]:iptv-pcr: pcr: last 5713748332, time end 172906471875 2017-12-13 14:08:02.025 [ TRACE]:iptv-pcr: pcr: last 5713754486, time end 172906540253 2017-12-13 14:08:02.025 [ TRACE]:iptv-pcr: pcr: last 5713760647, time end 172906608708 2017-12-13 14:08:02.025 [ TRACE]:iptv-pcr: pcr: last 5713764427, time end 172906650708 2017-12-13 14:08:02.025 [ TRACE]:iptv-pcr: pcr: last 5713770581, time end 172906719086 2017-12-13 14:08:02.026 [ TRACE]:iptv-pcr: pcr: paused
And the file doesn't play. You know why?
Updated by Mono Polimorph almost 7 years ago
Hi Jaroslav,
The problem seems to be this: when reading the file the buffer fills and the PCR triggers a pause. However, after the client starts to read from the network, the "un-pause" command never arrives.
See this log:
2017-12-13 14:41:01.475 [ INFO]:subscription: 003D: "HTTP" subscribing to mux "test1-ts", weight: 10, adapter: "IPTV", network: "IPTV-LOCAL", service: "Raw PID Subscription", hostname="127.0.0.1", client="VLC/2.2.6 LibVLC/2.2.6" 2017-12-13 14:41:01.475 [ TRACE]:subscription: 003D: chain 01: input 2017-12-13 14:41:01.475 [ TRACE]:subscription: 003D: chain 02: streaming queue 0x7fd490fe6588 size 0 2017-12-13 14:41:01.486 [ TRACE]:iptv-pcr: pcr: first 5713310844 last 5713314631, time start 174881112687, end 174881154770 2017-12-13 14:41:01.487 [ TRACE]:iptv-pcr: pcr: updated 5713311203, time start 174881116686, limit 5000000 2017-12-13 14:41:01.487 [ TRACE]:iptv-pcr: pcr: last 5713316998, time end 174881181080 2017-12-13 14:41:01.490 [ TRACE]:iptv-pcr: pcr: last 5713323158, time end 174881249524 2017-12-13 14:41:01.490 [ TRACE]:iptv-pcr: pcr: updated 5713311563, time start 174881120686, limit 5000000 2017-12-13 14:41:01.491 [ TRACE]:iptv-pcr: pcr: last 5713326946, time end 174881291613 2017-12-13 14:41:01.491 [ TRACE]:iptv-pcr: pcr: last 5713333100, time end 174881359991 2017-12-13 14:41:01.491 [ TRACE]:iptv-pcr: pcr: last 5713339254, time end 174881428369 2017-12-13 14:41:01.491 [ TRACE]:iptv-pcr: pcr: last 5713343042, time end 174881470458 2017-12-13 14:41:01.492 [ TRACE]:iptv-pcr: pcr: last 5713349202, time end 174881538902 2017-12-13 14:41:01.492 [ TRACE]:iptv-pcr: pcr: last 5713355349, time end 174881607202 2017-12-13 14:41:01.492 [ TRACE]:iptv-pcr: pcr: last 5713359137, time end 174881649291 2017-12-13 14:41:01.493 [ TRACE]:iptv-pcr: pcr: last 5713365291, time end 174881717669 2017-12-13 14:41:01.493 [ TRACE]:iptv-pcr: pcr: last 5713369561, time end 174881765113 2017-12-13 14:41:01.493 [ TRACE]:iptv-pcr: pcr: last 5713375715, time end 174881833491 2017-12-13 14:41:01.494 [ TRACE]:iptv-pcr: pcr: last 5713379027, time end 174881870291 2017-12-13 14:41:01.494 [ TRACE]:iptv-pcr: pcr: updated 5713311923, time start 174881124686, limit 5000000 2017-12-13 14:41:01.495 [ TRACE]:iptv-pcr: pcr: last 5713385650, time end 174881943880 2017-12-13 14:41:01.495 [ TRACE]:iptv-pcr: pcr: last 5713391811, time end 174882012336 2017-12-13 14:41:01.495 [ TRACE]:iptv-pcr: pcr: last 5713395122, time end 174882049124 2017-12-13 14:41:01.495 [ TRACE]:iptv-pcr: pcr: last 5713401752, time end 174882122791 2017-12-13 14:41:01.496 [ TRACE]:iptv-pcr: pcr: last 5713404119, time end 174882149091 2017-12-13 14:41:01.497 [ TRACE]:iptv-pcr: pcr: last 5713411218, time end 174882227969 2017-12-13 14:41:01.497 [ TRACE]:iptv-pcr: pcr: last 5713414067, time end 174882259624 2017-12-13 14:41:01.497 [ TRACE]:iptv-pcr: pcr: last 5713420221, time end 174882328002 2017-12-13 14:41:01.498 [ TRACE]:iptv-pcr: pcr: last 5713427320, time end 174882406880 2017-12-13 14:41:01.498 [ TRACE]:iptv-pcr: pcr: last 5713430156, time end 174882438391 2017-12-13 14:41:01.498 [ TRACE]:iptv-pcr: pcr: updated 5713312283, time start 174881128686, limit 5000000 2017-12-13 14:41:01.499 [ TRACE]:iptv-pcr: pcr: last 5713436316, time end 174882506836 2017-12-13 14:41:01.499 [ TRACE]:iptv-pcr: pcr: last 5713440104, time end 174882548924 2017-12-13 14:41:01.500 [ TRACE]:iptv-pcr: pcr: last 5713446734, time end 174882622591 2017-12-13 14:41:01.500 [ TRACE]:iptv-pcr: pcr: last 5713452888, time end 174882690969 2017-12-13 14:41:01.500 [ TRACE]:iptv-pcr: pcr: last 5713456675, time end 174882733047 2017-12-13 14:41:01.500 [ TRACE]:iptv-pcr: pcr: last 5713462829, time end 174882801424 2017-12-13 14:41:01.503 [ TRACE]:iptv-pcr: pcr: updated 5713312643, time start 174881132686, limit 5000000 2017-12-13 14:41:01.504 [ TRACE]:iptv-pcr: pcr: last 5713466617, time end 174882843513 2017-12-13 14:41:01.504 [ TRACE]:iptv-pcr: pcr: last 5713472771, time end 174882911891 2017-12-13 14:41:01.504 [ TRACE]:iptv-pcr: pcr: last 5713476082, time end 174882948680 2017-12-13 14:41:01.504 [ TRACE]:iptv-pcr: pcr: last 5713482719, time end 174883022424 2017-12-13 14:41:01.505 [ TRACE]:iptv-pcr: pcr: last 5713488873, time end 174883090802 2017-12-13 14:41:01.505 [ TRACE]:iptv-pcr: pcr: last 5713492185, time end 174883127602 2017-12-13 14:41:01.506 [ TRACE]:iptv-pcr: pcr: last 5713498815, time end 174883201269 2017-12-13 14:41:01.506 [ TRACE]:iptv-pcr: pcr: last 5713501181, time end 174883227558 2017-12-13 14:41:01.507 [ TRACE]:iptv-pcr: pcr: updated 5713313003, time start 174881136686, limit 5000000 2017-12-13 14:41:01.507 [ TRACE]:iptv-pcr: pcr: last 5713508763, time end 174883311802 2017-12-13 14:41:01.507 [ TRACE]:iptv-pcr: pcr: last 5713511599, time end 174883343313 2017-12-13 14:41:01.508 [ TRACE]:iptv-pcr: pcr: last 5713517753, time end 174883411691 2017-12-13 14:41:01.508 [ TRACE]:iptv-pcr: pcr: last 5713524852, time end 174883490569 2017-12-13 14:41:01.509 [ TRACE]:iptv-pcr: pcr: last 5713527694, time end 174883522147 2017-12-13 14:41:01.509 [ TRACE]:iptv-pcr: pcr: last 5713533855, time end 174883590602 2017-12-13 14:41:01.509 [ TRACE]:iptv-pcr: pcr: last 5713537636, time end 174883632613 2017-12-13 14:41:01.510 [ TRACE]:iptv-pcr: pcr: last 5713543790, time end 174883700991 2017-12-13 14:41:01.511 [ TRACE]:iptv-pcr: pcr: updated 5713313363, time start 174881140686, limit 5000000 2017-12-13 14:41:01.511 [ TRACE]:iptv-pcr: pcr: last 5713549944, time end 174883769369 2017-12-13 14:41:01.511 [ TRACE]:iptv-pcr: pcr: last 5713553738, time end 174883811524 2017-12-13 14:41:01.511 [ TRACE]:iptv-pcr: pcr: last 5713559892, time end 174883879902 2017-12-13 14:41:01.511 [ TRACE]:iptv-pcr: pcr: last 5713566046, time end 174883948280 2017-12-13 14:41:01.514 [ TRACE]:iptv-pcr: pcr: last 5713570303, time end 174883995580 2017-12-13 14:41:01.514 [ TRACE]:iptv-pcr: pcr: updated 5713313723, time start 174881144686, limit 5000000 2017-12-13 14:41:01.514 [ TRACE]:iptv-pcr: pcr: last 5713576463, time end 174884064024 2017-12-13 14:41:01.514 [ TRACE]:iptv-pcr: pcr: last 5713580251, time end 174884106113 2017-12-13 14:41:01.515 [ TRACE]:iptv-pcr: pcr: last 5713586405, time end 174884174491 2017-12-13 14:41:01.516 [ TRACE]:iptv-pcr: pcr: last 5713589716, time end 174884211280 2017-12-13 14:41:01.516 [ TRACE]:iptv-pcr: pcr: last 5713596346, time end 174884284947 2017-12-13 14:41:01.516 [ TRACE]:iptv-pcr: pcr: last 5713598720, time end 174884311324 2017-12-13 14:41:01.516 [ TRACE]:iptv-pcr: pcr: last 5713605819, time end 174884390202 2017-12-13 14:41:01.518 [ TRACE]:iptv-pcr: pcr: last 5713608661, time end 174884421780 2017-12-13 14:41:01.518 [ TRACE]:iptv-pcr: pcr: last 5713614815, time end 174884490158 2017-12-13 14:41:01.518 [ TRACE]:iptv-pcr: pcr: last 5713621445, time end 174884563824 2017-12-13 14:41:01.518 [ TRACE]:iptv-pcr: pcr: last 5713624763, time end 174884600691 2017-12-13 14:41:01.520 [ TRACE]:iptv-pcr: pcr: updated 5713314083, time start 174881148686, limit 5000000 2017-12-13 14:41:01.520 [ TRACE]:iptv-pcr: pcr: last 5713630910, time end 174884668991 2017-12-13 14:41:01.520 [ TRACE]:iptv-pcr: pcr: last 5713637540, time end 174884742658 2017-12-13 14:41:01.520 [ TRACE]:iptv-pcr: pcr: last 5713640852, time end 174884779458 2017-12-13 14:41:01.520 [ TRACE]:iptv-pcr: pcr: last 5713647482, time end 174884853124 2017-12-13 14:41:01.522 [ TRACE]:iptv-pcr: pcr: last 5713651270, time end 174884895213 2017-12-13 14:41:01.522 [ TRACE]:iptv-pcr: pcr: last 5713657430, time end 174884963658 2017-12-13 14:41:01.522 [ TRACE]:iptv-pcr: pcr: last 5713661211, time end 174885005669 2017-12-13 14:41:01.522 [ TRACE]:iptv-pcr: pcr: last 5713667379, time end 174885074202 2017-12-13 14:41:01.523 [ TRACE]:iptv-pcr: pcr: updated 5713314442, time start 174881152685, limit 5000000 2017-12-13 14:41:01.523 [ TRACE]:iptv-pcr: pcr: last 5713673526, time end 174885142512 2017-12-13 14:41:01.523 [ TRACE]:iptv-pcr: pcr: last 5713677313, time end 174885184590 2017-12-13 14:41:01.523 [ TRACE]:iptv-pcr: pcr: last 5713683467, time end 174885252968 2017-12-13 14:41:01.523 [ TRACE]:iptv-pcr: pcr: last 5713686303, time end 174885284479 2017-12-13 14:41:01.526 [ TRACE]:iptv-pcr: pcr: last 5713693409, time end 174885363435 2017-12-13 14:41:01.526 [ TRACE]:iptv-pcr: pcr: last 5713695775, time end 174885389723 2017-12-13 14:41:01.526 [ TRACE]:iptv-pcr: pcr: updated 5713314802, time start 174881156685, limit 5000000 2017-12-13 14:41:01.526 [ TRACE]:iptv-pcr: pcr: last 5713702405, time end 174885463390 2017-12-13 14:41:01.526 [ TRACE]:iptv-pcr: pcr: last 5713706193, time end 174885505479 2017-12-13 14:41:01.529 [ TRACE]:iptv-pcr: pcr: last 5713712353, time end 174885573923 2017-12-13 14:41:01.529 [ TRACE]:iptv-pcr: pcr: last 5713718507, time end 174885642301 2017-12-13 14:41:01.529 [ TRACE]:iptv-pcr: pcr: last 5713722288, time end 174885684312 2017-12-13 14:41:01.529 [ TRACE]:iptv-pcr: pcr: last 5713728442, time end 174885752690 2017-12-13 14:41:01.531 [ TRACE]:iptv-pcr: pcr: updated 5713315162, time start 174881160685, limit 5000000 2017-12-13 14:41:01.531 [ TRACE]:iptv-pcr: pcr: last 5713734603, time end 174885821146 2017-12-13 14:41:01.531 [ TRACE]:iptv-pcr: pcr: last 5713738390, time end 174885863223 2017-12-13 14:41:01.531 [ TRACE]:iptv-pcr: pcr: last 5713744544, time end 174885931601 2017-12-13 14:41:01.531 [ TRACE]:iptv-pcr: pcr: last 5713748332, time end 174885973690 2017-12-13 14:41:01.532 [ TRACE]:iptv-pcr: pcr: last 5713754486, time end 174886042068 2017-12-13 14:41:01.532 [ TRACE]:iptv-pcr: pcr: last 5713760647, time end 174886110523 2017-12-13 14:41:01.532 [ TRACE]:iptv-pcr: pcr: last 5713764427, time end 174886152523 2017-12-13 14:41:01.532 [ TRACE]:iptv-pcr: pcr: last 5713770581, time end 174886220901 2017-12-13 14:41:01.532 [ TRACE]:iptv-pcr: pcr: paused 2017-12-13 14:41:09.883 [ INFO]:subscription: 003D: "HTTP" unsubscribing, hostname="127.0.0.1", client="VLC/2.2.6 LibVLC/2.2.6" 2017-12-13 14:41:09.883 [ DEBUG]:mpegts: test1-ts in IPTV-LOCAL - close PID fullmux subscription [0003/0x7fd49de1edf0] 2017-12-13 14:41:09.883 [ DEBUG]:mpegts: test1-ts in IPTV-LOCAL - stopping mux
Using the same TS file, streamed as RTP with a tool, and getting it from the multicast address I don't see any problem. So the problem seems to be the "PCR pause".
Can you help me to fix this problem?
Thank you!
Updated by Jaroslav Kysela almost 7 years ago
Something does not work, there's while loop in src/input/mpegts/iptv/iptv_file.c:
while (!fp->shutdown && pause) { mono = mclk() + sec2mono(1); do { e = tvh_cond_timedwait(&fp->cond, &iptv_lock, mono); if (e == ETIMEDOUT) break; } while (ERRNO_AGAIN(e)); }
This loop should end after one seconds (normally) and then new read data should be passed to iptv_input_recv_packets(). There's called iptv_input_pause_check() which should update PCR clocks.
Updated by Mono Polimorph almost 7 years ago
Jaroslav Kysela wrote:
Something does not work, there's while loop in src/input/mpegts/iptv/iptv_file.c:
[...]
This loop should end after one seconds (normally) and then new read data should be passed to iptv_input_recv_packets(). There's called iptv_input_pause_check() which should update PCR clocks.
I'll do another test. However, I feel something is wrong... it "scans" but doesn't "play".
Regards.
Updated by Mono Polimorph almost 7 years ago
Jaroslav Kysela wrote:
Something does not work
Hi Jaroslav,
Checking the differences between the thread_loop in "src/input/mpegts/iptv/iptv_file.c" and "src/input/mpegts/tsfile/tsfile_input.c" I see some differences. For example:
- TSFile tries to get the PCR pid of the TS. I feel IPTVFile doesn't.
- TSFile uses the generic "mpegts_input_recv_packets()" function to put the data in the buffer (like do the satip and hdhomerun modules). However, the IPTVFile uses the "iptv_input_recv_packets()" (like do the http module).
One thing that I noted after reviewing the code is that I'm using a MPTS (broadcast recording), and not a SPTS, as a input file. I feel the code is based on the assumption of one A/V stream with one PCR. You think that this can be the problem?
Regards!
Updated by Jaroslav Kysela almost 7 years ago
iptv_input_recv_packets() calls mpegts_input_recv_packets(); the problem is described in my commment number 4. The iptv_input_recv_packets() should be called after one second delay when the pause is activated.
Updated by Mono Polimorph almost 7 years ago
Hi Jaroslav,
I see that two different traces prints the same:
For a best debug, I suggest you change the first to "pcr: paused (pre-check)" and the second to "pcr: paused (post-check)".
Futhermore, I need to know (for fixing the problem) whats does this code between both checks. Please, can you explain what represents "pcr.pcr_first, pcr.pcr_last, im->im_pcr_start, im->im_pcr_end" ?
Thank you!
Updated by Mono Polimorph almost 7 years ago
Hi Jaroslav,
This is very annoying: I created another test file with all pids, but with only one program (removing all other pids of other programs: PMT and AV elementary streams, plus the NULL stuff). However, the problem continues: I can't play it because the "second" (post-check) is triggered.
Please, you have any idea why this refuses to play?
Futhermore, another trouble. In the configuration of the mux I set the value "Service ID:" to the SID of the program in the TS. However, when streaming I receive a complete PAT. This is normal?
Updated by Jaroslav Kysela almost 7 years ago
Mono Polimorph wrote:
Futhermore, I need to know (for fixing the problem) whats does this code between both checks. Please, can you explain what represents "pcr.pcr_first, pcr.pcr_last, im->im_pcr_start, im->im_pcr_end" ?
The pcr structure contains first and last PCR from the passed MPEG-TS data. The im_pcr_start+end represents PCR times for already sent data to input. Thus end-start means the total queued time.
Updated by Jaroslav Kysela almost 7 years ago
Mono Polimorph wrote:
Futhermore, another trouble. In the configuration of the mux I set the value "Service ID:" to the SID of the program in the TS. However, when streaming I receive a complete PAT. This is normal?
You probably do not use the correct profile. If rewrite PAT is set it, the PAT is completely replaced.
Updated by Mono Polimorph almost 7 years ago
Jaroslav Kysela wrote:
Mono Polimorph wrote:
Futhermore, another trouble. In the configuration of the mux I set the value "Service ID:" to the SID of the program in the TS. However, when streaming I receive a complete PAT. This is normal?
You probably do not use the correct profile. If rewrite PAT is set it, the PAT is completely replaced.
Hi,
As I use only pure TS streams, and HTTP+SAT>IP outputs for the IPTV-File input, I only have enabled the "pass" profile. Futhermore, as I know profiles aren't used in this scenario. It's this true?
Updated by Mono Polimorph almost 7 years ago
Jaroslav Kysela wrote:
Mono Polimorph wrote:
Futhermore, I need to know (for fixing the problem) whats does this code between both checks. Please, can you explain what represents "pcr.pcr_first, pcr.pcr_last, im->im_pcr_start, im->im_pcr_end" ?
The pcr structure contains first and last PCR from the passed MPEG-TS data. The im_pcr_start+end represents PCR times for already sent data to input. Thus end-start means the total queued time.
OK. Thank you for the clarification. So, "pcr" pointer is for "output" and "im" for input. Right?
Updated by Jaroslav Kysela almost 7 years ago
- Subject changed from TS-FILE not save config to PCR issue for IPTV
Updated by Pablo R. almost 7 years ago
Mono Polimorph wrote:
Hi,
I discovered the cause why the TS-FILE config isn't stored in the configuration: the function iptv_mux_config_save() is empty
We need this enabled for saving the SAT>IP frequency when applying #4784.
I feel this function isn't fully implemented because the TS-FILE is only enabled (at time) using the command-line. However, until this input will be enhanced, a simple map like TSFILE1, TSFILE2, etc. based on the apperance order in the commandline will be sufficient.You agree?
About that 2 lines that commented, one has *mm and other *m.
The rest is the same. Can it be the reason for the problem?
P.S.: I am not a programmer, I say it in case you have not seen it and that was the problem.
Regards.
Updated by Jaroslav Kysela almost 7 years ago
Tsfile is for debugging only. It's was not intended to be used for regular things.