class PacketView
Defined at line 16 of file ../../src/media/audio/services/mixer/mix/packet_view.h
Represents a view to a fixed-sized packet of audio data.
Public Methods
void PacketView (Args args)
Defined at line 16 of file ../../src/media/audio/services/mixer/mix/packet_view.cc
PacketView Slice (int64_t start_offset, int64_t end_offset)
Extracts a slice of this packet.
REQUIRED: 0
<
= start_offset
<
end_offset
<
= frame_count
Defined at line 26 of file ../../src/media/audio/services/mixer/mix/packet_view.cc
const Format & format ()
Reports the format of audio frames in this packet.
Defined at line 34 of file ../../src/media/audio/services/mixer/mix/packet_view.h
Fixed start_frame ()
Reports the position of the packet's first frame.
Defined at line 37 of file ../../src/media/audio/services/mixer/mix/packet_view.h
std::optional<PacketView> IntersectionWith (Fixed range_start_frame, int64_t range_frame_count)
Intersects this packet with the given range, returning a packet that overlaps the given range,
or std::nullopt if there is no overlap. The intersection is guaranteed to start and end on a
frame boundary and the intersection is never larger than the packet or the range.
That is, for every non-nullopt result:
result.start_frame = this.start_frame + k * frame_size, for some non-negative integer k, and
frame_count
<
= min(packet.frame_count, range_length)
For example:
IntersectionWith(this = {.start_frame = 0.0, .frame_count = 10},
range_start = 1,
range_length = 2)
returns:
.start_frame = 1.0
.frame_count = 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 first frame in the packet that overlaps the
range. For example:
IntersectionWith(this = {.start_frame = 0.0, .frame_count = 10},
range_start = 1.5,
range_length = 2);
returns:
.start_frame = 1.0
.frame_count = 2
.payload = packet.payload + 1 frame
The packet may start on a fractional frame position. For example:
IntersectionWith(this = {.start = 0.9, .frame_count = 10},
range_start = 2.5,
range_length = 3);
returns:
.start_frame = 1.9
.frame_count = 3
.payload = packet.payload + 1 frame
Defined at line 38 of file ../../src/media/audio/services/mixer/mix/packet_view.cc
Fixed end_frame ()
Reports the position just after the packet's last frame.
Defined at line 40 of file ../../src/media/audio/services/mixer/mix/packet_view.h
int64_t frame_count ()
Reports the number of frames in this packet.
Defined at line 43 of file ../../src/media/audio/services/mixer/mix/packet_view.h
void * payload ()
Returns the payload of this packet.
Defined at line 46 of file ../../src/media/audio/services/mixer/mix/packet_view.h