Skip to content

Commit

Permalink
Fix v4l2 sink
Browse files Browse the repository at this point in the history
The codec id to write as codec parameters is the one from the v4l2
encoder, not from the decoder.

Regression introduced by be985b8.

Fixes #3795 <#3795>
  • Loading branch information
rom1v committed Mar 12, 2023
1 parent 02586cf commit cbca79b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/v4l2_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs, const AVCodecContext *ctx) {
goto error_avformat_free_context;
}

// The codec is from the v4l2 encoder, not from the decoder
ostream->codecpar->codec_id = encoder->id;

int ret = avio_open(&vs->format_ctx->pb, vs->device_name, AVIO_FLAG_WRITE);
if (ret < 0) {
LOGE("Failed to open output device: %s", vs->device_name);
Expand Down

0 comments on commit cbca79b

Please sign in to comment.