diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-26 14:25:44 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-26 14:25:44 +0100 |
commit | 3300b40fe6ecb750c91f0f53004839d9c1348daf (patch) | |
tree | 060e0d0b5606ede44489e01ca57aa43f57318568 | |
parent | 898ad308e5d15047f9347543fb763a6699994015 (diff) | |
parent | 4a7c93708e6cd33b04ef802cd69912bcf1b3f08c (diff) |
Merge pull request #73958 from davicr/stream_change_crash
Fix crash when changing VideoStreamPlayer.Stream
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index b38f7225a2..6c961813b4 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -251,8 +251,12 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { /* we're expecting more header packets. */ while ((theora_p && theora_p < 3) || (vorbis_p && vorbis_p < 3)) { + int ret = 0; + /* look for further theora headers */ - int ret = ogg_stream_packetout(&to, &op); + if (theora_p && theora_p < 3) { + ret = ogg_stream_packetout(&to, &op); + } while (theora_p && theora_p < 3 && ret) { if (ret < 0) { fprintf(stderr, "Error parsing Theora stream headers; corrupt stream?\n"); @@ -269,7 +273,9 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { } /* look for more vorbis header packets */ - ret = ogg_stream_packetout(&vo, &op); + if (vorbis_p && vorbis_p < 3) { + ret = ogg_stream_packetout(&vo, &op); + } while (vorbis_p && vorbis_p < 3 && ret) { if (ret < 0) { fprintf(stderr, "Error parsing Vorbis stream headers; corrupt stream?\n"); |