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

OGG playback errors printed occasionally when stopping specific OGG file near the end in audio preview dialog #59348

Closed
Tracked by #76797
lufog opened this issue Mar 20, 2022 · 11 comments · Fixed by #71314 or #80452

Comments

@lufog
Copy link
Contributor

lufog commented Mar 20, 2022

Godot version

v4.0.beta8.official (45cac42), v4.0.beta.custom_build (62a5082)

System information

Windows 11, Forward+, GeForce GTX 1660 (527.56)

Issue description

When you stop pause an audio file near the end, Godot crashes.

console output
Godot Engine v4.0.beta8.official.45cac42c0 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1660

ERROR: Condition "p_points.size() < 2" is true.
 at: canvas_item_add_multiline (servers/rendering/renderer_canvas_cull.cpp:1077)
WARNING: ran out of packets in stream
   at: _mix_frames_vorbis (modules/vorbis/audio_stream_ogg_vorbis.cpp:152)
ERROR: Condition "mixed < 0" is true. Returning: 0
 at: _mix_internal (modules/vorbis/audio_stream_ogg_vorbis.cpp:62)
ERROR: Index p_index = 13 is out of bounds (size() = 13).
 at: get (./core/templates/cowdata.h:155)

Steps to reproduce

2022-03-20.14-29-27.mp4

Minimal reproduction project

StopSoudCrashTest_G4.zip

@Chaosus Chaosus added this to the 4.0 milestone Mar 20, 2022
@KoBeWi
Copy link
Member

KoBeWi commented Mar 20, 2022

There is no crash stack trace, I only see this printed:

WARNING: Burning negative samples doesn't make sense. Check seek algorithm.
     at: AudioStreamPlaybackOGGVorbis::seek (modules\vorbis\audio_stream_ogg_vorbis.cpp:257)
WARNING: ran out of packets in stream
     at: AudioStreamPlaybackOGGVorbis::_mix_frames_vorbis (modules\vorbis\audio_stream_ogg_vorbis.cpp:90)
ERROR: Index p_index = 11 is out of bounds (size() = 11).
   at: CowData<class Vector<class Vector<unsigned char> > >::get (C:\godot_source\core/templates/cowdata.h:163)

@gustavi
Copy link

gustavi commented Mar 29, 2022

@KoBeWi I can reproduce the "WARNING: Burning negative samples doesn't make sense. Check seek algorithm." with deterministic code (audio_stream_player.play(9.29599952697754). Is that a bug?

@KoBeWi
Copy link
Member

KoBeWi commented Mar 29, 2022

If it doesn't involve user error (like wrong usage, corrupted file etc.) then it's a bug.

@NiclasEriksen
Copy link

I get the same warnings, Linux / Vulkan / AMD 6600x.

It happens in my dynamic music system, where I seek on the next track to the position of the current playing one before cross-fading (Tween). There is no noticeable effects other than the warning being printed, the audio transitions smoothly and in sync. All tracks are of exactly equal length when exported, but I can't be sure that there aren't discrepancies anyway in how the audio is handled.

var t = get_track(current_track)
var sp = t.get_playback_position()
var nt = get_track(next)

nt.play()
nt.seek(sp)
last_track = current_track

reset_tweens()
fade_tween_current.tween_property(tracks[current_track], "volume", -80.0, crossfade_time)
fade_tween_next.tween_property(tracks[next], "volume", 0.0, crossfade_time)
current_track = next

$StopTimer.start(crossfade_time)  # stop() on the last track on timeout

@akien-mga
Copy link
Member

I can't reproduce this issue in 4.0 beta 13. Can you confirm that it's fixed?

@KoBeWi
Copy link
Member

KoBeWi commented Jan 19, 2023

Can't reproduce either. OGGs got new import dialog, so this could've fixed it.

@KoBeWi KoBeWi closed this as completed Jan 19, 2023
@lufog
Copy link
Contributor Author

lufog commented Jan 20, 2023

Can reproduce it on v4.0.beta13.official [caacade]:

2023-01-20.12-15-59.mp4

@Calinou Calinou reopened this Jan 20, 2023
@lufog
Copy link
Contributor Author

lufog commented Jan 20, 2023

Sorry for the false warning, this crash has indeed been fixed in master. Apparently, the fix didn't make it into beta13. From now on, I will try to check first on the latest dev builds.

By the way, in master, errors still appear in the console. But the editor no longer crashes.

Editing project: E:/Programming/cr-pl.games/godot/4.x/lufog.tests/StopSoudCrashTest_G4
Godot Engine v4.0.beta.custom_build.2f2bf8489 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1660

ERROR: Condition "p_points.size() < 2" is true.
   at: RendererCanvasCull::canvas_item_add_multiline (servers\rendering\renderer_canvas_cull.cpp:1151)
WARNING: Burning negative samples doesn't make sense. Check seek algorithm.
     at: AudioStreamPlaybackOggVorbis::seek (modules\vorbis\audio_stream_ogg_vorbis.cpp:331)
WARNING: ran out of packets in stream
     at: AudioStreamPlaybackOggVorbis::_mix_frames_vorbis (modules\vorbis\audio_stream_ogg_vorbis.cpp:152)
ERROR: Condition "mixed < 0" is true. Returning: 0
   at: AudioStreamPlaybackOggVorbis::_mix_internal (modules\vorbis\audio_stream_ogg_vorbis.cpp:62)
ERROR: Condition "page_cursor >= ogg_packet_sequence->page_data.size()" is true. Returning: false
   at: OggPacketSequencePlayback::next_ogg_packet (modules\ogg\ogg_packet_sequence.cpp:139)
WARNING: ran out of packets in stream
     at: AudioStreamPlaybackOggVorbis::_mix_frames_vorbis (modules\vorbis\audio_stream_ogg_vorbis.cpp:152)
ERROR: Condition "mixed < 0" is true. Returning: 0
   at: AudioStreamPlaybackOggVorbis::_mix_internal (modules\vorbis\audio_stream_ogg_vorbis.cpp:62)
ERROR: Condition "page_cursor >= ogg_packet_sequence->page_data.size()" is true. Returning: false
   at: OggPacketSequencePlayback::next_ogg_packet (modules\ogg\ogg_packet_sequence.cpp:139)
WARNING: ran out of packets in stream
     at: AudioStreamPlaybackOggVorbis::_mix_frames_vorbis (modules\vorbis\audio_stream_ogg_vorbis.cpp:152)
ERROR: Condition "mixed < 0" is true. Returning: 0
   at: AudioStreamPlaybackOggVorbis::_mix_internal (modules\vorbis\audio_stream_ogg_vorbis.cpp:62)
ERROR: Condition "page_cursor >= ogg_packet_sequence->page_data.size()" is true. Returning: false
   at: OggPacketSequencePlayback::next_ogg_packet (modules\ogg\ogg_packet_sequence.cpp:139)
WARNING: ran out of packets in stream
     at: AudioStreamPlaybackOggVorbis::_mix_frames_vorbis (modules\vorbis\audio_stream_ogg_vorbis.cpp:152)
ERROR: Condition "mixed < 0" is true. Returning: 0
   at: AudioStreamPlaybackOggVorbis::_mix_internal (modules\vorbis\audio_stream_ogg_vorbis.cpp:62)

@akien-mga
Copy link
Member

The page_cursor error was indeed added with #71314 which would prevent the crash.

I couldn't reproduce the crash with 4.0 beta 13 when testing a dozen times, but today I managed to trigger it after another dozen attempts. So I'm not sure this one specifically is about the OGG file being corrupted (unlike #67446), so let's keep it open to investigate why these errors come up in a seemingly random way.

@akien-mga akien-mga modified the milestones: 4.0, 4.x Jan 20, 2023
@akien-mga akien-mga removed the crash label Jan 20, 2023
@akien-mga akien-mga changed the title Editor crash if audio stops near the end OGG playback errors printed occasionally when stopping specific OGG file near the end in audio preview dialog Jan 20, 2023
@MJacred
Copy link
Contributor

MJacred commented May 10, 2023

As @ellenhp mentioned here, the seek algorithm isn't sample accurate. The sample burning code is also wrong, which probably causes some, if not all, errors

@MJacred
Copy link
Contributor

MJacred commented Aug 24, 2023

Can confirm warnings on Godot 4.1.1 on Ubuntu 20.04

modules/vorbis/audio_stream_ogg_vorbis.cpp:332 - Burning negative samples doesn't make sense. Check seek algorithm.
modules/vorbis/audio_stream_ogg_vorbis.cpp:153 - ran out of packets in stream
modules/vorbis/audio_stream_ogg_vorbis.cpp:63 - Condition "mixed < 0" is true. Returning: 0
modules/ogg/ogg_packet_sequence.cpp:140 - Condition "page_cursor >= ogg_packet_sequence->page_data.size()" is true. Returning: false
modules/vorbis/audio_stream_ogg_vorbis.cpp:153 - ran out of packets in stream
modules/vorbis/audio_stream_ogg_vorbis.cpp:63 - Condition "mixed < 0" is true. Returning: 0
modules/ogg/ogg_packet_sequence.cpp:140 - Condition "page_cursor >= ogg_packet_sequence->page_data.size()" is true. Returning: false

Will be fixed, if PR #80452 is merged (tested it couple dozen times).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants