[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] pulsecore: Add exception judgment to fix the crash when playing music

Tanu Kaskinen gitlab at gitlab.freedesktop.org
Mon Jul 20 11:40:42 UTC 2020



Tanu Kaskinen pushed to branch master at PulseAudio / pulseaudio


Commits:
b5a6365f by zhaochengyi at 2020-07-20T01:14:54+00:00
pulsecore: Add exception judgment to fix the crash when playing music

When playing music for a period of time, the Shared Memory is
frequently accessed, and occasionally read/write errors occur,
which causes the program to crash

[Current thread is 1 (Thread 0xffff86823010 (LWP 2841))]
(gdb) bt
0  0x0000ffff8702a714 in __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
1  0x0000ffff870188e8 in __GI_abort () at abort.c:79
2  0x0000ffff873b5728 in do_read (p=p at entry=0x3673a170, re=re at entry=0x3673a338) at pulsecore/pstream.c:856
3  0x0000ffff873b7fd8 in do_pstream_read_write (p=0x3673a170) at pulsecore/pstream.c:248
4  0x0000ffff873b8368 in srb_callback (srb=<optimized out>, userdata=0x3673a170) at pulsecore/pstream.c:287
5  0x0000ffff873b8bec in srbchannel_rwloop (sr=0x36766ae0) at pulsecore/srbchannel.c:190
6  0x0000ffff87339c70 in dispatch_pollfds (m=0x36670db0) at pulse/mainloop.c:655
7  0x0000ffff87339c70 in pa_mainloop_dispatch (m=m at entry=0x36670db0) at pulse/mainloop.c:898
8  0x0000ffff8733a01c in pa_mainloop_iterate (m=0x36670db0, block=<optimized out>, retval=0xffffd9683030) at pulse/mainloop.c:929
9  0x0000ffff8733a0d8 in pa_mainloop_run (m=m at entry=0x36670db0, retval=retval at entry=0xffffd9683030) at pulse/mainloop.c:945
10 0x0000000000406894 in main (argc=<optimized out>, argv=<optimized out>) at daemon/main.c:1144

Signed-off-by: zhaochengyi <zhaochengyi at uniontech.com>

- - - - -


1 changed file:

- src/pulsecore/pstream.c


Changes:

=====================================
src/pulsecore/pstream.c
=====================================
@@ -244,8 +244,16 @@ static void do_pstream_read_write(pa_pstream *p) {
     p->mainloop->defer_enable(p->defer_event, 0);
 
     if (!p->dead && p->srb) {
-         do_write(p);
-         while (!p->dead && do_read(p, &p->readsrb) == 0);
+        int r = 0;
+
+        if(do_write(p) < 0)
+            goto fail;
+
+        while (!p->dead && r == 0) {
+            r = do_read(p, &p->readsrb);
+            if (r < 0)
+                goto fail;
+        }
     }
 
     if (!p->dead && pa_iochannel_is_readable(p->io)) {



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/b5a6365f1862512fc7cf447f68983358e474e8f7

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/b5a6365f1862512fc7cf447f68983358e474e8f7
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20200720/806e3dc1/attachment.htm>


More information about the pulseaudio-commits mailing list