From 8d2efe75ae8a18acc2da7bedb807a76afa83d8b7 Mon Sep 17 00:00:00 2001
From: Mark Kuo <starryalley@gmail.com>
Date: Thu, 19 Sep 2019 15:28:33 +1000
Subject: Fix VideostreamGDNative audio buffer handling

Fix the audio buffer start when there are previous remains
---
 modules/gdnative/videodecoder/video_stream_gdnative.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'modules/gdnative/videodecoder')

diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index be131c5402..212ff51b80 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -149,7 +149,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
 	if (mix_callback) {
 		if (pcm_write_idx >= 0) {
 			// Previous remains
-			int mixed = mix_callback(mix_udata, pcm, samples_decoded);
+			int mixed = mix_callback(mix_udata, pcm + pcm_write_idx * num_channels, samples_decoded);
 			if (mixed == samples_decoded) {
 				pcm_write_idx = -1;
 			} else {
-- 
cgit v1.2.3