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

on_publish action in HTTP Hook done not return all param as expect #3791

Closed
wangborong12345 opened this issue Sep 1, 2023 · 1 comment
Closed
Labels
TransByAI Translated by AI/GPT.

Comments

@wangborong12345
Copy link

wangborong12345 commented Sep 1, 2023

Note: Please read FAQ before file an issue, see #2716

Description

English:
I use the RTMP URL: rtmp://yulee.local:1935/live/livestream?secret=spy&token=hellotoken to push the stream. Then, I can receive the on_publish action in the HTTP Hook. Up to this point, everything works fine. However, ?secret=spy&token=hellotoken does not exist in the on_publish action request parameter. It only sends "?secret=spy" in the param field.

Chinese:
I use the URL: rtmp://yulee.local:1935/live/livestream?secret=spy&token=hellotoken to push the stream to SRS, and everything is working fine. Then, I ran the main branch of SRS Stack, and debugged the method on line 54 in srs_hooks.go, which is the HTTP Hook for on_publish. I found that the request parameters for the on_publish Hook are incomplete, missing &token=hellotoken and only having ?secret=spy.

  1. SRS Version: 5.0

  2. SRS Config:

    http_hooks {
        enabled         on;
        on_publish      http://172.17.0.1:2024/terraform/v1/hooks/srs/verify;
        on_unpublish    http://172.17.0.1:2024/terraform/v1/hooks/srs/verify;
        on_play         http://172.17.0.1:2024/terraform/v1/hooks/srs/verify;
        on_stop         http://172.17.0.1:2024/terraform/v1/hooks/srs/verify;
        on_hls          http://172.17.0.1:2024/terraform/v1/hooks/srs/hls;
    }

Replay

Please describe how to replay the bug?

Step 1:

ffmpeg -f gdigrab -framerate 2 -i desktop -c:v libx264 -x264-params "bframes=0" \
  -profile:v baseline -b:v 100k -s 1280x720 -preset veryfast -tune zerolatency  -pix_fmt yuv420p \
  -f flv rtmp://yulee.local:1935/live/livestream?secret=spy&token=hellotoken

Step 2:

debug on_publish function

Expect

English:
return all param, "?secret=spy&token=hellotoken"

Chinese:
I think it should return all parameters.

TRANS_BY_GPT4

@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Sep 1, 2023
@winlinvip
Copy link
Member

winlinvip commented Sep 1, 2023

This is not a problem with the callback, but with your streaming command. In the bash command line, the special character & represents starting in the background. You should modify your command line:

ffmpeg -f gdigrab -framerate 2 -i desktop -c:v libx264 -x264-params "bframes=0" \
  -profile:v baseline -b:v 100k -s 1280x720 -preset veryfast -tune zerolatency  -pix_fmt yuv420p \
  -f flv "rtmp://yulee.local:1935/live/livestream?secret=spy&token=hellotoken"

Use double quotes or single quotes to avoid the & issue.

TRANS_BY_GPT4

@winlinvip winlinvip closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 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
Development

No branches or pull requests

2 participants