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

HTTP: Failed to download large file recorded with 2GB. #2780

Closed
CodeflowSun opened this issue Dec 9, 2021 · 3 comments · Fixed by #2809
Closed

HTTP: Failed to download large file recorded with 2GB. #2780

CodeflowSun opened this issue Dec 9, 2021 · 3 comments · Fixed by #2809
Assignees
Labels
Bug It might be a bug. PullRequest Has PR or solution in issue. TransByAI Translated by AI/GPT.
Milestone

Comments

@CodeflowSun
Copy link

CodeflowSun commented Dec 9, 2021

Description'

Please ensure that the markdown structure is maintained.

  1. SRS version: 4.0'

Please ensure that the markdown structure is maintained.

  1. The log of SRS is as follows:

Please ensure that the markdown structure is maintained.

HTTP #0 39.152.7.125:25758 GET http://123.6.55.240:18080/live/202112070435020001.2021.12.09.11.30.36.mp4, content-length=-1
[2021-12-09 16:49:38.132][Trace][31841][31w7h85h] http match file=./objs/nginx/html/live/202112070435020001.2021.12.09.11.30.36.mp4, pattern=/, upath=/live/202112070435020001.2021.12.09.11.30.36.mp4
[2021-12-09 16:49:38.132][Trace][31841][31w7h85h] TCP: before dispose resource(HttpStream)(0x20346f0), conns=5, zombies=0, ign=0, inz=0, ind=0
[2021-12-09 16:49:38.132][Error][31841][31w7h85h][11] serve error code=3014 : process request=0 : mux serve : serve http : http mp4 streaming ./objs/nginx/html/live/202112070435020001.2021.12.09.11.30.36.mp4 overflow. size=2846362636, offset=0
  1. Specific situation:
    We recorded a video with a duration of 156 minutes in MP4 format. After recording, the video cannot be downloaded. However, after downloading it to the local device via FTP, the video can be played normally using software. The size of the video is 2.65GB.

Please ensure that the markdown structure is maintained.

Reproduction (Replay)

Please ensure that the markdown structure is maintained.

  1. You can upload a file larger than 2GB to the SRS server.
  2. Access through HTTP.

Please make sure to maintain the markdown structure.

Expected Behavior
Normal download

Please make sure to maintain the markdown structure.

The problem has been found, the key is in srs_app_http_static.cpp:157.

Please make sure to maintain the markdown structure.

    if (end == -1) {
        end = (int)(fs->filesize() - 1);
    }
    
    if (end > fs->filesize() || start > end || end < 0) {
        return srs_error_new(ERROR_HTTP_REMUX_OFFSET_OVERFLOW, "http mp4 streaming %s overflow. size=%" PRId64 ", offset=%d",
            fullpath.c_str(), fs->filesize(), start);
    }

The above code is from version 4.0 source code. When performing a type conversion, the "end" of a large file may become negative, causing subsequent exceptions to occur in the handling process.

Please make sure to maintain the markdown structure.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title 录制的大文件下载失败 HTTP: 2GB录制的大文件下载失败 Dec 10, 2021
@winlinvip winlinvip self-assigned this Dec 10, 2021
@winlinvip winlinvip added Bug It might be a bug. PullRequest Has PR or solution in issue. labels Dec 10, 2021
@winlinvip winlinvip modified the milestones: 4.0, 5.0 Dec 10, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 10, 2021

Not bad, welcome to submit a PR, bro 👍

TRANS_BY_GPT3

CodeflowSun pushed a commit to CodeflowSun/srs that referenced this issue Dec 10, 2021
@CodeflowSun
Copy link
Author

CodeflowSun commented Dec 10, 2021

The PR has been submitted, and the concerns have been mentioned in the PR.
I don't understand C++ and have only made fixes based on my own understanding. I also don't have a testing environment locally, so this bare submission carries risks. Please understand.

TRANS_BY_GPT3

@CodeflowSun
Copy link
Author

CodeflowSun commented Dec 10, 2021

To briefly explain our current solution, I have not disabled the SRS HTTP service here. We have implemented an MP4 filtering in the outer layer of Nginx. If the request is for an MP4 file, Nginx directly serves as a web server to provide MP4 download service.

TRANS_BY_GPT3

@winlinvip winlinvip linked a pull request Dec 25, 2021 that will close this issue
@winlinvip winlinvip changed the title HTTP: 2GB录制的大文件下载失败 HTTP: Failed to download large file recorded with 2GB. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. PullRequest Has PR or solution in issue. TransByAI Translated by AI/GPT.
Projects
None yet
2 participants