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

Prevent data race in stream when sending RTCP #3528

Merged
merged 2 commits into from
May 1, 2023
Merged

Prevent data race in stream when sending RTCP #3528

merged 2 commits into from
May 1, 2023

Conversation

sauwming
Copy link
Member

To fix #1973, copy pasted here for convenience:
"
Reported that race condition scenarios potentially occur in pjmedia_stream specifically in call hangup where UI/SIP thread invokes pjmedia_stream_destroy() and media/audio thread that may still doing some streaming processing, both may access the same pjmedia_stream states without mutex protection. For example, pjmedia_rtcp_build_rtcp_sdes() may be called at the same time:

UI/SIP thread:

    #0 pjmedia_rtcp_build_rtcp_sdes pjproject/pjmedia/build/../src/pjmedia/rtcp.c:1014:10
    #1 send_rtcp pjproject/pjmedia/build/../src/pjmedia/stream.c:991:11
    #2 pjmedia_stream_send_rtcp_bye pjproject/pjmedia/build/../src/pjmedia/stream.c:2943:9
    #3 pjsua_aud_stop_stream pjproject/pjsip/build/../src/pjsua-lib/pjsua_aud.c:505:2
    #4 stop_media_stream pjproject/pjsip/build/../src/pjsua-lib/pjsua_media.c:2462:2
    #5 stop_media_session pjproject/pjsip/build/../src/pjsua-lib/pjsua_media.c:2514:2
    #6 pjsua_media_channel_deinit pjproject/pjsip/build/../src/pjsua-lib/pjsua_media.c:2538:5
    ...

Media endpoint thread:

    #0 pjmedia_rtcp_build_rtcp_sdes pjproject/pjmedia/build/../src/pjmedia/rtcp.c:1014:10
    #1 send_rtcp pjproject/pjmedia/build/../src/pjmedia/stream.c:991:11
    #2 on_rx_rtp pjproject/pjmedia/build/../src/pjmedia/stream.c:1905:11
    ...

"

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

Successfully merging this pull request may close these issues.

Data races in pjmedia stream
3 participants