writeTimestamp_(buffer, offset, header, timestamp) {
    // The 33 bit timestamp is split into parts, then packed into 40 bits
    // (5 bytes).  Wikipedia phrases the layout as: "0010b, most significant 3
    // bits from PTS, 1, following next 15 bits, 1, rest 15 bits and 1."
    // https://en.wikipedia.org/wiki/Packetized_elementary_stream
    const top3Bits = timestamp >> 30;
    const next15Bits = (timestamp >> 15) & 0x7fff;
    const last15Bits = timestamp & 0x7fff;

    buffer[offset + 0] = (header << 4) | (top3Bits << 1) | 1;
    buffer[offset + 1] = next15Bits >> 7;
    buffer[offset + 2] = ((next15Bits & 0x7f) << 1) | 1;
    buffer[offset + 3] = last15Bits >> 7;
    buffer[offset + 4] = ((last15Bits & 0x7f) << 1) | 1;
  }
Write a timestamp (PTS or DTS) to a specific place in the buffer, with a
specific header, in the PES timestamp layout.

@param {!Uint8Array} buffer
@param {number} offset Where to begin writing
@param {number} header 4-bit header for the timestamp
@param {number} timestamp the actual timestamp
@private