@scrypted/libav 1.0.17 → 1.0.19

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/decode.cpp +9 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "dependencies": {
5
5
  "node-addon-api": "^8.1.0",
6
6
  "prebuild-install": "npm:@scrypted/prebuild-install@^7.1.8"
package/src/decode.cpp CHANGED
@@ -81,18 +81,25 @@ public:
81
81
  }
82
82
 
83
83
  // Decode video frames
84
+ int ret;
84
85
  while (av_read_frame(fmt_ctx_, packet) >= 0)
85
86
  {
86
87
  if (packet->stream_index == videoStreamIndex)
87
88
  {
88
- if (avcodec_send_packet(codecContext, packet) == 0)
89
+ if ((ret = avcodec_send_packet(codecContext, packet)) == 0)
89
90
  {
90
- if (avcodec_receive_frame(codecContext, frame) == 0)
91
+ if ((ret = avcodec_receive_frame(codecContext, frame)) == 0)
91
92
  {
92
93
  av_packet_free(&packet);
93
94
  result = frame;
94
95
  return;
95
96
  }
97
+ else {
98
+ fprintf(stderr, "Error while receiving a frame from the decoder: %d\n", ret);
99
+ }
100
+ }
101
+ else {
102
+ fprintf(stderr, "Error while sending a packet to the decoder: %d\n", ret);
96
103
  }
97
104
  }
98
105
  av_packet_unref(packet); // Reset the packet for the next frame