Records

Functions

  • std::optional<Packet> IntersectPacket (const Format & formatconst Packet & packetFixed range_startint64_t range_length)

    Returns the frames in packet which overlap the given range, or returns std::nullopt if there is

    no overlap. The intersection is guaranteed to start and end on a frame boundary. That is, for

    every non-nullopt result, start = packet.start*k for some non-negative integer k.

    The intersection is never larger than the packet or the range. That is, for every non-nullopt

    result, length

    <

    = min(packet.length, range_length). For example:

    IntersectPacket(packet = {.start = 0.0, .length = 10},

    range_start = 1,

    range_length = 2);

    returns:

    .start = 1.0

    .length = 2

    .payload = packet.payload + 1 frame

    When the range starts or ends on a fractional frame, the intersection is shifted to include

    complete frames. The intersection starts with the packet's first frame that overlaps the range.

    For example:

    IntersectPacket(packet = {.start = 0.0, .length = 10},

    range_start = 1.5,

    range_length = 2);

    returns:

    .start = 1.0

    .length = 2

    .payload = packet.payload + 1 frame

    The packet may start on a fractional frame position. For example:

    IntersectPacket(packet = {.start = 0.9, .length = 10},

    range_start = 2.5,

    range_length = 3);

    returns:

    .start = 1.9

    .length = 3

    .payload = packet.payload + 1 frame

    Defined at line 13 of file ../../src/media/audio/audio_core/mixer/intersect.cc