@scrypted/libav 1.0.146 → 1.0.148

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.146",
3
+ "version": "1.0.148",
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,12 @@ 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
+ }
528
+ if (callbackRef) {
529
+ callbackRef.Release();
530
+ }
525
531
  avformat_free_context(fmt_ctx_);
526
532
  fmt_ctx_ = nullptr;
527
533
  }
@@ -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
  };