Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.1
-
None
-
Multimedia wk 49-50, Multimedia wk 51-2
Description
The current behavior and documentation of QMediaDevices is unclear.
This task will be linked to several subtasks and contain the description of what will be fixed and how.
Several of these points apply to all types of QMediaDevices, but I will use audio as the example.
The following is a list of desired behaviors that we want when managing media devices:
- Document that QAudioDevice does not update any values when the underlying device is disconnected. Associated values are “cached”, such as isDefault, mode, channelCount. QAudioDevice reflects the hardware device, but not the connection state. Furthermore, the value "isDefault" will never be updated even if the device is no longer the actual default device.
- The only real identifier for the media-device is the ID. We should document that users should rely on this when identifying devices over time.
- We should make sure that we can (almost) guarantee that device IDs are stable across connection-sessions on all platforms. So far, we trust this can be provided on macOS, iOS, Android and Windows.
- QAudioDevice comparison should not take into account the “isDefault” member. The comparison should only take ID into account.
- When the user explicitly sets QAudioInput:device to a default device (either by using a default-constructed QAudioDevice or QMediaDevices::defaultAudioDevice()), the QAudioInput should live-track and update to a new default device if system decides default device is something new. This means that QAudioInput is allowed to modify the QAudioDevice property without user interaction.
- When the user explicitly sets the QAudioInput::device to a device that is not the default, the QAudioInput should not change the device property even if the device is disconnected. When the same device is then reconnected, we will automatically configure it to be functional for recordings once again.
- This also should take into account when the user explicitly selects a device that just also happens to be the default at that given time.
- User is able to set any QAudioDevice regardless of whether it is currently connected. If the device matching the ID is later connected, we will establish any necessary connections to make it function for recording.
- QMediaDevices::defaultDevice() should be able to return null-device if there are no devices connected. Otherwise, it must be a currently connected device.
- The user should be able to explicitly set QAudioInput to a null-device. A null-device indicates there is no physical device associated.
- This should probably also tie in with other classes such as QMediaRecorder, so that we stop the bug where it will record an empty signal rather than just not creating an associated audio track.
Specific subtasks:
- Write mock-code to showcase how exactly the code would look from the user-perspective (including QML), and comment exactly what the associated behavior would be for each use-case. See whether there are any use-cases that have conflicting behavior or conflicting code in terms of API usage.
- Confirm that our current way of determining device-ID is stable across connection-sessions on our target platforms.
- Update documentation
- implement default-device tracking in QAudioInput, QAudioOutput and QCamera.
- Implement behavior that allows devices to recover functionality when disconnected/reconnected
Related bug reports
Solving this issue should solve other bugs:
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-131674 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
609706,3 | QAudioInput: Don't ignore setDevice when default device is null | dev | qt/qtmultimedia | Status: NEW | 0 | 0 |