Commit 65c6472
authored
SG-40625 - Play Forward/Pause button stops responding when playing media files (Linux) (#994)
SG-40625 - Play Forward/Pause button stops responding when playing media
files (Linux)
### Linked issues
n/a
### Summarize your change.
### Describe the reason for the change.
There was a stability problem where calling `stop()` or `reset()` on the
`QAudioOutput` object would cause audio playback to break after multiple
play/stop cycles. To work around this, suspend() was used instead, which
solved the instability. However, this introduced a second problem:
`suspend()` does not clear the audio device's internal buffer. This
resulted in an audio bleed issue, where sound from the previously played
media could be heard for a fraction of a second when starting a new one.
### Describe what you have tested and on which operating system.
This change introduces a new flushing mechanism that resolves the audio
bleed on Linux while avoiding the unstable `stop() `and `reset()` calls.
When playback is stopped, instead of immediately suspending the audio
device, a new flushing process is initiated. The audio device is kept
active momentarily while it is fed with silent audio data, completely
overwriting the contents of its internal buffer. Once the buffer is
flushed, the device is safely suspended.
This ensures that the audio buffer is clear before the next playback
begins, eliminating audio bleed. Because this approach continues to use
`suspend()` to halt the device, it maintains the stability of the audio
system.
**This logic is confined to the Linux platform and does not affect the
behavior on MacOS or Windows.**
### Add a list of changes, and note any that might need special
attention during the review.
### If possible, provide screenshots.
---------
Signed-off-by: Cédrik Fuoco <[email protected]>1 parent a7b9e17 commit 65c6472
File tree
2 files changed
+71
-2
lines changed- src/lib/audio/QTAudioRenderer
- QTAudioRenderer
2 files changed
+71
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
| 663 | + | |
663 | 664 | | |
664 | 665 | | |
665 | 666 | | |
| |||
686 | 687 | | |
687 | 688 | | |
688 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
689 | 707 | | |
690 | 708 | | |
691 | 709 | | |
| |||
712 | 730 | | |
713 | 731 | | |
714 | 732 | | |
715 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
716 | 736 | | |
717 | 737 | | |
718 | 738 | | |
| |||
739 | 759 | | |
740 | 760 | | |
741 | 761 | | |
| 762 | + | |
| 763 | + | |
742 | 764 | | |
743 | 765 | | |
744 | 766 | | |
| |||
753 | 775 | | |
754 | 776 | | |
755 | 777 | | |
| 778 | + | |
756 | 779 | | |
757 | 780 | | |
758 | 781 | | |
| |||
764 | 787 | | |
765 | 788 | | |
766 | 789 | | |
| 790 | + | |
767 | 791 | | |
768 | 792 | | |
769 | 793 | | |
| |||
783 | 807 | | |
784 | 808 | | |
785 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
786 | 814 | | |
| 815 | + | |
787 | 816 | | |
788 | 817 | | |
789 | 818 | | |
| |||
797 | 826 | | |
798 | 827 | | |
799 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
800 | 835 | | |
801 | 836 | | |
802 | 837 | | |
803 | 838 | | |
804 | 839 | | |
805 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
806 | 856 | | |
| 857 | + | |
807 | 858 | | |
808 | 859 | | |
809 | 860 | | |
| 861 | + | |
810 | 862 | | |
811 | 863 | | |
812 | 864 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
67 | 82 | | |
68 | 83 | | |
69 | 84 | | |
| |||
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| 100 | + | |
| 101 | + | |
85 | 102 | | |
86 | 103 | | |
87 | 104 | | |
| |||
0 commit comments