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

Change Network and Hardware Latency #67

Open
ReComplexed opened this issue Mar 31, 2023 · 4 comments
Open

Change Network and Hardware Latency #67

ReComplexed opened this issue Mar 31, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@ReComplexed
Copy link

Hi,
This is a feature request:
Is it possible to add 2 options for Latency:
One for the actual device DSP Buffer Size and one for the Network Buffer Size?

Im getting around 200-300 ms of latency, and I want to be able to reduce that to like 40 (I have tested it out on my Laptop, our network Infrastructure can handle such small latency).

Hope this feature get's added soon!

@gavv
Copy link
Member

gavv commented Apr 8, 2023

Hi,

Some notes on how it can be implemented.

Receiver's pipeline latency, which includes network buffer and dsp buffer, corresponds to targetLatency in receiver config: https://github.com/roc-streaming/roc-java/blob/f075447d89c91456d860ad135b59ee7601115c84/src/main/java/org/rocstreaming/roctoolkit/ReceiverConfig.java#L134

For sender, there is no such setting, because it does not have network buffer.

There is also audio I/O latency, which corresponds to buffer size of AudioTrack (from Android API). We already ask it to use minimum possible buffer, so I don't think it needs configuration from UI.

Hence, I think all we need is to add one new filed to receiver tab, say, "Target latency, milliseconds", set its default value to, say, 200ms, and pass its value to ReceiverConfig.targetLatency.

@gavv gavv added enhancement New feature or request good first issue Good for newcomers help wanted Contributions are welcome labels Apr 8, 2023
@ReComplexed
Copy link
Author

Another thing to notice is that after a new value is entered in the GUI, the stream settings have to be reapplied or the stream has to be restarted.

(Sorry I accidentally posted with my ALT before)

@githubashutoshsoni
Copy link
Contributor

Can I take this up? I see there is a way to add the entered value the 200 should be added to sampleRateHz in the getMinBufferSize as below?

AudioTrack.getMinBufferSize(
            200,
            audioFormat.channelMask,
            audioFormat.encoding
        )

@gavv
Copy link
Member

gavv commented Oct 14, 2023

See my comment above regarding I/O latency, it's already minimum. Also, sample rate has nothing to do with latency.

@gavv gavv removed good first issue Good for newcomers help wanted Contributions are welcome labels Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants