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

To resolve the 'client_id' error when making asynchronous calls, you need to pass the parameter 'cid' from outside into the on_play/stop/unpublish functions. This can be achieved by modifying the code as follows: python def on_play(cid): # Your code here # Use the 'cid' parameter to resolve the 'client_id' error def on_stop(cid): # Your code here # Use the 'cid' parameter to resolve the 'client_id' error def on_unpublish(cid): # Your code here # Use the 'cid' parameter to resolve the 'client_id' error By passing the 'cid' parameter from outside, you can access it within the on_play/stop/unpublish functions and use it to resolve the 'client_id' error. #2639

Closed

Conversation

duiniuluantanqin
Copy link
Member

@duiniuluantanqin duiniuluantanqin commented Sep 27, 2021

The SrsHttpHooks class will assign the current coroutine's cid to client_id and then callback. There is no problem when used synchronously, but the on_stop/unpublish of RTC and on_play/stop of HLS are all asynchronously called, which will cause the client_id of each callback to be the same. This is what is mentioned in this issue. This PR solves the above problem.


TRANS_BY_GPT3

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2021

Codecov Report

Merging #2639 (a20a6e2) into develop (7d3ec99) will increase coverage by 0.00%.
The diff coverage is 21.73%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2639   +/-   ##
========================================
  Coverage    59.36%   59.36%           
========================================
  Files          122      122           
  Lines        51890    51891    +1     
========================================
+ Hits         30805    30807    +2     
+ Misses       21085    21084    -1     

| Impacted Files | Coverage Δ | |'

Translated to English while maintaining the markdown structure:

'| Impacted Files | Coverage Δ | |
|---|---|---|
| trunk/src/app/srs_app_http_hooks.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_http_stream.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_api.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_conn.cpp | 10.43% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtmp_conn.cpp | 0.00% <0.00%> (ø) | |'

Translated to English while maintaining the markdown structure:

'| trunk/src/app/srs_app_http_hooks.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_http_stream.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_api.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtc_conn.cpp | 10.43% <0.00%> (ø) | |
| trunk/src/app/srs_app_rtmp_conn.cpp | 0.00% <0.00%> (ø) | |
| trunk/src/app/srs_app_http_static.cpp | 45.49% <41.66%> (+0.08%) | ⬆️ |


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data'

Translated to English while maintaining the markdown structure:

'> Δ = absolute <relative> (impact), ø = not affected, ? = missing data

Powered by Codecov. Last update 7d3ec99...a20a6e2. Read the comment docs.

TRANS_BY_GPT3

@duiniuluantanqin duiniuluantanqin changed the title pass parameter ‘cid’ in http callback in order to asynchronous call pass parameter ‘cid’ from outside in on_play/stop/unpublish, to resolve ‘client_id’ error when asynchronous call Sep 27, 2021
@winlinvip winlinvip changed the title pass parameter ‘cid’ from outside in on_play/stop/unpublish, to resolve ‘client_id’ error when asynchronous call To resolve the 'client_id' error when making asynchronous calls, you need to pass the parameter 'cid' from outside into the on_play/stop/unpublish functions. This can be achieved by modifying the code as follows: python def on_play(cid): # Your code here # Use the 'cid' parameter to resolve the 'client_id' error def on_stop(cid): # Your code here # Use the 'cid' parameter to resolve the 'client_id' error def on_unpublish(cid): # Your code here # Use the 'cid' parameter to resolve the 'client_id' error By passing the 'cid' parameter from outside, you can access it within the on_play/stop/unpublish functions and use it to resolve the 'client_id' error. Jul 29, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
3 participants