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

How to prevent audio streaming from buffering data? #1303

Closed
zsk008 opened this issue Jan 18, 2019 · 3 comments
Closed

How to prevent audio streaming from buffering data? #1303

zsk008 opened this issue Jan 18, 2019 · 3 comments
Assignees
Labels
Enhancement Improvement or enhancement. TransByAI Translated by AI/GPT.
Milestone

Comments

@zsk008
Copy link

zsk008 commented Jan 18, 2019

  1. Use srs_aac_raw_publish to push the stream and use srs_play to play it. Close the publish, connect using play, and print out a frame of data first.
String onStatus
Object (1 items)
    Property 'code' String NetStream.Data.Start
[2019-01-18 17:26:01.35] Audio packet id=0/0.0/0.0, type=Audio, dts=44, pts=44, ndiff=0, diff=0, size=4, AAC(22KHz,16bit,Stereo,SH)

Why does SRS need to cache this frame of data? Can it be not cached? Because if we use srs_audio_raw_publish to push G711U stream, the encoding information will change. The player will first receive a frame of AAC data, and the subsequent data will be G711U. This will cause decoding issues.

TRANS_BY_GPT3

@zsk008
Copy link
Author

zsk008 commented Jan 18, 2019

Tested nginx-rtmp-module, there is no issue with the test.

TRANS_BY_GPT3

@zsk008
Copy link
Author

zsk008 commented Jan 21, 2019

I replied in issue 301: In this situation, if we use the rtmp protocol, the first frame dumped is always cache_sh_audio, which will affect the decoding afterwards. Now, I have fixed it.

 if (ds && cache_sh_audio && (ret = consumer->enqueue(cache_sh_audio, atc, jitter_algorithm)) != ERROR_SUCCESS) {
        srs_error("dispatch audio sequence header failed. ret=%d", ret);
        return ret;

Commenting it out can solve this problem, but will it affect HLS? Is there a better solution?

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 8, 2020

This is the cache for the sequence header, which can be cleared when stopping the streaming. Take some time to check if it is well compatible with the browser.

TRANS_BY_GPT3

@winlinvip winlinvip added the Enhancement Improvement or enhancement. label Jan 8, 2020
@winlinvip winlinvip added this to the SRS 3.0 release milestone Jan 8, 2020
@winlinvip winlinvip self-assigned this Sep 11, 2021
@winlinvip winlinvip changed the title 请问音频码流如何不缓存数据 How to prevent audio streaming from buffering data? Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement or enhancement. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants