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

There is an error in calculating the PCR of the ts stream in srs_kernel_ts.cpp. #678

Closed
daozhao opened this issue Nov 1, 2016 · 3 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@daozhao
Copy link

daozhao commented Nov 1, 2016

The function int SrsTsAdaptationField::encode(SrsStream* stream) in srs_kernel_ts.cpp has an error in calculating the PCR of the ts stream. The code for calculating the PCR in the function is as follows:

        int64_t pcrv = program_clock_reference_extension & 0x1ff;
        pcrv |= (const1_value0 << 9) & 0x7E00;
        pcrv |= (program_clock_reference_base << 15) & 0x1FFFFFFFF000000LL;

        pp = (char*)&pcrv;
        *p++ = pp[5];
        *p++ = pp[4];
        *p++ = pp[3];
        *p++ = pp[2];
        *p++ = pp[1];
        *p++ = pp[0];

One of them:

pcrv |= (program_clock_reference_base << 15) & 0x1FFFFFFFF000000LL;

It should be changed to:

pcrv |= (program_clock_reference_base << 15) & 0xFFFFFFFF8000LL;

Because the composition of PCR is 33 (PCR_Base) + 6 (PCR_const) + 9 (PCR_Ext).

Additionally, there is another calculation method mentioned in stackoverflow. However, their method is not easy to understand.

Although this PCR calculation error is relatively small.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

We will check it.

@winlinvip winlinvip added this to the srs 2.0 release milestone Nov 8, 2016
@winlinvip
Copy link
Member

Fixed in 85a7cb8

@winlinvip
Copy link
Member

About pcr, read #311

@winlinvip winlinvip self-assigned this Sep 23, 2021
@winlinvip winlinvip changed the title 在srs_kernel_ts.cpp中计算ts流的PCR有错误, There is an error in calculating the PCR of the ts stream in srs_kernel_ts.cpp. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants