@qvac/decoder-audio 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +48 -32
- package/index.js +10 -3
- package/package.json +2 -2
- package/utils/createStreamAccumulator.js +1 -1
- package/utils/error.js +16 -1
package/NOTICE
CHANGED
|
@@ -14,22 +14,29 @@ JavaScript Dependencies
|
|
|
14
14
|
|
|
15
15
|
@hyperswarm/secret-stream@6.9.1
|
|
16
16
|
https://github.com/holepunchto/hyperswarm-secret-stream
|
|
17
|
+
@qvac/diagnostics@0.1.1
|
|
17
18
|
@qvac/dl-base@0.1.1
|
|
18
19
|
@qvac/dl-hyperdrive@0.1.1
|
|
19
20
|
@qvac/error@0.1.1
|
|
20
21
|
@qvac/infer-base@0.1.1
|
|
22
|
+
@qvac/infer-base@0.4.0
|
|
23
|
+
https://github.com/tetherto/qvac
|
|
21
24
|
@qvac/logging@0.1.0
|
|
22
25
|
@qvac/response@0.1.2
|
|
23
26
|
adaptive-timeout@1.0.1
|
|
24
27
|
https://github.com/holepunchto/adaptive-timeout
|
|
25
|
-
b4a@1.
|
|
28
|
+
b4a@1.8.0
|
|
26
29
|
https://github.com/holepunchto/b4a
|
|
30
|
+
bare-abort@2.0.13
|
|
31
|
+
https://github.com/holepunchto/bare-abort
|
|
27
32
|
bare-addon-resolve@1.10.0
|
|
28
33
|
https://github.com/holepunchto/bare-addon-resolve
|
|
29
34
|
bare-ansi-escapes@2.2.3
|
|
30
35
|
https://github.com/holepunchto/bare-ansi-escapes
|
|
31
36
|
bare-assert@1.2.0
|
|
32
37
|
https://github.com/holepunchto/bare-assert
|
|
38
|
+
bare-buffer@3.6.0
|
|
39
|
+
https://github.com/holepunchto/bare-buffer
|
|
33
40
|
bare-channel@5.2.3
|
|
34
41
|
https://github.com/holepunchto/bare-channel
|
|
35
42
|
bare-env@3.0.0
|
|
@@ -38,9 +45,9 @@ JavaScript Dependencies
|
|
|
38
45
|
https://github.com/holepunchto/bare-events
|
|
39
46
|
bare-events@2.8.2
|
|
40
47
|
https://github.com/holepunchto/bare-events
|
|
41
|
-
bare-ffmpeg@1.
|
|
48
|
+
bare-ffmpeg@1.2.2
|
|
42
49
|
https://github.com/holepunchto/bare-ffmpeg
|
|
43
|
-
bare-fs@4.
|
|
50
|
+
bare-fs@4.7.1
|
|
44
51
|
https://github.com/holepunchto/bare-fs
|
|
45
52
|
bare-hrtime@2.1.1
|
|
46
53
|
https://github.com/holepunchto/bare-hrtime
|
|
@@ -48,59 +55,68 @@ JavaScript Dependencies
|
|
|
48
55
|
https://github.com/holepunchto/bare-inspect
|
|
49
56
|
bare-module-resolve@1.12.1
|
|
50
57
|
https://github.com/holepunchto/bare-module-resolve
|
|
51
|
-
bare-os@3.
|
|
58
|
+
bare-os@3.9.0
|
|
52
59
|
https://github.com/holepunchto/bare-os
|
|
53
60
|
bare-path@3.0.0
|
|
54
61
|
https://github.com/holepunchto/bare-path
|
|
55
|
-
bare-pipe@4.1.
|
|
62
|
+
bare-pipe@4.1.5
|
|
56
63
|
https://github.com/holepunchto/bare-pipe
|
|
57
|
-
bare-process@4.
|
|
64
|
+
bare-process@4.4.1
|
|
58
65
|
https://github.com/holepunchto/bare-process
|
|
59
|
-
bare-semver@1.0.
|
|
66
|
+
bare-semver@1.0.3
|
|
60
67
|
https://github.com/holepunchto/bare-semver
|
|
61
68
|
bare-signals@4.2.0
|
|
62
69
|
https://github.com/holepunchto/bare-signals
|
|
63
|
-
bare-
|
|
70
|
+
bare-stdio@1.0.2
|
|
71
|
+
https://github.com/holepunchto/bare-stdio
|
|
72
|
+
bare-stream@2.13.0
|
|
64
73
|
https://github.com/holepunchto/bare-stream
|
|
65
|
-
bare-structured-clone@1.5.
|
|
74
|
+
bare-structured-clone@1.5.4
|
|
66
75
|
https://github.com/holepunchto/bare-structured-clone
|
|
67
|
-
bare-tty@5.0
|
|
76
|
+
bare-tty@5.1.0
|
|
68
77
|
https://github.com/holepunchto/bare-tty
|
|
69
78
|
bare-type@1.1.0
|
|
70
79
|
https://github.com/holepunchto/bare-type
|
|
71
|
-
bare-url@2.
|
|
80
|
+
bare-url@2.4.2
|
|
72
81
|
https://github.com/holepunchto/bare-url
|
|
73
82
|
blind-relay@1.4.0
|
|
74
83
|
https://github.com/holepunchto/blind-relay
|
|
75
|
-
compact-encoding@2.
|
|
76
|
-
https://github.com/
|
|
84
|
+
compact-encoding@2.19.2
|
|
85
|
+
https://github.com/holepunchto/compact-encoding
|
|
77
86
|
device-file@2.3.1
|
|
78
87
|
https://github.com/holepunchto/device-file
|
|
79
88
|
events-universal@1.0.1
|
|
80
89
|
https://github.com/holepunchto/events-universal
|
|
81
90
|
fd-lock@2.1.1
|
|
82
91
|
https://github.com/holepunchto/fd-lock
|
|
83
|
-
fs-native-extensions@1.
|
|
92
|
+
fs-native-extensions@1.5.0
|
|
84
93
|
https://github.com/holepunchto/fs-native-extensions
|
|
85
|
-
hyperblobs@2.
|
|
94
|
+
hyperblobs@2.11.1
|
|
86
95
|
https://github.com/holepunchto/hyperblobs
|
|
87
96
|
hypercore-errors@1.5.0
|
|
88
97
|
https://github.com/holepunchto/hypercore-errors
|
|
89
98
|
hypercore-id-encoding@1.3.0
|
|
90
99
|
https://github.com/holepunchto/hypercore-id-encoding
|
|
91
|
-
hypercore-storage@2.
|
|
92
|
-
|
|
100
|
+
hypercore-storage@2.8.0
|
|
101
|
+
https://github.com/holepunchto/hypercore-storage
|
|
102
|
+
hyperdht-address@1.0.1
|
|
103
|
+
https://github.com/holepunchto/hyperdht-address
|
|
104
|
+
hyperdrive@13.3.2
|
|
93
105
|
https://github.com/holepunchto/hyperdrive
|
|
94
|
-
hyperschema@1.
|
|
106
|
+
hyperschema@1.20.1
|
|
95
107
|
https://github.com/holepunchto/hyperschema
|
|
96
|
-
index-encoder@3.
|
|
108
|
+
index-encoder@3.5.0
|
|
97
109
|
https://github.com/holepunchto/index-encoder
|
|
98
|
-
mirror-drive@1.
|
|
110
|
+
mirror-drive@1.14.2
|
|
99
111
|
https://github.com/holepunchto/mirror-drive
|
|
100
112
|
noise-handshake@4.2.0
|
|
101
113
|
https://github.com/holepunchto/noise-handshake
|
|
102
114
|
quickbit-native@2.4.8
|
|
103
115
|
https://github.com/holepunchto/quickbit-native
|
|
116
|
+
rabin-native@2.0.0
|
|
117
|
+
https://github.com/holepunchto/rabin-native
|
|
118
|
+
rabin-stream@2.0.0
|
|
119
|
+
https://github.com/holepunchto/rabin-stream
|
|
104
120
|
rache@1.0.0
|
|
105
121
|
https://github.com/holepunchto/rache
|
|
106
122
|
refcounter@1.0.0
|
|
@@ -109,7 +125,7 @@ JavaScript Dependencies
|
|
|
109
125
|
https://github.com/holepunchto/require-addon
|
|
110
126
|
resource-on-exit@1.0.0
|
|
111
127
|
https://github.com/holepunchto/bare-teardown
|
|
112
|
-
rocksdb-native@3.
|
|
128
|
+
rocksdb-native@3.15.0
|
|
113
129
|
https://github.com/holepunchto/rocksdb-native
|
|
114
130
|
scope-lock@1.2.4
|
|
115
131
|
https://github.com/holepunchto/scope-lock
|
|
@@ -153,12 +169,12 @@ JavaScript Dependencies
|
|
|
153
169
|
https://github.com/mafintosh/bogon
|
|
154
170
|
codecs@3.1.0
|
|
155
171
|
https://github.com/mafintosh/codecs
|
|
156
|
-
corestore@7.
|
|
172
|
+
corestore@7.9.2
|
|
157
173
|
https://github.com/holepunchto/corestore
|
|
158
174
|
debounceify@1.1.0
|
|
159
175
|
https://github.com/mafintosh/debounceify
|
|
160
|
-
dht-rpc@6.26.
|
|
161
|
-
https://github.com/
|
|
176
|
+
dht-rpc@6.26.4
|
|
177
|
+
https://github.com/holepunchto/dht-rpc
|
|
162
178
|
fast-fifo@1.3.2
|
|
163
179
|
https://github.com/mafintosh/fast-fifo
|
|
164
180
|
flat-tree@1.13.0
|
|
@@ -169,13 +185,13 @@ JavaScript Dependencies
|
|
|
169
185
|
https://github.com/mafintosh/generate-string
|
|
170
186
|
hyperbee@2.27.3
|
|
171
187
|
https://github.com/holepunchto/hyperbee
|
|
172
|
-
hypercore@11.
|
|
188
|
+
hypercore@11.28.1
|
|
173
189
|
https://github.com/holepunchto/hypercore
|
|
174
190
|
hypercore-crypto@3.6.1
|
|
175
191
|
https://github.com/mafintosh/hypercore-crypto
|
|
176
|
-
hyperdht@6.
|
|
192
|
+
hyperdht@6.30.0
|
|
177
193
|
https://github.com/holepunchto/hyperdht
|
|
178
|
-
hyperswarm@4.
|
|
194
|
+
hyperswarm@4.17.0
|
|
179
195
|
https://github.com/holepunchto/hyperswarm
|
|
180
196
|
is-options@1.0.2
|
|
181
197
|
https://github.com/mafintosh/is-options
|
|
@@ -189,8 +205,8 @@ JavaScript Dependencies
|
|
|
189
205
|
https://github.com/mafintosh/nat-sampler
|
|
190
206
|
protocol-buffers-encodings@1.2.0
|
|
191
207
|
https://github.com/mafintosh/protocol-buffers-encodings
|
|
192
|
-
protomux@3.10.
|
|
193
|
-
https://github.com/
|
|
208
|
+
protomux@3.10.3
|
|
209
|
+
https://github.com/holepunchto/protomux
|
|
194
210
|
queue-tick@1.0.1
|
|
195
211
|
https://github.com/mafintosh/queue-tick
|
|
196
212
|
random-array-iterator@1.0.0
|
|
@@ -201,7 +217,7 @@ JavaScript Dependencies
|
|
|
201
217
|
https://github.com/mafintosh/record-cache
|
|
202
218
|
resolve-reject-promise@1.1.0
|
|
203
219
|
https://github.com/mafintosh/resolve-reject-promise
|
|
204
|
-
safety-catch@1.0.
|
|
220
|
+
safety-catch@1.0.3
|
|
205
221
|
https://github.com/mafintosh/safety-catch
|
|
206
222
|
same-data@1.0.0
|
|
207
223
|
https://github.com/mafintosh/same-data
|
|
@@ -211,7 +227,7 @@ JavaScript Dependencies
|
|
|
211
227
|
https://github.com/mafintosh/signal-promise
|
|
212
228
|
signed-varint@2.0.1
|
|
213
229
|
https://github.com/dominictarr/signed-varint
|
|
214
|
-
sodium-native@5.0
|
|
230
|
+
sodium-native@5.1.0
|
|
215
231
|
https://github.com/holepunchto/sodium-native
|
|
216
232
|
sodium-secretstream@1.2.0
|
|
217
233
|
https://github.com/mafintosh/sodium-secretstream
|
|
@@ -219,7 +235,7 @@ JavaScript Dependencies
|
|
|
219
235
|
https://github.com/holepunchto/sodium-universal
|
|
220
236
|
speedometer@1.1.0
|
|
221
237
|
https://github.com/mafintosh/speedometer
|
|
222
|
-
streamx@2.
|
|
238
|
+
streamx@2.25.0
|
|
223
239
|
https://github.com/mafintosh/streamx
|
|
224
240
|
teex@1.0.1
|
|
225
241
|
https://github.com/mafintosh/teex
|
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ const QvacResponse = require('@qvac/response')
|
|
|
4
4
|
const QvacLogger = require('@qvac/logging')
|
|
5
5
|
const ffmpeg = require('bare-ffmpeg')
|
|
6
6
|
const BaseInference = require('@qvac/infer-base/WeightsProvider/BaseInference')
|
|
7
|
+
const { QvacErrorDecoderAudio, ERR_CODES } = require('./utils/error')
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* FFmpeg-based audio decoder (single-threaded)
|
|
@@ -106,7 +107,10 @@ class FFmpegDecoder extends BaseInference {
|
|
|
106
107
|
|
|
107
108
|
// Validate audio format
|
|
108
109
|
if (!this.SUPPORTED_AUDIO_FORMATS[this.config.audioFormat]) {
|
|
109
|
-
throw new
|
|
110
|
+
throw new QvacErrorDecoderAudio({
|
|
111
|
+
code: ERR_CODES.UNSUPPORTED_AUDIO_FORMAT,
|
|
112
|
+
adds: this.config.audioFormat
|
|
113
|
+
})
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
this.isLoaded = true
|
|
@@ -135,7 +139,7 @@ class FFmpegDecoder extends BaseInference {
|
|
|
135
139
|
*/
|
|
136
140
|
async run (audioStream) {
|
|
137
141
|
if (!this.isLoaded) {
|
|
138
|
-
throw new
|
|
142
|
+
throw new QvacErrorDecoderAudio({ code: ERR_CODES.DECODER_NOT_LOADED })
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
this.logger.info('Starting new audio stream processing')
|
|
@@ -397,7 +401,10 @@ class FFmpegDecoder extends BaseInference {
|
|
|
397
401
|
|
|
398
402
|
const streamIndex = this.config.streamIndex || 0
|
|
399
403
|
if (format.streams[streamIndex] === undefined) {
|
|
400
|
-
throw new
|
|
404
|
+
throw new QvacErrorDecoderAudio({
|
|
405
|
+
code: ERR_CODES.STREAM_INDEX_OUT_OF_BOUNDS,
|
|
406
|
+
adds: streamIndex
|
|
407
|
+
})
|
|
401
408
|
}
|
|
402
409
|
|
|
403
410
|
// Process the stream and generate decoded output
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/decoder-audio",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Tether",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@qvac/error": "^0.1.0",
|
|
49
|
-
"@qvac/infer-base": "^0.
|
|
49
|
+
"@qvac/infer-base": "^0.4.0",
|
|
50
50
|
"@qvac/logging": "^0.1.0",
|
|
51
51
|
"@qvac/response": "^0.1.0",
|
|
52
52
|
"bare-assert": "^1.1.0",
|
|
@@ -22,7 +22,7 @@ function createStreamAccumulator ({
|
|
|
22
22
|
targetBufferSize = TARGET_BUFFER_SIZE
|
|
23
23
|
}) {
|
|
24
24
|
if (targetBufferSize < TARGET_BUFFER_SIZE) {
|
|
25
|
-
throw new QvacErrorDecoderAudio(ERR_CODES.BUFFER_SIZE_TOO_SMALL)
|
|
25
|
+
throw new QvacErrorDecoderAudio({ code: ERR_CODES.BUFFER_SIZE_TOO_SMALL })
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
let accumulator = Buffer.alloc(0)
|
package/utils/error.js
CHANGED
|
@@ -14,7 +14,10 @@ const ERR_CODES = Object.freeze({
|
|
|
14
14
|
FAILED_TO_APPEND: 11005,
|
|
15
15
|
FAILED_TO_GET_STATUS: 11006,
|
|
16
16
|
FAILED_TO_DESTROY: 11007,
|
|
17
|
-
BUFFER_SIZE_TOO_SMALL: 11008
|
|
17
|
+
BUFFER_SIZE_TOO_SMALL: 11008,
|
|
18
|
+
UNSUPPORTED_AUDIO_FORMAT: 11009,
|
|
19
|
+
DECODER_NOT_LOADED: 11010,
|
|
20
|
+
STREAM_INDEX_OUT_OF_BOUNDS: 11011
|
|
18
21
|
})
|
|
19
22
|
|
|
20
23
|
addCodes({
|
|
@@ -49,6 +52,18 @@ addCodes({
|
|
|
49
52
|
[ERR_CODES.BUFFER_SIZE_TOO_SMALL]: {
|
|
50
53
|
name: 'BUFFER_SIZE_TOO_SMALL',
|
|
51
54
|
message: 'Target buffer size is too small'
|
|
55
|
+
},
|
|
56
|
+
[ERR_CODES.UNSUPPORTED_AUDIO_FORMAT]: {
|
|
57
|
+
name: 'UNSUPPORTED_AUDIO_FORMAT',
|
|
58
|
+
message: (format) => `Unsupported audio format: ${format}`
|
|
59
|
+
},
|
|
60
|
+
[ERR_CODES.DECODER_NOT_LOADED]: {
|
|
61
|
+
name: 'DECODER_NOT_LOADED',
|
|
62
|
+
message: 'Decoder not loaded. Call load() first.'
|
|
63
|
+
},
|
|
64
|
+
[ERR_CODES.STREAM_INDEX_OUT_OF_BOUNDS]: {
|
|
65
|
+
name: 'STREAM_INDEX_OUT_OF_BOUNDS',
|
|
66
|
+
message: (index) => `Stream index out of bounds: ${index}`
|
|
52
67
|
}
|
|
53
68
|
}, {
|
|
54
69
|
name,
|