Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packets-peeking feature #11

Open
TonalidadeHidrica opened this issue Nov 7, 2020 · 0 comments
Open

Packets-peeking feature #11

TonalidadeHidrica opened this issue Nov 7, 2020 · 0 comments

Comments

@TonalidadeHidrica
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant