Fix v4l2 AVPacket memory leak on error
Unref v4l2 AVPacket even if writing failed.
This commit is contained in:
parent
1cde68a1fa
commit
84f17fdeab
1 changed files with 1 additions and 1 deletions
|
@ -92,11 +92,11 @@ encode_and_write_frame(struct sc_v4l2_sink *vs, const AVFrame *frame) {
|
||||||
// A packet was received
|
// A packet was received
|
||||||
|
|
||||||
bool ok = write_packet(vs, packet);
|
bool ok = write_packet(vs, packet);
|
||||||
|
av_packet_unref(packet);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
LOGW("Could not send packet to v4l2 sink");
|
LOGW("Could not send packet to v4l2 sink");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
av_packet_unref(packet);
|
|
||||||
} else if (ret != AVERROR(EAGAIN)) {
|
} else if (ret != AVERROR(EAGAIN)) {
|
||||||
LOGE("Could not receive v4l2 video packet: %d", ret);
|
LOGE("Could not receive v4l2 video packet: %d", ret);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue