Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/decode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ void decodeExecute(napi_env env, void* data) {
}
c->frames.push_back(sw_frame);
av_frame_free(&frame);
} else
} else {
c->frames.push_back(frame);
av_frame_free(&sw_frame);
}

frame = av_frame_alloc();
sw_frame = av_frame_alloc();
Expand Down
3 changes: 1 addition & 2 deletions src/encode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,11 @@ void encodeExecute(napi_env env, void* data) {
ret = avcodec_receive_packet(c->encoder, packet);
if (ret == 0) {
c->packets.push_back(packet);
packet = av_packet_alloc();
} else {
av_packet_free(&packet);
//printf("Receive packet got status %i\n", ret);
}
} while (ret == 0);
av_packet_free(&packet);

c->totalTime = microTime(encodeStart);
/* if (!c->frames.empty()) {
Expand Down
6 changes: 5 additions & 1 deletion src/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1553,14 +1553,18 @@ void filterExecute(napi_env env, void* data) {
AVFrame *filtFrame = av_frame_alloc();
AVFilterContext *sinkCtx = c->sinkCtxs->getContext(*it);
if (!sinkCtx) {
av_frame_free(&filtFrame);
c->status = BEAMCODER_INVALID_ARGS;
c->errorMsg = "Sink name not found in sink contexts.";
return;
}
ret = av_buffersink_get_frame(sinkCtx, filtFrame);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
av_frame_free(&filtFrame);
break;
}
if (ret < 0) {
av_frame_free(&filtFrame);
c->status = BEAMCODER_ERROR_FILTER_GET_FRAME;
c->errorMsg = "Error while filtering.";
return;
Expand Down
3 changes: 1 addition & 2 deletions src/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3866,8 +3866,7 @@ void formatContextFinalizer(napi_env env, void* data, void* hint) {
} */
}

if (adaptor != nullptr) // crashes otherwise...
avformat_free_context(fc);
avformat_free_context(fc);
}

delete fmtRef;
Expand Down