fix: mapping correct devices PipeWire inputTargetDevice/outputTargetDevice
- AudioBridge passe inputTargetDevice et outputTargetDevice à PipeWire - Fix: PipeWire utilisait targetDevice au lieu de input/outputTargetDevice - Devrait maintenant démarrer les streams pw-cat correctement
This commit is contained in:
@@ -213,17 +213,28 @@ export class AudioBridge extends EventEmitter {
|
||||
}
|
||||
|
||||
// Initialisation du backend sélectionné
|
||||
this.audioBackend = new BackendClass({
|
||||
const backendOptions = {
|
||||
sampleRate: this.options.sampleRate,
|
||||
channels: this.options.channels,
|
||||
framesPerBuffer: this.options.frameSize,
|
||||
inputDeviceId: this.options.inputDeviceId,
|
||||
inputDeviceName: inputDeviceName,
|
||||
outputDeviceId: this.options.outputDeviceId,
|
||||
outputDeviceName: outputDeviceName,
|
||||
// Options spécifiques PipeWire
|
||||
latency: this.options.latency || 20
|
||||
});
|
||||
};
|
||||
|
||||
// PipeWire utilise targetDevice, CoreAudio utilise inputDeviceName/outputDeviceName
|
||||
if (this.backendType === 'PipeWire') {
|
||||
// Pour PipeWire, on utilise inputDeviceId directement comme targetDevice
|
||||
// (startCapture et startPlayback peuvent avoir des targets différents)
|
||||
backendOptions.inputTargetDevice = this.options.inputDeviceId;
|
||||
backendOptions.outputTargetDevice = this.options.outputDeviceId;
|
||||
} else {
|
||||
// CoreAudio et autres backends
|
||||
backendOptions.inputDeviceId = this.options.inputDeviceId;
|
||||
backendOptions.inputDeviceName = inputDeviceName;
|
||||
backendOptions.outputDeviceId = this.options.outputDeviceId;
|
||||
backendOptions.outputDeviceName = outputDeviceName;
|
||||
}
|
||||
|
||||
this.audioBackend = new BackendClass(backendOptions);
|
||||
|
||||
// Liste des devices disponibles
|
||||
devices = BackendClass.getDevices();
|
||||
|
||||
@@ -23,7 +23,8 @@ export class PipeWireBackend extends EventEmitter {
|
||||
sampleRate: options.sampleRate || 48000,
|
||||
channels: options.channels || 1,
|
||||
framesPerBuffer: options.framesPerBuffer || 960,
|
||||
targetDevice: options.targetDevice || null,
|
||||
inputTargetDevice: options.inputTargetDevice || null,
|
||||
outputTargetDevice: options.outputTargetDevice || null,
|
||||
latency: options.latency || 20, // ms
|
||||
...options
|
||||
};
|
||||
@@ -186,8 +187,8 @@ export class PipeWireBackend extends EventEmitter {
|
||||
];
|
||||
|
||||
// Ajoute le device cible si spécifié
|
||||
if (this.options.targetDevice) {
|
||||
args.push(`--target=${this.options.targetDevice}`);
|
||||
if (this.options.inputTargetDevice) {
|
||||
args.push(`--target=${this.options.inputTargetDevice}`);
|
||||
}
|
||||
|
||||
this.captureProcess = spawn('pw-cat', args);
|
||||
@@ -258,8 +259,8 @@ export class PipeWireBackend extends EventEmitter {
|
||||
'-' // Lecture depuis stdin
|
||||
];
|
||||
|
||||
if (this.options.targetDevice) {
|
||||
args.push(`--target=${this.options.targetDevice}`);
|
||||
if (this.options.outputTargetDevice) {
|
||||
args.push(`--target=${this.options.outputTargetDevice}`);
|
||||
}
|
||||
|
||||
this.playbackProcess = spawn('pw-cat', args);
|
||||
|
||||
Reference in New Issue
Block a user