Skip to content

Packets-peeking feature #11

@TonalidadeHidrica

Description

@TonalidadeHidrica

One possible solution for RustAudio/lewton#84 requires to look ahead future packets. This issue is for discussing the API and internal design.

My idea is as follows:

  • Add a function like this: PacketReader::peeking_reader<'a>(&'a mut self) -> PeekingPacketReader<'a>
    This way, we cannot use the original PacketReader while using PeekingPacketReader.
  • PeekingPacketReader provides subset functions of those of PacketReader: into_inner, read_packet and read_packet_expected. (and possibly delete_unread_packets?)
  • When a PeekingPacketReader is generated, it stores the current position of underlying reader, which will be restored when the PeekingPacketReader is dropped.
    • Alternatively, we can store all the loaded packets into PacketReader and yield them first after the Peeking one is invalidated. This way, we don't have to rely on base reader's Seekableness.

How do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions