-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Fix bug for HTTP, failed to download large file recorded with 2GB #2780 #2781
Conversation
Thank you for the PR, but it's indeed not quite suitable. No worries, we will find time to take a look.
|
@@ -137,7 +137,7 @@ srs_error_t SrsVodStream::serve_flv_stream(ISrsHttpResponseWriter* w, ISrsHttpMe | |||
return err; | |||
} | |||
|
|||
srs_error_t SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, string fullpath, int start, int end) | |||
srs_error_t SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, string fullpath, int start, long end) |
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.
It is more appropriate to use int64_t instead of long.
TRANS_BY_GPT3
@@ -180,8 +180,8 @@ srs_error_t SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, ISrsHttpMe | |||
fs->seek2(start); | |||
|
|||
// send data | |||
if ((err = copy(w, fs, r, (int)left)) != srs_success) { | |||
return srs_error_wrap(err, "read mp4=%s size=%d", fullpath.c_str(), (int)left); | |||
if ((err = copy(w, fs, r, left)) != srs_success) { |
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.
If only the left
variable type is changed to int64_t
, but the declaration of copy(ISrsHttpResponseWriter* w, SrsFileReader* fs, ISrsHttpMessage* r, int64_t size)
should also be modified to int64_t
, and the variable types inside the copy function should remain consistent, otherwise the modification will not be achieved.
TRANS_BY_GPT3
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.
Could you please create a new PR? @CodeflowSun mentioned that he works with Java, so it may not be suitable for him to continue modifying the C++ code. Please make sure to maintain the markdown structure.
@CodeflowSun has already identified the problem, which is already very good. Please make sure to maintain the markdown structure.
Thank you very much to both of you. 🙏 Please make sure to maintain the markdown structure.
TRANS_BY_GPT3
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.
Okay, I will create a new PR to address this issue. Thanks to @CodeflowSun for helping to identify the problem 🙏.
TRANS_BY_GPT3
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.
When modifying the distribution of mp4 files, it was discovered that flv files also have this issue. offset
is defined as int
type. If you use ffplay http://127.0.0.1:8080/test.flv
, the flv file will keep buffering after exceeding 2GB. After making modifications, it was found that flv does not support range operations. Summarizing the above observations:
- When distributing mp4 and flv files, if they exceed 2GB, there will be overflow or connection timeout issues.
- When distributing flv files, VLC player will exit or fail when dragging.
TRANS_BY_GPT3
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.
When modifying the distribution of mp4 files, it was found that flv also had this problem.
offset
is defined asint
type. Ifffplay http://127.0.0.1:8080/test.flv
is used, the flv file will freeze indefinitely after exceeding 2GB. After modification, it was found that range operation is not supported for flv. Summarize the above phenomena: 1. When distributing mp4 and flv files, if they exceed 2GB, overflow or connection timeout may occur. 2. When distributing flv files, VLC will exit or fail when dragging during playback.
Phenomenon 2, when dragging to play flv, does not support the range parameter. Is it necessary? When distributing flv files using nginx, it supports range operation.
TRANS_BY_GPT3
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.
Hi, I would like to ask if the drag-and-drop feature for FLV files has been resolved?
TRANS_BY_GPT3
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 compiled nginx with the following configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_mp4_module --with-http_flv_module.
At the same time, I used yamdi to add keyframe information to the recorded videos.
yamdi -i source.flv -o dest.flv //input video output video
Then, I can use nginx to play the recorded files and enable dragging and dropping.
So, the problem should be that the DVR recording does not include keyframe information, which is why dragging and dropping playback is not possible.
TRANS_BY_GPT3
Fix by #2809 Thanks again @CodeflowSun @chundonglinlin |
I work with Java and have no knowledge of C++. Based on my personal understanding, I made some fixes to #2780. If there are any inappropriate modifications, please forgive me. Just close this PR if necessary. Currently, based on my judgment, most of the modifications should be fine, but I feel that there is a certain level of risk in one line of code modification.
There are two concerns regarding this modification:
TRANS_BY_GPT3