* Queues audio data to be encoded.
(data: AudioData)
| 232 | * Queues audio data to be encoded. |
| 233 | */ |
| 234 | encode(data: AudioData) { |
| 235 | // Spec: If [[state]] is not "configured", throw an InvalidStateError. |
| 236 | if (this._state !== 'configured') { |
| 237 | throw new DOMException('Encoder is not configured', 'InvalidStateError'); |
| 238 | } |
| 239 | |
| 240 | // Spec: Clone the AudioData |
| 241 | const clonedData = data.clone(); |
| 242 | |
| 243 | // Spec: Increment [[encodeQueueSize]]. |
| 244 | this._encodeQueueSize++; |
| 245 | |
| 246 | // Spec: Queue a control message to encode the data. |
| 247 | this.encodeInternal(clonedData) |
| 248 | .catch(e => this.handleAsyncError(e)); |
| 249 | } |
| 250 | |
| 251 | private outputChunk(currentConfigId: number) { |
| 252 | if (this.currentConfigId !== currentConfigId) { |
nothing calls this directly
no test coverage detected