Skip to content

Ensure audio frame when publishing #690

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hiroshihorie
Copy link
Member

@hiroshihorie hiroshihorie commented May 5, 2025

Ensure at least one audio frame was generated before returning publish().

@hiroshihorie hiroshihorie requested review from ladvoc and pblazej May 5, 2025 17:17
Copy link
Contributor

@pblazej pblazej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🟢 maybe a little comment, why this dependency is even needed? What if we publish before rendering?

@hiroshihorie
Copy link
Member Author

hiroshihorie commented May 6, 2025

If I remember correctly, if no audio frames arrive, the server fails to create the RTC track. The publish() call still returns but silently fails to publish.

Am I right ? @boks1971 😅

@boks1971
Copy link

boks1971 commented May 6, 2025

If I remember correctly, if no audio frames arrive, the server fails to create the RTC track. The publish() call still returns but silently fails to publish.

Am I right ? @boks1971 😅

Yes and no @hiroshihorie .

Yes - server needs at least one packet to declare onTrack.
No - going forward, pion can fire on track based on negotiated SDP and does not need a packet (still needs it for simulcast video tracks, but if the SDP contains the SSRC of the track, it can fire onTrack without an RTP packet). But, that feature is not enabled yet in cloud production deploy.

@hiroshihorie
Copy link
Member Author

Thanks for the details @boks1971 🙏

Ideally, if track.start() succeeds, we can guarantee that frames will be generated. However, in some edge cases it appears to fail silently, so I think we should add something like this PR as an interim additional check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants