After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611046 - mpegtsmux: pcr problems
mpegtsmux: pcr problems
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-25 07:36 UTC by dxssx
Modified: 2011-10-29 15:42 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description dxssx 2010-02-25 07:36:52 UTC
1. wrong frequency
gst-plugins-bad-0.10.12/gst/mpegtsmux/tsmux/tsmux.c

    if (stream->last_pcr == -1 ||
        (cur_pcr - stream->last_pcr >
            (TSMUX_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ))) {

Since pcr runs in clock TSMUX_SYS_CLOCK_FREQ, the comparison should be 
    if (stream->last_pcr == -1 ||
        (cur_pcr - stream->last_pcr >
            (TSMUX_SYS_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ))) {

2. imprecise pcr
gst-plugins-bad-0.10.12/gst/mpegtsmux/tsmux/tsmux.c

      cur_pcr = (cur_pts - TSMUX_PCR_OFFSET) *                                
          (TSMUX_SYS_CLOCK_FREQ / TSMUX_CLOCK_FREQ);  

This makes pcr a multiple of TSMUX_SYS_CLOCK_FREQ / TSMUX_CLOCK_FREQ (=300), which makes pcr_ext always 0 in 
      pcr_ext = (pi->pcr % 300);

pcr should be generated from gsttime instead of mpegtime which has a low precision after GSTTIME_TO_MPEGTIME.
Comment 1 Marc-Andre Lureau 2010-02-25 09:46:40 UTC
you should update your comments based on the git version, some clock issues have been fixed recently (that 300x issue)
Comment 2 dxssx 2010-02-25 12:15:42 UTC
The clock issues fixed are about pat/pmt frequency not pcr.
This issue is for HEAD in git, which version is 0.10.17.3 pre-release.
Comment 3 Jan Schmidt 2011-03-26 05:19:21 UTC
I pushed this patch, which fixes the incorrect PCR insertion rate:

commit 5111540ceb04fbbfdb01b2c64911e04dbae291a8
Author: Jan Schmidt <thaytan@noraisin.net>
Date:   Sat Mar 26 16:12:18 2011 +1100

    Use correct clock when checking whether to write a new PCR
    
    The PCR clocks against the 27MHz SCR clock, so check it correctly
    to avoid writing the PCR too often.
    
    Partially fixes: #611046

Making the PCR more accurate requires a bit more work to pass the extra GstClockTime granularity down into the tsmux library.
Comment 4 Edward Hervey 2011-05-31 11:48:20 UTC
Isn't this bug fixed ?
Comment 5 Tobias Mueller 2011-10-16 04:45:07 UTC
Let's assume it is. If not, please reopen.