Skip to content

Commit

Permalink
[MPEG-TS] Fix PCR reserved bits not being set correctly
Browse files Browse the repository at this point in the history
Fixes #893.
  • Loading branch information
JPeMu authored Feb 3, 2021
1 parent 449945d commit 36ef7ec
Show file tree
Hide file tree
Showing 71 changed files with 3 additions and 3 deletions.
Binary file modified packager/app/test/testdata/avc-aac-ts/bear-640x360-audio-1.ts
Binary file not shown.
Binary file modified packager/app/test/testdata/avc-aac-ts/bear-640x360-audio-2.ts
Binary file not shown.
Binary file modified packager/app/test/testdata/avc-aac-ts/bear-640x360-audio-3.ts
Binary file not shown.
Binary file modified packager/app/test/testdata/avc-aac-ts/bear-640x360-video-1.ts
Binary file not shown.
Binary file modified packager/app/test/testdata/avc-aac-ts/bear-640x360-video-2.ts
Binary file not shown.
Binary file modified packager/app/test/testdata/avc-aac-ts/bear-640x360-video-3.ts
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packager/media/formats/mp2t/ts_packet_writer_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packager/media/formats/mp2t/ts_writer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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[] = {
Expand Down

0 comments on commit 36ef7ec

Please sign in to comment.