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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
SrsHttpHooks
class will assign the current coroutine'scid
toclient_id
and then callback. There is no problem when used synchronously, but theon_stop/unpublish
of RTC andon_play/stop
of HLS are all asynchronously called, which will cause theclient_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