summaryrefslogtreecommitdiff
path: root/m2ts/webm2pes.cc
diff options
context:
space:
mode:
authorHarish Mahendrakar <hmahendrakar@google.com>2023-10-31 19:33:03 +0000
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2023-11-17 02:50:12 +0000
commite546ccacd3177e86ab7cd5ff1c457748313a750f (patch)
tree1df2a4965f354fcb732ed90b80f33e7ee692b043 /m2ts/webm2pes.cc
parent0a7513cba230ffffd6f2bd5a67c87dbb448f8372 (diff)
downloadlibwebm-e546ccacd3177e86ab7cd5ff1c457748313a750f.tar.gz
Upgrade libwebm to libwebm-1.0.0.31
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update libwebm For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Bug: 308688826 Test: TreeHugger Test: atest CtsMediaV2TestCases:ExtractorTest \ CtsMediaV2TestCases:ExtractorUnitTest \ CtsMediaV2TestCases:MuxerTest \ CtsMediaV2TestCases:MuxerUnitTest (cherry picked from https://android-review.googlesource.com/q/commit:76291c2912ba965a35f0dbdc0103c38289df3773) Merged-In: I18bedd39853cf9c79053614c4ceb4f54ad430956 Change-Id: I18bedd39853cf9c79053614c4ceb4f54ad430956
Diffstat (limited to 'm2ts/webm2pes.cc')
-rw-r--r--m2ts/webm2pes.cc41
1 files changed, 21 insertions, 20 deletions
diff --git a/m2ts/webm2pes.cc b/m2ts/webm2pes.cc
index afa8a6b..a4169c0 100644
--- a/m2ts/webm2pes.cc
+++ b/m2ts/webm2pes.cc
@@ -33,9 +33,6 @@ std::string ToString(const char* str) {
//
void PesOptionalHeader::SetPtsBits(std::int64_t pts_90khz) {
- std::uint64_t* pts_bits = &pts.bits;
- *pts_bits = 0;
-
// PTS is broken up and stored in 40 bits as shown:
//
// PES PTS Only flag
@@ -48,32 +45,36 @@ void PesOptionalHeader::SetPtsBits(std::int64_t pts_90khz) {
const std::uint32_t pts2 = (pts_90khz >> 15) & 0x7FFF;
const std::uint32_t pts3 = pts_90khz & 0x7FFF;
- std::uint8_t buffer[5] = {0};
- // PTS only flag.
- buffer[0] |= 1 << 5;
- // Top 3 bits of PTS and 1 bit marker.
- buffer[0] |= pts1 << 1;
- // Marker.
- buffer[0] |= 1;
+ pts.bits = 0;
- // Next 15 bits of pts and 1 bit marker.
- // Top 8 bits of second PTS chunk.
- buffer[1] |= (pts2 >> 7) & 0xff;
// bottom 7 bits of second PTS chunk.
- buffer[2] |= (pts2 << 1);
+ pts.bits |= (pts3 << 1) & 0xff;
// Marker.
- buffer[2] |= 1;
+ pts.bits |= 1;
// Last 15 bits of pts and 1 bit marker.
// Top 8 bits of second PTS chunk.
- buffer[3] |= (pts3 >> 7) & 0xff;
+ pts.bits <<= 8;
+ pts.bits |= (pts3 >> 7) & 0xff;
+
// bottom 7 bits of second PTS chunk.
- buffer[4] |= (pts3 << 1) & 0xff;
+ pts.bits <<= 8;
+ pts.bits |= (pts2 << 1);
// Marker.
- buffer[4] |= 1;
+ pts.bits |= 1;
- // Write bits into PesHeaderField.
- std::memcpy(reinterpret_cast<std::uint8_t*>(pts_bits), buffer, 5);
+ // Next 15 bits of pts and 1 bit marker.
+ // Top 8 bits of second PTS chunk.
+ pts.bits <<= 8;
+ pts.bits |= (pts2 >> 7) & 0xff;
+
+ // PTS only flag.
+ pts.bits <<= 8;
+ pts.bits |= 1 << 5;
+ // Top 3 bits of PTS and 1 bit marker.
+ pts.bits |= pts1 << 1;
+ // Marker.
+ pts.bits |= 1;
}
// Writes fields to |buffer| and returns true. Returns false when write or