-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix bug: loop transcoding #3516 #4325
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
base: develop
Are you sure you want to change the base?
fix bug: loop transcoding #3516 #4325
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
trunk/src/app/srs_app_encoder.cpp:243
- Passing req->vhost twice may be unintentional. Please verify the parameter order for srs_generate_rtmp_url to ensure that all components of the URL are correct.
std::string input = srs_generate_rtmp_url(SRS_CONSTS_LOCALHOST, req->port, req->vhost, req->vhost, req->app, req->stream, req->param);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses bug #3516 by correcting the RTMP URL formatting in the SrsEncoder::initialize_ffmpeg function.
- Replaces manual string concatenation with srs_generate_rtmp_url.
- Modifies parameter ordering to address the inversion of 'stream' and 'vhost'.
trunk/src/app/srs_app_encoder.cpp
Outdated
input += "/"; | ||
input += req->stream; | ||
|
||
std::string input = srs_generate_rtmp_url(SRS_CONSTS_LOCALHOST, req->port, req->vhost, req->vhost, req->app, req->stream, req->param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function call to srs_generate_rtmp_url explicitly passes 'req->vhost' twice; please verify that the parameter order is correct to ensure the URL is generated with 'stream' and 'vhost' in the intended positions.
std::string input = srs_generate_rtmp_url(SRS_CONSTS_LOCALHOST, req->port, req->vhost, req->vhost, req->app, req->stream, req->param); | |
std::string input = srs_generate_rtmp_url(SRS_CONSTS_LOCALHOST, req->port, req->vhost, req->stream, req->app, req->stream, req->param); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this patch really fix the bug?
The bug said the transcode stream can't output to same srs instance with same vhost.
output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
It seems this PR didn't improve anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root cause of the issue lies in the order of the vhosts, which leads this segment of code to fail; therefore, merely rearranging the order resolves the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've revised the code, which should render it more comprehensible.
deeb005
to
e464d9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR reorders the URL parameter placement in the encoder initialization to resolve bugs related to parameter mismatches.
- Reorders the placement of the "vhost" parameter from before the stream to after the stream.
- Aims to fix looping issues by aligning the input and output URL formats.
Comments suppressed due to low confidence (1)
trunk/src/app/srs_app_encoder.cpp:252
- The reordering of the URL parameters appears to address the reported issue, but please verify that the new sequence handles edge cases such as streams with existing query parameters; consider adding unit tests to ensure robustness.
input += "?vhost=";
What issue has been resolved?
for issue: #3516 #4055 #3618
What is the root cause of the problem?
The issue arises from a mismatch between the
input
andoutput
formats within theSrsEncoder::initialize_ffmpeg
function.For example:
Input:
rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__/livestream_ff
Output:
rtmp://127.0.0.1:1935/live/livestream_ff?vhost=__defaultVhost__
This may result in the failure of the code segment responsible for determining whether to loop.
What is the approach to solving this issue?
It simply involves modifying the order of
stream
andvhost
.How was the issue introduced?
The commit introducing this bug is: 7d47017
The order of parameters in the configuration file has been modified to address the
ingest
issue.Outstanding issues
Please note that this PR does not entirely resolve the issue; for example, modifying the
output
format in configuration still results in exceptions. To comprehensively address this problem, extensive code modifications would be required.However, strictly adhering to the configuration file format can effectively prevent this issue.