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

Support soft and hard reads #730

Closed
18 tasks done
gavv opened this issue Jun 17, 2024 · 0 comments
Closed
18 tasks done

Support soft and hard reads #730

gavv opened this issue Jun 17, 2024 · 0 comments
Assignees
Milestone

Comments

@gavv
Copy link
Member

gavv commented Jun 17, 2024

Summary

Implement two reading modes for IFrameReader: soft read and hard read.

Hard read is current behavior - return as much samples as possible (up to requested size), fill gaps caused by packet loss with zeros.

Soft read enables new behavior - stop reading when encountered gap (caused by packet loss). E.g. when 10 samples requested, but only 5 samples are available, and then there is a gap, only 5 samples will be returned (using partial read mechanism implemented in #615).

Use-cases

Soft reads are needed when next chunk in pipeline can help if it arrived earlier than deadline, but on the other hand if it haven't arrived yet, we don't want to mark it as late and create a gap.

It can be used in:

  • PLC: to use next chunk for interpolation - Implement PLC #731
  • Audio I/O: to fill ALSA/PulseAudio buffer as full as possible to amortize scheduler jitter
  • Video I/O: to fill processing buffer as full as possible to amortize decoding jitter

Impl

  • roc_audio: add reading mode argument to FrameReader: soft or hard
  • roc_audio: special handling
    • resampler_reader
    • mixer
  • roc_audio: simple forwarding
    • channel_mapper_reader
    • pcm_mapper_reader
    • profiling_reader
    • watchdog
  • roc_audio: tests
    • resampler_reader
    • mixer
    • channel_mapper_reader
    • pcm_mapper_reader
    • watchdog
  • roc_pipeline: forward
  • roc_pipeline: tests
  • roc_node: use ModeHard
@gavv gavv added this to the next milestone Jun 17, 2024
@gavv gavv self-assigned this Jun 17, 2024
@gavv gavv mentioned this issue Jun 17, 2024
33 tasks
@gavv gavv changed the title Support reading options in frame readers Support soft and hard reads Jun 18, 2024
@gavv gavv mentioned this issue Jun 20, 2024
18 tasks
@gavv gavv closed this as completed Jun 20, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Jun 22, 2024
IFrameReader::read() now supports two modes: soft read and hard read.

Hard read behaves as usual - returns as much samples as possible,
filling gaps with zeros.

Soft read is a new behavior - it stops when a packet loss is
encountered instead of filling loss with zeros.
@gavv gavv added this to Roc Toolkit Jul 6, 2024
@gavv gavv moved this to Done in Roc Toolkit Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

1 participant