@scrypted/libav 1.0.145 → 1.0.147

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.145",
3
+ "version": "1.0.147",
4
4
  "dependencies": {
5
5
  "detect-libc": "^2.0.3",
6
6
  "follow-redirects": "^1.15.9",
@@ -307,7 +307,7 @@ Napi::Object AVFormatContextObject::Init(Napi::Env env, Napi::Object exports)
307
307
 
308
308
  AVFormatContextObject::AVFormatContextObject(const Napi::CallbackInfo &info)
309
309
  : Napi::ObjectWrap<AVFormatContextObject>(info),
310
- fmt_ctx_(nullptr)
310
+ fmt_ctx_(nullptr), is_input(false)
311
311
  {
312
312
  // i don't think this constructor is called from js??
313
313
  }
@@ -376,6 +376,7 @@ Napi::Value AVFormatContextObject::Open(const Napi::CallbackInfo &info)
376
376
  return env.Undefined();
377
377
  }
378
378
 
379
+ is_input = true;
379
380
  return env.Undefined();
380
381
  }
381
382
 
@@ -521,7 +522,9 @@ Napi::Value AVFormatContextObject::Close(const Napi::CallbackInfo &info)
521
522
  {
522
523
  if (fmt_ctx_)
523
524
  {
524
- avformat_close_input(&fmt_ctx_);
525
+ if (is_input) {
526
+ avformat_close_input(&fmt_ctx_);
527
+ }
525
528
  avformat_free_context(fmt_ctx_);
526
529
  fmt_ctx_ = nullptr;
527
530
  }
@@ -42,4 +42,6 @@ private:
42
42
  Napi::Value WriteFrame(const Napi::CallbackInfo &info);
43
43
  Napi::Value GetStreams(const Napi::CallbackInfo &info);
44
44
  Napi::Value CreateSDP(const Napi::CallbackInfo &info);
45
+
46
+ bool is_input;
45
47
  };
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()) {