-
-
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
DVR: Segments are not stored according to dvr_duration. #2717
Comments
What codec is this?
Is it related to your codec? Can you reproduce this issue by changing it to
|
There is a problem with the streaming command:
|
Configuration 1: srs/trunk/src/app/srs_app_dvr.cpp Line 866 in 8bc2759
Configuration 2: srs/trunk/src/app/srs_app_dvr.cpp Line 853 in 8bc2759
At this point, it will enter into an infinite loop logic, resulting in a Segmentation fault error when writing the DVR file.
|
If streaming is done according to the following configuration, it will enter a DVR infinite loop. The main reason is that when reopening a fragment, the duration of the fragment is not reset to zero.
Streaming commands: PS: Configuration for causing an infinite loop is guaranteed to occur.
|
Minimum reproduction path, setting
Around 10 seconds, the second slice starts to refresh the screen, continuously generating new DVR files.
Root CauseDebugging revealed that
Of course, new DVR files will be continuously generated. Except for the first DVR file, the rest will only contain sequence header and metadata if there is no content. There is an assumption here that is problematic, which is the recursion of Why Works for Wait KeyframeWhy does it work fine when waiting for a keyframe? The debugging is shown in the following image: It can be seen that although The subsequent duration calculation is correct, which is 0, so there is no problem. Therefore, there is an issue here, which is that the duration calculation is incorrect, especially when
// When waitkeyframe=on, if the condition is not met, it returns. If waitkeyframe=off, it will recursively call indefinitely.
// Here, the duration of the slice will be recalculated and reset to 0, which is why there is no problem when waitkeyframe=on.
Solution
|
Test the 3.0 release version, and this problem also exists. The time when this problem was introduced is approximately Thu Feb 9 15:42:42 2017. Compare: 455d9b2...00abaf4 The implementation logic before 3.0 release is as follows:
There will be no recursive call to
|
Thank you, Boss Yang, for your guidance. The analysis is very clear. Currently, I have thought of several repair methods: Method 1: Clean up fragment duration when open/close;
|
Solving the infinite recursion problem: 4d09b8c After trying it out, the problem of continuous slicing no longer occurs, and it has been resolved. However, the duration issue has not been completely resolved and still poses a potential risk.
|
merged code according to issue 2717 link: ossrs/srs#2717
Should be fixed in SRS 4 |
Description'
Please ensure that you maintain the markdown structure.
SRS version (Version):
4.0.177
The log of SRS is as follows (Log): When dvr_wait_keyframe is enabled, there is no segmentation and no abnormal log. When dvr_wait_keyframe is disabled, there is segmentation, but the segmentation is incorrect. The log is as follows:
Replay
How to replay bug?
Steps to reproduce the bug:
./objs/srs -c myconf.conf
in docker.ffmpeg -re -i ./1024x556.rmvb -y -f flv rtmp://127.0.0.1/live/test
.dvr_duration
(10 seconds).dvr_wait_keyframe
is disabled, there will be issues starting from the second segment.Expected behavior:
Make sure to maintain the markdown structure.
> Store recorded videos in segments according to dvr_duration (10 seconds).
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: