Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 10.14+ seek 或重新播放时 PlayerThread 崩溃 #37

Closed
pzhlkj6612 opened this issue Nov 5, 2019 · 1 comment · Fixed by #70
Closed

macOS 10.14+ seek 或重新播放时 PlayerThread 崩溃 #37

pzhlkj6612 opened this issue Nov 5, 2019 · 1 comment · Fixed by #70
Labels
bug Something isn't working _Refactor the player 整个播放逻辑需要重做。 _segfault Just `Segmentation Fault`.
Milestone

Comments

@pzhlkj6612
Copy link
Member

pzhlkj6612 commented Nov 5, 2019

环境

  • macOS 10.14 (18A391) / 10.15.3 (19D76)
  • VMware Workstation 15.5.0 build-14665864 / 15.5.1 build-15018445
  • Unlocker 3.0.3 * from paolo-projects
  • FFmpeg 4.2.2
  • SDL 2.0.10

seek 时崩溃

报告(部分):

...

Crashed Thread:        11  PlayThread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000018
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [12053]

...

Thread 11 Crashed:: PlayThread
0   com.yourcompany.Beslyric-for-X	0x0000000107496a99 packet_queue_flush(PacketQueue*) + 73 (musicPlayer.cpp:120)
1   com.yourcompany.Beslyric-for-X	0x0000000107498847 PlayThread::generateAudioDataLoop() + 1159 (musicPlayer.cpp:605)
2   com.yourcompany.Beslyric-for-X	0x0000000107497214 PlayThread::run() + 196 (musicPlayer.cpp:279)
3   org.qt-project.QtCore         	0x000000010a426fd3 0x10a405000 + 139219
4   libsystem_pthread.dylib       	0x00007fff6a2bf33d _pthread_body + 126
5   libsystem_pthread.dylib       	0x00007fff6a2c22a7 _pthread_start + 70
6   libsystem_pthread.dylib       	0x00007fff6a2be425 thread_start + 13

...

重新播放时崩溃

...

Crashed Thread:        4  PlayThread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000018
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [622]

...

Thread 4 Crashed:: PlayThread
0   com.yourcompany.Beslyric-for-X	0x000000010475d2b9 packet_queue_flush(PacketQueue*) + 73 (musicPlayer.cpp:120)
1   com.yourcompany.Beslyric-for-X	0x000000010475f74c PlayThread::clearContextAndCloseDevice() + 124 (musicPlayer.cpp:627)
2   com.yourcompany.Beslyric-for-X	0x000000010475eaa8 PlayThread::ReleaseAll() + 56 (musicPlayer.cpp:663)
3   com.yourcompany.Beslyric-for-X	0x000000010475d933 PlayThread::run() + 211 (musicPlayer.cpp:259)
4   org.qt-project.QtCore         	0x0000000107e7aba9 QThreadPrivate::start(void*) + 329
5   libsystem_pthread.dylib       	0x00007fff634a4e65 _pthread_start + 148
6   libsystem_pthread.dylib       	0x00007fff634a083b thread_start + 15

...

可能的解决方案

检查packet_queue_flush(PacketQueue *q)

https://github.com/Beslyric-for-X/Beslyric-for-X/blob/0dee64a8834f1ba294b12f99fee97acc438ee500/Entities/MusicPlayer/musicPlayer.cpp#L113-L133

移除对pkt1->pkt.data的测试,或者增加对pkt1的空指针测试,问题不再出现:

-       if(pkt1->pkt.data != (uint8_t *)"FLUSH")
+       if(pkt1 != nullptr && pkt1->pkt.data != (uint8_t *)"FLUSH")
        {
            ;
        }

截至目前,这个问题在 Windows 7 / 10 、 Ubuntu 18.04 上都未曾出现过。

@pzhlkj6612 pzhlkj6612 changed the title seek、重新播放时 PlayerThread 崩溃 macOS 10.15 下 seek、重新播放时 PlayerThread 崩溃 Jan 10, 2020
@pzhlkj6612 pzhlkj6612 changed the title macOS 10.15 下 seek、重新播放时 PlayerThread 崩溃 macOS 10.14 下 seek、重新播放时 PlayerThread 崩溃 Jan 21, 2020
@pzhlkj6612 pzhlkj6612 changed the title macOS 10.14 下 seek、重新播放时 PlayerThread 崩溃 macOS 10.14 seek、重新播放时 PlayerThread 崩溃 Jan 21, 2020
@pzhlkj6612
Copy link
Member Author

pzhlkj6612 commented Jan 30, 2020

MusicPlayer 似乎可根据 35.FFmpeg学习笔记 - ffplay源码解读3之读文件_周洪伟的博客-CSDN博客ffplay播放控制代码分析_RonnieLiGe的专栏-CSDN博客ffplay源码分析7-播放控制 - 叶余 - 博客园 中的内容进行调整。

实际上,读ffplay.c,也许就能解答很多问题了。

@pzhlkj6612 pzhlkj6612 added bug Something isn't working _segfault Just `Segmentation Fault`. _Refactor the player 整个播放逻辑需要重做。 labels Feb 23, 2020
@pzhlkj6612 pzhlkj6612 changed the title macOS 10.14 seek、重新播放时 PlayerThread 崩溃 macOS 10.14 seek 或重新播放时 PlayerThread 崩溃 Feb 27, 2020
@pzhlkj6612 pzhlkj6612 changed the title macOS 10.14 seek 或重新播放时 PlayerThread 崩溃 macOS 10.14+ seek 或重新播放时 PlayerThread 崩溃 Feb 27, 2020
@pzhlkj6612 pzhlkj6612 added this to the Next Release milestone Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working _Refactor the player 整个播放逻辑需要重做。 _segfault Just `Segmentation Fault`.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant