Fix module-null-source crash when disconnecting call while lcd off with usb disconnected 30/105730/5
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 19 Dec 2016 10:18:18 +0000 (19:18 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 19 Dec 2016 10:25:25 +0000 (19:25 +0900)
[Version] 5.0.101
[Profile] Common
[Issue Type] JIRA

Change-Id: If95fb8d747f3b66766496add5f2a08717d66fa41

packaging/pulseaudio.spec
src/modules/module-null-source.c

index b10c1fe..bf0e5e4 100644 (file)
@@ -11,7 +11,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          5.0
-Release:          100
+Release:          101
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
 URL:              http://pulseaudio.org
index e3e0167..cd3e260 100644 (file)
@@ -147,6 +147,17 @@ static void thread_func(void *userdata) {
             if ((chunk.length = pa_usec_to_bytes(now - u->timestamp, &u->source->sample_spec)) > 0) {
 
                 chunk.memblock = pa_memblock_new(u->core->mempool, (size_t) -1); /* or chunk.length? */
+#ifdef __TIZEN__
+                /* Sometimes calculated chunk.length is larger than the block size of mempool when -1 is given for size input.
+                   Following code will realloc with actual calculated size again to prevent assert error during pa_source_post() */
+                if (chunk.length > pa_memblock_get_length(chunk.memblock)) {
+                    pa_log_warn("Exception occurs!! chunk.length(%d) > memblock_length(%d), do memblock_new() with actual length again",
+                                 chunk.length, pa_memblock_get_length(chunk.memblock));
+
+                    pa_memblock_unref(chunk.memblock);
+                    chunk.memblock = pa_memblock_new(u->core->mempool, chunk.length);
+                }
+#endif
                 chunk.index = 0;
                 pa_source_post(u->source, &chunk);
                 pa_memblock_unref(chunk.memblock);