An ongoing MPEG-DASH livestream will have a manifest with `type="dynamic"`, which tells the reader that they should keep checking back for updates. Once the livestream ends the type will change to "static" indicating no more updates. You can see this by running the following command and inspecting `live.mpd` as it goes on: ``` ffmpeg -re -f lavfi -i testsrc -t 30 \ -c:v libx264 -preset veryfast -b:v 800k \ -c:a aac -b:a 128k \ -f dash -seg_duration 4 \ -window_size 5 -extra_window_size 2 \ -use_template 1 -use_timeline 1 \ -remove_at_exit 0 \ live.mpd ```
That change in the type should tell FFMPEG that the stream has ended, but if you run this command whilst the stream is ongoing you'll see it never exits: ``` ffmpeg -i live.mpd -y out.mp4 ``` This is due to a bug in how "liveness" is decided. It checks the manifest type value on every parse, but only assigns a value to `is_live` if the type is dynamic. It never unsets that flag. This commit changes that by always setting that flag on every manifest parse. Re-running the commands shows FFMPEG exiting properly when the stream finishes. The FATE test suite passes locally when I run it. Testing this required two FFMPEG processes running concurrently so no regression test has been added, as I couldn't figure out how to get FATE working with that. Signed-off-by: Matthew Crossley <[email protected]<mailto:[email protected]>> --- libavformat/dashdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index f3985788f4..af03421943 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1336,8 +1336,7 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) ret = AVERROR_INVALIDDATA; goto cleanup; } - if (!av_strcasecmp(val, "dynamic")) - c->is_live = 1; + c->is_live = !av_strcasecmp(val, "dynamic"); xmlFree(val); attr = node->properties; -- 2.50.1 (Apple Git-155) This e-mail is for the sole use of the intended recipient and contains information that may be privileged and/or confidential. If you are not an intended recipient, please notify the sender by return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures can be accessed on our website: https://www.thomsonreuters.com/en/resources/disclosures.html _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
