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

Frame pool #697

Closed
64 tasks done
gavv opened this issue Feb 10, 2024 · 0 comments
Closed
64 tasks done

Frame pool #697

gavv opened this issue Feb 10, 2024 · 0 comments
Assignees
Milestone

Comments

@gavv
Copy link
Member

gavv commented Feb 10, 2024

Make frame pooled and holding reference to a buffer, also pooled.

This will allow to create queues/ring buffers of frames, reuse existing buffers (e.g. attach buffer from packet directly to a frame), and reuse existing frames (e.g. return same frame twice).

This is also needed to be able to return frame of different size than requested and thus implement partial reads (#615).

  • rework Buffer:
    • make Buffer non-template (always bytes)
    • make BufferFactory non-template
    • keep Slice template
  • rework factories
    • PacketFactory: new_packet_buffer(), new_packet()
    • FrameFactory: new_byte_buffer(), new_raw_buffer()
    • remove BufferFactory
  • rework Frame
    • Slice<uint8_t> buffer()
    • void set_buffer(Slice<uint8_t>)
  • pooled frames
    • FramePtr
    • FrameFactory: allocate_frame(), reallocate_frame()
  • IFrameWriter:
    • StatusCode write(Frame&)
  • IFrameReader:
    • StatusCode read(Frame&, packet::stream_timestamp_t duration)
  • Update roc_audio:
    • Mixer
    • Fanout
    • ResamplerReader
    • ResamplerWriter
    • ChannelMapperReader
    • ChannelMapperWriter
    • PcmMapperReader
    • PcmMapperWriter
    • ProfilingReader
    • ProfilingWriter
    • Watchdog
    • NullWriter
    • Depacketizer
    • Packetizer
    • LatencyMonitor
    • FeedbackMonitor
  • Update roc_sndio:
    • IDevice
    • IBackend
    • BackendDispatcher
    • Pump
    • WavBackend
    • SoxBackend
    • SndfileBackend
    • PulseaudioBackend
  • Update roc_pipeline:
    • PipelineLoop
    • ReceiverLoop
    • ReceiverSource
    • SenderLoop
    • SenderSink
    • TranscoderSource
    • TranscoderSink
  • Update roc_node
    • Context
    • Sender
    • SenderEncoder
    • Receiver
    • ReceiverDecoder
  • Update public_api:
    • roc_sender
    • roc_sender_encoder
    • roc_receiver
    • roc_receiver_decoder
  • Update tools:
    • roc_send
    • roc_recv
    • roc_copy
  • Update tests
    • roc_audio
    • roc_sndio
    • roc_pipeline
    • roc_node
    • public_api
  • Remove set_duration() hacks:
    • PipelineLoop
    • Mixer
@gavv gavv added this to Frontlog in kanban board Feb 10, 2024
@gavv gavv moved this from Frontlog to In work in kanban board May 14, 2024
@gavv gavv self-assigned this May 14, 2024
@gavv gavv mentioned this issue May 14, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue May 15, 2024
Frames now can hold non-raw samples (and have arbitrary encoding).
It means that same buffer pool may be used for buffers of different
types, not known at compile type.

Hence, Buffer<T> is now replaced with Buffer, which can hold any
binary data. Slice<T> remains typed and is used when the type of
buffer contents is known.

Sponsored-by: waspd
gavv added a commit to gavv/roc-toolkit that referenced this issue May 15, 2024
Needed for creating PacketFactory and FrameFactory from
references to existing pools.

Sponsored-by: waspd
gavv added a commit to gavv/roc-toolkit that referenced this issue May 15, 2024
Preparations for frame pooling.

Changes:

- All pipeline elements (roc_audio, roc_packet, roc_fec, roc_rtp)
  now allocate buffers via PacketFactory and FrameFactory, and don't
  use memory pools directly.

  This ways these two layers are isolated and can be modified
  independently.

- BufferFactory is removed. Instead, there are now two factories:
  PacketFactory and FrameFactory.

- PacketFactory allocates packets and packet buffers.

- FrameFactory allocates frame buffers. When frame will become pooled,
  it will also allocate frames.

  It supports both byte buffers and raw sample buffers (for raw
    frames).

- PacketFactory and FrameFactory can be created either with default
  pools (embedded into factory) or with references to external pools.

  This allows to pass decorated pools to factories.

  Default (embedded) pools are used from tests, so that tests don't
  need to bother about pools and are isolated from them as well.

- node::Context now creates pools, not factories. These pools are then
  passed to roc_pipeline, roc_netio, and roc_sndio.

- roc_pipeline, roc_netio, and roc_sndio create factories from pools
  and pass them to pipeline elements.

  Later they can decorate pools before creating factories, e.g. with
  LimitedPool to apply per-session memory limits.

Sponsored-by: waspd
@gavv gavv added this to the next milestone May 18, 2024
@gavv gavv closed this as completed May 29, 2024
kanban board automation moved this from In work to Done May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant