jbc-dssi 1.1.152 → 1.1.154
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/lib/ogg-opus.js +15 -3
- package/package.json +1 -1
package/lib/ogg-opus.js
CHANGED
|
@@ -108,15 +108,27 @@ export function createOggOpusStream() {
|
|
|
108
108
|
return drain();
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
let pending = null;
|
|
112
|
+
|
|
111
113
|
function packet(data) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
const out = pending
|
|
115
|
+
? [page({ headerType: 0x00, granule, serial, sequence: sequence++, packets: [pending] })]
|
|
116
|
+
: [];
|
|
117
|
+
const samples = packetSamples(data);
|
|
118
|
+
granule += samples;
|
|
119
|
+
pending = data;
|
|
120
|
+
pages.push(...out);
|
|
114
121
|
return drain();
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
function end() {
|
|
118
125
|
const out = [];
|
|
119
|
-
|
|
126
|
+
if (pending) {
|
|
127
|
+
out.push(page({ headerType: 0x04, granule, serial, sequence: sequence++, packets: [pending] }));
|
|
128
|
+
pending = null;
|
|
129
|
+
} else {
|
|
130
|
+
out.push(page({ headerType: 0x04, granule, serial, sequence: sequence++, packets: [] }));
|
|
131
|
+
}
|
|
120
132
|
pages.push(...out);
|
|
121
133
|
return drain();
|
|
122
134
|
}
|