diff options
-rw-r--r-- | modules/gdnative/videodecoder/video_stream_gdnative.cpp | 10 | ||||
-rw-r--r-- | modules/tinyexr/image_saver_tinyexr.cpp | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index 14b7f9a2ef..ab14f01858 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -123,9 +123,12 @@ bool VideoStreamPlaybackGDNative::open_file(const String &p_file) { godot_vector2 vec = interface->get_texture_size(data_struct); texture_size = *(Vector2 *)&vec; + // Only do memset if num_channels > 0 otherwise it will crash. + if (num_channels > 0) { + pcm = (float *)memalloc(num_channels * AUX_BUFFER_SIZE * sizeof(float)); + memset(pcm, 0, num_channels * AUX_BUFFER_SIZE * sizeof(float)); + } - pcm = (float *)memalloc(num_channels * AUX_BUFFER_SIZE * sizeof(float)); - memset(pcm, 0, num_channels * AUX_BUFFER_SIZE * sizeof(float)); pcm_write_idx = -1; samples_decoded = 0; @@ -146,7 +149,8 @@ void VideoStreamPlaybackGDNative::update(float p_delta) { ERR_FAIL_COND(interface == NULL); interface->update(data_struct, p_delta); - if (mix_callback) { + // Don't mix if there's no audio (num_channels == 0). + if (mix_callback && num_channels > 0) { if (pcm_write_idx >= 0) { // Previous remains int mixed = mix_callback(mix_udata, pcm + pcm_write_idx * num_channels, samples_decoded); diff --git a/modules/tinyexr/image_saver_tinyexr.cpp b/modules/tinyexr/image_saver_tinyexr.cpp index e1d42d3217..894f223597 100644 --- a/modules/tinyexr/image_saver_tinyexr.cpp +++ b/modules/tinyexr/image_saver_tinyexr.cpp @@ -262,10 +262,6 @@ Error save_exr(const String &p_path, const Ref<Image> &p_img, bool p_grayscale) header.channels = channel_infos; header.pixel_types = pixel_types; header.requested_pixel_types = requested_pixel_types; - // TODO DEBUG REMOVE - for (int i = 0; i < 4; ++i) { - print_line(String("requested_pixel_types{0}: {1}").format(varray(i, requested_pixel_types[i]))); - } CharString utf8_filename = p_path.utf8(); const char *err; |