cli tools: fix frame size estimation when frame_length isn't provided - #831
cli tools: fix frame size estimation when frame_length isn't provided#831baranovmv wants to merge 2 commits into
Conversation
|
🤖 Pull request description does not have a link to an issue. |
This comment was marked as resolved.
This comment was marked as resolved.
|
If you remember a command that reproduces the bug, could you create an issue with command and output? I didn't see this issue in my tests. Nice to have, but not critical. |
In multi channel scenario a frame sz become too big and Frame Factory refuses to allocate frames. Here the max frame size is estimated similar way to max packet sz estimation.
7b5f737 to
6c0f5d9
Compare
|
Fixes #821 |
The issue itself needs arguebly a better solution. This PR proposes a hot-fix for basic and straightforward scenarios in our CLI tools. So at the moment there is no easy way to verify the fix proposed in this PR with our unit tests. IMHO the issue reveals a usability problem in our public API and as a consequence lead to a corresponding issue in command line parameter of CLI tools. Let me elaborate on a "better solution" a bit:
|
| : profiling_interval(core::Second) | ||
| , chunk_duration(10 * core::Millisecond) { | ||
| , chunk_duration(sndio::DefaultFrameLength) { | ||
| } |
There was a problem hiding this comment.
So far roc_audio doesn't depend on roc_sndio (it's the opposite), and I think it's different 10ms. Here 1sec and 1ms are related, and OTOH frame size should be irrelevant.
| namespace { | ||
|
|
||
| //! Default duration of a frame. 10ms is rather high, | ||
| //! but works well even on cheap sound cards and CPUs. | ||
| //! Usually you can use much lower values. | ||
| const core::nanoseconds_t DefaultFrameLength = 10 * core::Millisecond; | ||
|
|
||
| } // namespace | ||
|
|
||
| //! Sink and source config. |
There was a problem hiding this comment.
Not sure what is best practice, but elsewhere in code we don't have anon namespace for .h consts.
| namespace { | |
| //! Default duration of a frame. 10ms is rather high, | |
| //! but works well even on cheap sound cards and CPUs. | |
| //! Usually you can use much lower values. | |
| const core::nanoseconds_t DefaultFrameLength = 10 * core::Millisecond; | |
| } // namespace | |
| //! Sink and source config. | |
| //! Default duration of a frame. 10ms is rather high, | |
| //! but works well even on cheap sound cards and CPUs. | |
| //! Usually you can use much lower values. | |
| const core::nanoseconds_t DefaultFrameLength = 10 * core::Millisecond; | |
| //! Sink and source config. |
|
Agree with the better solution. To take the idea further:
I think we should have both. User can set packet length (if they care about latency; if they use non-PCM), or MTU (if they care), or both. If only one is set, the other is derived. If both are set, we may either validate that packet len fits MCU, or use the smaller one.
Actually, I think we should get make max_frame_size and max_packet_size optional, and if they're not set, don't place any limits. This would require reworking slab pool to support dynamic chunk size, which should be feasible (e.g. using buddy allocator). |
|
Please rebase on fresh develop to make CI green. |

In multi channel scenario a frame sz become too big and Frame Factory refuses to allocate frames. Here the max frame size is estimated similar way to max packet sz estimation.
gh-821