static setBaseMediaDecodeTime_(
      segment, tfdtOffset, baseMediaDecodeTime, timescale) {
    goog.asserts.assert(baseMediaDecodeTime * timescale < Math.pow(2, 32),
        'Specified baseMediaDecodeTime is too big.');

    // This will create a copy of the given buffer.
    const buffer = shaka.util.Uint8ArrayUtils.concat(segment);

    const dataView = shaka.util.BufferUtils.toDataView(buffer);
    const reader = new shaka.util.DataViewReader(
        dataView, shaka.util.DataViewReader.Endianness.BIG_ENDIAN);
    reader.skip(tfdtOffset);

    const size = reader.readUint32();
    const type = reader.readUint32();
    goog.asserts.assert(
        type == 0x74666474,  // tfdt
        'segment does not contain a tfdt box at the specified offset.');

    const largesizePresent = size == 1;
    if (largesizePresent) {
      shaka.log.v2('\'largesize\' field is present.');
      reader.skip(8);  // Skip 'largesize' field.
    }

    const version = reader.readUint8();
    reader.skip(3);  // Skip 'flags' field.

    const pos = reader.getPosition();
    if (version == 0) {
      shaka.log.v2('tfdt box is version 0.');
      dataView.setUint32(pos, baseMediaDecodeTime * timescale);
    } else {
      shaka.log.v2('tfdt box is version 1.');
      // tfdt box version 1 supports 64-bit 'baseMediaDecodeTime' fields;
      // however, we restrict the input to 32 bits above.
      dataView.setUint32(pos, 0);
      dataView.setUint32(pos + 4, baseMediaDecodeTime * timescale);
    }

    return shaka.util.BufferUtils.toArrayBuffer(buffer);
  }
Sets the given segment's track fragment media decode time box's (tfdt box)
baseMediaDecodeTime parameter.

@param {!ArrayBuffer} segment
@param {number} tfdtOffset The byte offset of the segment's tfdt box.
@param {number} baseMediaDecodeTime The baseMediaDecodeTime in seconds,
  this value is the first presentation timestamp of the first frame/sample
  in the segment.
@param {number} timescale
@return {!ArrayBuffer} The modified segment.
@private