@scrypted/libav 1.0.144 → 1.0.146

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.144",
3
+ "version": "1.0.146",
4
4
  "dependencies": {
5
5
  "detect-libc": "^2.0.3",
6
6
  "follow-redirects": "^1.15.9",
@@ -105,11 +105,12 @@ public:
105
105
  ReceiveFrameWorker(napi_env env, napi_deferred deferred, AVCodecContext *codecContext)
106
106
  : Napi::AsyncWorker(env), deferred(deferred), codecContext(codecContext)
107
107
  {
108
- result = nullptr;
109
108
  }
110
109
 
111
110
  void Execute() override
112
111
  {
112
+ result = nullptr;
113
+
113
114
  AVFrame *frame = av_frame_alloc();
114
115
  if (!frame)
115
116
  {
@@ -167,11 +168,12 @@ public:
167
168
  ReceivePacketWorker(napi_env env, napi_deferred deferred, AVCodecContext *codecContext)
168
169
  : Napi::AsyncWorker(env), deferred(deferred), codecContext(codecContext)
169
170
  {
170
- result = nullptr;
171
171
  }
172
172
 
173
173
  void Execute() override
174
174
  {
175
+ result = nullptr;
176
+
175
177
  AVPacket *packet = av_packet_alloc();
176
178
  if (!packet)
177
179
  {
@@ -265,9 +267,11 @@ public:
265
267
 
266
268
  void Execute() override
267
269
  {
270
+ result = false;
271
+
268
272
  if (!frame)
269
273
  {
270
- SetError("Packet is null");
274
+ SetError("SendFrame received null frame");
271
275
  return;
272
276
  }
273
277
  if (!codecContext)
@@ -284,8 +288,6 @@ public:
284
288
  return;
285
289
  }
286
290
 
287
- result = false;
288
-
289
291
  if (ret != AVERROR(EAGAIN))
290
292
  {
291
293
  // what would cause this?
@@ -326,9 +328,11 @@ public:
326
328
 
327
329
  void Execute() override
328
330
  {
331
+ result = false;
332
+
329
333
  if (!packet)
330
334
  {
331
- SetError("Packet is null");
335
+ SetError("SendPacket received null packet");
332
336
  return;
333
337
  }
334
338
 
@@ -340,8 +344,6 @@ public:
340
344
  return;
341
345
  }
342
346
 
343
- result = false;
344
-
345
347
  if (ret != AVERROR(EAGAIN))
346
348
  {
347
349
  // errors are typically caused by missing codec info
@@ -671,7 +671,7 @@ Napi::Value AVFormatContextObject::WriteFrame(const Napi::CallbackInfo &info)
671
671
 
672
672
  if (!packet)
673
673
  {
674
- Napi::Error::New(env, "Packet is null").ThrowAsJavaScriptException();
674
+ Napi::Error::New(env, "WriteFrame received null frame").ThrowAsJavaScriptException();
675
675
  return env.Undefined();
676
676
  }
677
677
 
package/src/frame.cpp CHANGED
@@ -230,6 +230,7 @@ Napi::Value AVFrameObject::CreateEncoder(const Napi::CallbackInfo &info)
230
230
  c->pix_fmt = (enum AVPixelFormat)frame_->format;
231
231
  c->time_base.num = timeBaseNum;
232
232
  c->time_base.den = timeBaseDen;
233
+ c->max_b_frames = 0;
233
234
 
234
235
  Napi::Value gopSizeValue = options.Get("gopSize");
235
236
  if (gopSizeValue.IsNumber()) {