Tvheadend - Bug #2171 MP2 radio stations hickups

Similar documents
Tvheadend - Bug #2222 Kodi: Sound but no picture

Tvheadend - Bug #2470 CPU usage slowly increasing to 100% while watching

Tvheadend - Bug #3134 configuration save/load - improve throughput - save space (was: big starting time)

Tvheadend - Bug #2580 services get disabled when "missing in PAT"

Tvheadend - Bug #3071 Incompatible sat2ip device?

Tvheadend - Bug #1295 Record fail: "Waiting for Stream". Debug output says "GracePeriod Expired"

Wetek OpenELEC TVHeadend Freesat Bouquet and XMLTV data

Tvheadend - Feature #2056 Tvheadend: Add support for CI+ Cams

ELEC 691X/498X Broadcast Signal Transmission Winter 2018

Configuring the Transport Stream Information

Digital television The DVB transport stream

Mobile DTV Viewer. User Manual. Mobile DTV ATSC-M/H DVB-H 1Seg. Digital TV ATSC DVB-T, DVB-T2 ISDB-T V 4. decontis GmbH Sachsenstr.

LV 58SER04 MPEG DECODER INSTRUCTION MANUAL USO RESTRITO

Jynxbox How2 for V1, V2, V3 Pg 1

Research & Development. White Paper WHP 318. Live subtitles re-timing. proof of concept BRITISH BROADCASTING CORPORATION.

TBS6909 User Guide. In order to use this item correctly, please read this user manual carefully at the beginning.

An introduction to MPEG transport streams. all you should know before using TSDuck

Release Notes for GT42 Universal descrambler Module

HDC DVB-C Headend Transmodulator with Satellite and IP Stream Input

My XDS Receiver- Affiliate Scheduler

Telephone Phrasals C.O C.O. 2 H.O (wait) 5 S.U (talk louder) 3 H.U (replace receiver) 1 P.T (connect/ transfer) 6 P.

My XDS Receiver- Affiliate Scheduler

C Module Description. IQMDMO MPEG-2 Decoder with MOLE Output

TV4U QUAD DVB-S2 to DVB-C TRANSMODULATOR

Chapter 1. Getting started with your XBMC player

Luminato SNMP Monitoring Guide

Teletext Inserter Firmware. User s Manual. Contents

IxStream Headend. Quick Guide - Begin working with the IxStream headend. IX-Streamer, rev 1.1

RADview-PC/TDM. Network Management System for TDM Applications Megaplex RAD Data Communications Publication No.

DVB-S. User s manual

DATV-Express Users Guide. (based on DATV-Express software build v1.09) Draft 16

Installing a Turntable and Operating it Under AI Control

Matrox PowerStream Plus

HD-1603 Single Input MPEG-4 DVB-T HD Encoder/Modulator User Guide and Install Manual

User guide. IP output module - Art. No A

HV-122-DCA DVB-T 2-Way Diversity Receiver Box Quick Installation Guide

OPERATIONAL GUIDELINES FOR DIGITAL SATELLITE BROADCASTING. ARIB TR-B15 Version 4.6

Introduction. Packet Loss Recovery for Streaming Video. Introduction (2) Outline. Problem Description. Model (Outline)

User manual. QAM output module. QAM output module Version F Date 08/2016 EN

MCS PerfectMatch v6 Log Sample1.rtf Sep. 23, 2009

CompactMax-2 DVB-S/S2 TO DVB-T2 TRANSMODULATOR - 0 MI2100 -

ENGINEERING COMMITTEE Digital Video Subcommittee SCTE

RS232 Bridge Firmware. User s Manual. Contents. 0 Definition 4

Operation and Installation Guide

ATSC vs NTSC Spectrum. ATSC 8VSB Data Framing

OpenTechnologies. User guide

Digital Tuner Streamer

Television on IP Networks. BNS-200 (Ref. 5105) Double A/V IP Streamer. Configuration and Settings. User Manual

Figure 1: V 713 CI plug-in card

# Project Tracker Status Priority Subject Updated Target version /12

Release Notes for GT41 IP Processing Module

2) }25 2 O TUNE IF. CHANNEL, TS i AUDIO

Avigilon View Software Release Notes

EXOSTIV TM. Frédéric Leens, CEO

DUOLABS Spa. Conditional Access Module Hardware Brief. CA Module User Guide V0.2

DP Tuner 80 Remote Control Software User Manual. Version:08 Issue Date:May 10, 2018

NOTICE. (Formulated under the cognizance of the CTA R4.8 DTV Interface Subcommittee.)

Amb-OS Media, LLC AMR-100

A LOW COST TRANSPORT STREAM (TS) GENERATOR USED IN DIGITAL VIDEO BROADCASTING EQUIPMENT MEASUREMENTS

A NEW METHOD FOR RECALCULATING THE PROGRAM CLOCK REFERENCE IN A PACKET-BASED TRANSMISSION NETWORK

Channel processing equipment

SetEditKaon for Kaon. Contents:

Quick Reference Guide. OmniBER 718

AD2612 DVB TS SCRAMBLER USER S MANUAL

The following content is provided under a Creative Commons license. Your support

SetEditMX04 for Smart MX04. Contents:

Basics of BISS scrambling. Newtec. Innovative solutions for satellite communications

EECS150 - Digital Design Lecture 12 - Video Interfacing. Recap and Outline

Matrox PowerStream Plus

User Manual. UNIVERSE Ref. 8600

Quick JIRA Manual to create an issue. M.F. Gómez de la Cruz

White Paper. Video-over-IP: Network Performance Analysis

Error performance objective for 25 GbE

DTV/MPEG2 Test & Measurement DTV Signal Generator DSG500

First Encounters with the ProfiTap-1G

QRF5000 MDU ENCODER AND QAM MODULATOR

Life without Library Systems?

SetEditMedionLife for MedionLife P Contents:

Arbitrary Waveform Generator

Alpha Plus. User Guide

Matrox PowerStream Plus

Cisco D9859 Advanced Receiver Transcoder

GNS600 SCTE104 VANC inserter, Ethernet data-bridge for 3G, HD and SD SDI Inputs and X31 Cue encoder/decoder

Application Highlights

Research and Application of Scheduling Algorithm for Digital Television Multiplexer

SharkFest 17 Europe. Generating Wireshark Dissectors from XDR Files. Why you don't want to write them by hand. Richard Sharpe.

TERRA. DVB remultiplexer TRS180. User manual

Configuration guide TDH 800 PAL output module. TDH 800 PAL output module Version A EN triax.com

DVISm. DVISm - Mini Digital Video Insertion System. Quick Start Guide. Patent Pending

DHP 400A. Product Outline. Key Fetures. DHP 400A Head-end Processor

SetEditTF5000 for Topfield 5000/5500. Contents:

Netflix on the IMC IMC and up. User guide for viewing Netflix Content

Note: Please use the actual date you accessed this material in your citation.

quantumdata TM G Protocol Analyzer / Generator Module for HDMI Testing Deep Analysis and Compliance Testing up to 600MHz

THE MOST INNOVATIVE ADVANCED, COST EFFECTIVE RADIO & AUDIO BROADCASTING PLATFORM

WebMedia Plugin Manager Operational Reference

ESPN XDS Satellite Receiver Configuration Information

TV4U DVB-S2 to DVB-S2 TRANSMODULATOR

Analyzing Modulated Signals with the V93000 Signal Analyzer Tool. Joe Kelly, Verigy, Inc.

Multimedia Time Warping System. Akiko Campbell Presentation-2 Summer/2004

Transcription:

Tvheadend - Bug #2171 MP2 radio stations hickups 2014-07-07 17:14 - J H Status: Fixed Start date: 2014-07-07 Priority: Normal Due date: Assignee: % Done: 100% Category: Estimated time: 0.00 hour Target version: Found in version: 3.9.959~g6fab551 Affected Versions: Description I've noticed hickups in the audio of certain radio stations when using the git version of Tvheadend. The stable version plays fine. It's only the Music Choice channels, audio stream is MP2 and my provider is Ziggo in The Netherlands. I'm using Sundtek tuners and I've already did some testing with the support engineer of Sundtek to rule out the tuners. Tvheadend log stays empty during playback, same for the playing software like XBMC, VLC etc. OS: Ubuntu 14.04 LTS Tvheadend v. 3.9.959~g6fab551 I've added a recording of a Music Choice channel. You can hear 4 hickups. Associated revisions Revision 67938bc9-2014-12-08 20:20 - Jaroslav Kysela descrambler: implement proper TS queue flush before key change, fixes #2171 History #1-2014-07-28 13:21 - J H - File Stutter.ts added Added another maybe better example. #2-2014-09-19 14:51 - J H Now on build 3.9.1539~g286509b and still existing. Also noticed stuttering on an unencrypted channel. Could someone please tell me if there's any way to log this in tvheadend? Normal debugging log shows no errors during playback. #3-2014-09-19 15:32 - Jaroslav Kysela Could you provide the whole mux dump? Use the 'play' link in the mux tab to gather the whole infomation. But only if the contents is not crypted.. #4-2014-09-19 16:01 - J H I'm sorry but I don't have a FTA channel that's affected. I was wrong. 2018-05-13 1/9

It seems only some encrypted radio stations are wrong. I can provide you with a mux dump of one of those muxes if that is of any help? #5-2014-09-21 15:38 - J H Is there any other information I can give to solve this issue? #6-2014-09-21 19:33 - Jaroslav Kysela Could you grab the output stream from tvheadend using wireshark or tcpdump? Only the TCP audio stream.. It looks like a timing issue.. #7-2014-09-22 12:59 - J H - File stream-wireshark2.pcapng added Added wireshark file. Not sure if this is the format you're looking for. If you need something else please say so. #8-2014-10-15 11:39 - J H Did you spot a cause for this issue in the wireshark file? #9-2014-12-04 12:04 - J H Ziggo added a unencrypted Christmas Music Choice channel. Guess what... no stutter in playback. My best guess is there's something wrong with radio stations and encryption. Could someone please take a look at it again?version running now is 3.9.2165~g3579d04 #10-2014-12-04 12:05 - J H Didn't mean unencrypted but unencrypted #11-2014-12-04 13:40 - Jaroslav Kysela Just some notes: Trying to analyze Stutter.ts - it looks like a raw (passthrough) TS file from TVH. There are missing frames in the audio stream: A python script to analyze frame pts diffs: import sys fp = sys.stdin prev = None for l in fp.readlines(): if l.startswith('pkt_pts_time='): next = float(l[13:-1]) if prev: print "%.6f (diff %.6f)" % (next, next - prev) 2018-05-13 2/9

prev = next Cmd line: ffprobe -show_frames ~/Download/Stutter.ts python a.py Result: 90132.396111 (diff 0.026000) 90132.422111 (diff 0.026000) 90132.605111 (diff 0.183000) # gap - 1 + 6 missing frames 90132.631111 (diff 0.026000) 90132.683111 (diff 0.052000) # gap - 1 + 1 missing frame 90132.710111 (diff 0.027000) 90132.736111 (diff 0.026000) 90157.369111 (diff 0.026000) 90157.395111 (diff 0.026000) 90157.421111 (diff 0.026000) 90157.604111 (diff 0.183000) # gap - 1 + 6 missing frames 90157.630111 (diff 0.026000) 90157.683111 (diff 0.053000) # gap - 1 + 1 missing frame 90157.709111 (diff 0.026000) 90157.735111 (diff 0.026000) 90182.368111 (diff 0.026000) 90182.394111 (diff 0.026000) 90182.421111 (diff 0.027000) 90182.603111 (diff 0.182000) # gap - 1 + 6 missing frames 90182.630111 (diff 0.027000) 90182.682111 (diff 0.052000) # gap - 1 + 1 missing frame 90182.708111 (diff 0.026000) 90182.734111 (diff 0.026000) Note that the time difference between gaps is 25 seconds each (descrambling key change?). #12-2014-12-04 13:41 - Jaroslav Kysela Could you provide --trace descrambler,capmt,cwc? #13-2014-12-04 18:24 - J H - File tvheadend-debug.log added Here you go. What I noticed is that the stutter in audio lines up perfectly with the ECM message in the log. Hope this puts you on the right track! 2018-05-13 3/9

#14-2014-12-04 20:48 - Jaroslav Kysela Could you do same test with this one-line addition? diff --git a/src/descrambler/descrambler.c b/src/descrambler/descrambler.c index d42683e..94f7b3b 100755 --- a/src/descrambler/descrambler.c +++ b/src/descrambler/descrambler.c @@ -370,6 +370,7 @@ descrambler_descramble ( service_t *t, sbuf_free(&dr->dr_buf); } ki = tsb[3]; + tvhtrace("descrambler", "ki = %02x", ki); if ((ki & 0x80)!= 0x00) { if (key_valid(dr, ki) == 0) { if (tvhlog_limit(&dr->dr_loglimit_key, 10)) #15-2014-12-04 21:31 - J H - File tvheadend-debug.log added Same problem, log added #16-2014-12-05 11:10 - Jaroslav Kysela Which CSA do you use? $ grep CSA.config.mk CONFIG_TVHCSA = yes CONFIG_DVBCSA = no #17-2014-12-05 12:39 - J H xbmc@mediacenter:~/tvheadend$ grep CSA.config.mk CONFIG_TVHCSA = yes CONFIG_DVBCSA = no #18-2014-12-05 16:05 - Jaroslav Kysela Another debug code: diff --git a/src/descrambler/descrambler.c b/src/descrambler/descrambler.c index d42683e..d838b1d 100755 --- a/src/descrambler/descrambler.c +++ b/src/descrambler/descrambler.c @@ -326,6 +326,9 @@ descrambler_descramble ( service_t *t, 2018-05-13 4/9

lock_assert(&t->s_stream_mutex); + static int didx = 0; + tvhtrace("descrambler", "descramble ts packet %i (PID %i)", didx++, st->es_pid); + if (dr == NULL) return -1; count = failed = 0; diff --git a/src/input/mpegts/tsdemux.c b/src/input/mpegts/tsdemux.c index 2b4f7e0..d3016e3 100644 --- a/src/input/mpegts/tsdemux.c +++ b/src/input/mpegts/tsdemux.c @@ -256,6 +256,10 @@ ts_recv_packet2(mpegts_service_t *t, const uint8_t *tsb) elementary_stream_t *st; int pid = (tsb[1] & 0x1f) << 8 tsb[2]; + static int didx = 0; + tvhtrace("descrambler", "output ts packet %i PID %i", didx++, pid); + tvhlog_hexdump("descrambler", tsb, 188); + if((st = service_stream_find((service_t*)t, pid))!= NULL) ts_recv_packet0(t, st, tsb); } #19-2014-12-05 16:55 - J H - File tvheadend-debug.log added Log added, for example audio stutter at: - 16:47:34-16:47:54-16:48:14 And so on with 20 seconds interval #20-2014-12-05 18:21 - Jaroslav Kysela OK. No descrambled TS packets are lost. So, it appears that the packets are missing before they enter to the descrambler. Could you try simultaneous streaming the whole mux while the radio service is used, if it changes something? (Something like 'wget -O /dev/null <mux_play_url_from_the_mux_grid>'.) #21-2014-12-05 19:09 - J H Just tried, no changes. 2018-05-13 5/9

#22-2014-12-05 20:25 - Jaroslav Kysela I need to implement a way to insert the descrambling keys to the whole mux stream and also implement the re-play functionality, so I can do testing directly on my machine. It may take some time. #23-2014-12-05 22:41 - J H Ok, thanks very much! Please say when you need more info from me. #24-2014-12-07 21:25 - Jaroslav Kysela OK. Grab latest sources. Use --enable-tsdebug as the configure option. Then run tvheadend with "--tsdebug <directory>" arguments. Then run the test and you should see in directory two files. I need them for analyze what's going wrong. One file is raw input from the linuxdvb subsystem and the second file is almost same (tvh does some processing - no contents change) but with added descrambler keys. #25-2014-12-08 09:36 - J H - File 658MHz in Ziggo-1417994463-0x7f6d1c009bc0-input.ts added - File 658MHz in Ziggo-1417994463-0x7f6d1c009bc0-mux.ts added Resulted files are added. #26-2014-12-08 16:18 - Jaroslav Kysela Tried to re-play and guess what - no packets are lost, but I had to fix a little issue with the PCR extraction - v3.9-2214-g8668734 for tsfile. I don't think that it's related for the live playback, but could you test the recent code? #27-2014-12-08 16:33 - J H - File 658MHz in Ziggo-1418052479-0x16e5200-input.ts added - File 658MHz in Ziggo-1418052479-0x16e5200-mux.ts added Issue not resolved as you already suspected, added the.ts files #28-2014-12-08 16:54 - Jaroslav Kysela Could you try this? diff --git a/src/descrambler/descrambler.c b/src/descrambler/descrambler.c index a15aa64..0706c9b 100755 --- a/src/descrambler/descrambler.c +++ b/src/descrambler/descrambler.c @@ -179,6 +179,8 @@ descrambler_keys ( th_descrambler_t *td, int type, if (tvhcsa_set_type(&dr->dr_csa, type) < 0) return; 2018-05-13 6/9

+ usleep(500000); + pthread_mutex_lock(&t->s_stream_mutex); LIST_FOREACH(td2, &t->s_descramblers, td_service_link) BTW: Also the second re-play was successful (no gaps in the output stream). #29-2014-12-08 17:04 - J H TVH crashes with that code added. Do you need a crashlog and where can I find it? #30-2014-12-08 17:26 - Jaroslav Kysela diff --git a/src/descrambler/cwc.c b/src/descrambler/cwc.c index bac4aa4..a36c8c2 100755 --- a/src/descrambler/cwc.c +++ b/src/descrambler/cwc.c @@ -809,7 +809,9 @@ forbid: es->es_keystate = ES_RESOLVED; es->es_resolved = 1; + pthread_mutex_unlock(&ct->cs_cwc->cwc_mutex); descrambler_keys((th_descrambler_t *)ct, DESCRAMBLER_DES, msg + 3, msg + 3 + 8); + pthread_mutex_lock(&ct->cs_cwc->cwc_mutex); } else { tvhlog(log_debug, "cwc", "Received ECM reply%s for service \"%s\" " diff --git a/src/descrambler/descrambler.c b/src/descrambler/descrambler.c index a15aa64..0706c9b 100755 --- a/src/descrambler/descrambler.c +++ b/src/descrambler/descrambler.c @@ -179,6 +179,8 @@ descrambler_keys ( th_descrambler_t *td, int type, if (tvhcsa_set_type(&dr->dr_csa, type) < 0) return; + usleep(500000); + pthread_mutex_lock(&t->s_stream_mutex); LIST_FOREACH(td2, &t->s_descramblers, td_service_link) #31-2014-12-08 18:21 - J H I'm very happy to tell you this seemed to fix the issue. Tested multiple radio channels en playback seems fine again. Thanks very much for your time and effort! 2018-05-13 7/9

#32-2014-12-08 18:58 - Jaroslav Kysela It's not a fix, but just a debug code. It looks like a timing issue (wrong key is used for decoding some frames for a short period). The patch just delays the new key processing by 500 ms. #33-2014-12-08 19:24 - J H Ok I understand. If there's something to test please say so. #34-2014-12-08 19:30 - Jaroslav Kysela I found the real issue. Basically, the key was changed too quickly and tvh buffers some TS packets for the DES decoder. These buffered TS packets must be flushed (processed) before key changes, otherwise they are decoded with the new key which is invalid for them (thus some pieces of the audio stream weren't parsed properly). I'm working on a fix. I only wonder, why we haven't noted before, because this bug is really serious. #35-2014-12-08 19:35 - J H I made a forum post here asking if anybody else was having this issue, no replies. I also asked on tweakers.net in the tvheadend topic if anyone else noticed... no one. Guess I'm the only one left here listening to radio. #36-2014-12-08 20:20 - Jaroslav Kysela - Status changed from New to Fixed - % Done changed from 0 to 100 Applied in changeset commit:tvheadend 67938bc9d9774dff7b99e4e134d5c38bde55cce9. #37-2014-12-08 20:21 - Jaroslav Kysela The above commit contains the proper fix for your issue. Could you test? #38-2014-12-08 20:37 - J H Tested and confirmed to fix the issue. Thanks again! #39-2014-12-08 20:59 - Jaroslav Kysela J H wrote: I made a forum post here asking if anybody else was having this issue, no replies. I also asked on tweakers.net in the tvheadend topic if anyone else noticed... no one. Guess I'm the only one left here listening to radio. I think that the problem was that most of radio stations on SAT are not encrypted (at least it's true for my country and I think also for most of European countries). 2018-05-13 8/9

#40-2014-12-08 21:43 - Jaroslav Kysela - File deleted (tvheadend-debug.log) #41-2014-12-08 21:43 - Jaroslav Kysela - File deleted (658MHz in Ziggo-1417994463-0x7f6d1c009bc0-mux.ts) #42-2014-12-08 21:43 - Jaroslav Kysela - File deleted (stream-wireshark2.pcapng) #43-2014-12-08 21:43 - Jaroslav Kysela - File deleted (Stutter.ts) #44-2014-12-08 21:43 - Jaroslav Kysela - File deleted (recording.ts) #45-2014-12-08 21:43 - Jaroslav Kysela - File deleted (658MHz in Ziggo-1417994463-0x7f6d1c009bc0-input.ts) #46-2014-12-08 21:43 - Jaroslav Kysela - File deleted (658MHz in Ziggo-1418052479-0x16e5200-mux.ts) #47-2014-12-08 21:43 - Jaroslav Kysela - File deleted (658MHz in Ziggo-1418052479-0x16e5200-input.ts) Files tvheadend-debug.log 22 KB 2014-12-04 J H tvheadend-debug.log 1.04 MB 2014-12-04 J H 2018-05-13 9/9