Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
6.3.1
-
None
-
Windows 11
Description
When using a custom device class inherited from QIODevice to capture raw PCM audio to, it captures a few frames then crashes to desktop with no error message. Doing the same thing in C++ works fine. The line that causes the crash is "audio_source.start(device)"
The test code is:
import sys from pathlib import Path from PySide6.QtCore import QIODevice from PySide6.QtMultimedia import QAudioSource, QAudioFormat from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine from PySide6.QtQuickControls2 import QQuickStyle class AudioCaptureDevice(QIODevice): def __init__(self) -> None: super().__init__() def readData(self, len) -> int: return len def writeData(self, data, len) -> int: print(f"Received: {len} bytes") return len if __name__ == "__main__": app = QGuiApplication() QQuickStyle.setStyle("Material") engine = QQmlApplicationEngine() device = AudioCaptureDevice() device.open(QIODevice.WriteOnly) format = QAudioFormat() format.setSampleRate(16000) format.setChannelCount(1) format.setSampleFormat(QAudioFormat.Int16) audio_source = QAudioSource(format) audio_source.start(device) qml_file = Path(__file__).parent / "view.qml" engine.load(qml_file) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec())
Attachments
Issue Links
- relates to
-
PYSIDE-1743 Extend Python extensions - QIODevice and QAudioFormat
-
- Closed
-