From 1cd468f48d2728bf2dfc6fad7d19fc5ac9c6e359 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh78@gmail.com>
Date: Fri, 31 Jan 2025 21:40:27 +0900
Subject: [PATCH] Fix mis-calculation of orig_samplesize

orig_samplesize should be calculated from pcm->orig_format not
pcm->format.
---
 lib/unipcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/unipcm.c b/lib/unipcm.c
index 8d0081f..fa71f53 100644
--- a/lib/unipcm.c
+++ b/lib/unipcm.c
@@ -655,7 +655,7 @@ int _uniaud_pcm_write(uniaud_pcm *pcm, char* buffer, int size)
 			}
 		}
 #endif
-		orig_samplesize = uniaud_pcm_format_size(pcm->format, 1) * pcm->orig_channels;
+		orig_samplesize = uniaud_pcm_format_size(pcm->orig_format, 1) * pcm->orig_channels;
 		samplesize = uniaud_pcm_format_size(pcm->format, 1) * pcm->channels;
 		if (pcm->resample_size == 0) {
 			//printf("format: %i, orig format: %i chans: %i, ssize: %i\n",pcm->format, pcm->orig_format,
-- 
2.42.0

