[MPEG-TS] Fix PCR reserved bits not being set correctly

Fixes #893.
This commit is contained in:
JPeMu 2021-02-03 20:09:07 +00:00 committed by GitHub
parent 449945dfba
commit 36ef7ec945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ void WriteAdaptationField(bool has_pcr,
const uint32_t most_significant_32bits_pcr =
static_cast<uint32_t>(pcr_base >> 1);
const uint16_t pcr_last_bit_reserved_and_pcr_extension =
((pcr_base & 1) << 15);
((pcr_base & 1) << 15) | 0x7e00; // Set the 6 reserved bits to '1'
writer->AppendInt(most_significant_32bits_pcr);
writer->AppendInt(pcr_last_bit_reserved_and_pcr_extension);
remaining_bytes -= kPcrFieldsSize;

View File

@ -319,7 +319,7 @@ TEST_F(TsWriterTest, AddPesPacket) {
0x30, // Adaptation field and payload are both present. counter = 0.
0xA0, // Adaptation Field length.
0x10, // pcr flag.
0x00, 0x00, 0x04, 0x80, 0x00, 0x00, // PCR.
0x00, 0x00, 0x04, 0x80, 0x7e, 0x00, // PCR.
};
const uint8_t kExpectedPayload[] = {
@ -411,7 +411,7 @@ TEST_F(TsWriterTest, PesPtsZeroNoDts) {
0x30, // Adaptation field and payload are both present. counter = 0.
0xA5, // Adaptation Field length.
0x10, // pcr flag.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // PCR.
0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, // PCR.
};
const uint8_t kExpectedPayload[] = {