bcm2835-codec: a second encoder STOP during drain produces duplicate EOS

Đang mở
#7,784 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
40/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, linux
Lĩnh vực
embedded-iot

Hướng nghiên cứu

Start in drivers/media/platform/raspberrypi/bcm2835-codec/bcm2835-v4l2-codec.c, at the VIDIOC_ENCODER_CMD handler that services V4L2_ENC_CMD_STOP and calls the drain/EOS path, and follow where the driver records that a drain is in progress. Find the existing guard that is skipped before both queues are streaming (referenced in #7733) and extend it so a second STOP, or a START while draining, returns EBUSY once drain has begun. Done means a double-STOP reports a single EOS event and stream teardown finishes without the bcm2835_codec_flush_buffers timeout — reproduce with the two-STOP sequence on a CM4, as the report and its logged output describe.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Describe the bug

On a Compute Module 4, a second V4L2_ENC_CMD_STOP while an H.264 encode is draining returns success. The driver submits EOS twice. In the immediate double-STOP test, stream teardown then timed out with one buffer outstanding. The second STOP should return EBUSY while the first drain is in progress.

Steps to reproduce the behaviour
  1. On a CM4 with an unmodified 64-bit rpi-6.18.y kernel, open /dev/video11 and configure H.264 capture and YUV420 output. Start both queues and encode a picture.
  2. Queue 12 more source frames and enough capture buffers.
  3. Call VIDIOC_ENCODER_CMD with V4L2_ENC_CMD_STOP twice before dequeuing the CAPTURE buffer marked LAST.
  4. Dequeue the buffers and EOS events, then stop streaming.

Expected: the second STOP returns EBUSY, one EOS is reported, and teardown completes without a timeout.
Observed: both STOP calls returned success and two EOS events were reported. An immediate second STOP also caused a teardown timeout with one buffer outstanding. A second STOP 250 ms later still produced two EOS events.

Device (s)

Raspberry Pi CM4

System

Board: Raspberry Pi Compute Module 4.
OS: Minimal RAM-based test environment; no Raspberry Pi OS image was used.
Kernel: unmodified 64-bit rpi-6.18.y at adb947547136096c91f037dd392cd8af3aa98451 (6.18.64-v8).
Firmware version: not recorded for this test.

Logs

Selected serial/test output from the unmodified kernel:

STOP #1: ret=0 errno=0 (Success) at 9565 ms
STOP #2: ret=0 errno=0 (Success) at 9565 ms
drain: result=complete, output=12/12, LAST=yes, EOS_events=2
[   11.935653] bcm2835-codec bcm2835-codec: bcm2835_codec_flush_buffers: Timeout waiting for buffers to be returned - 1 outstanding

A single STOP under the same conditions produced one EOS event and no timeout.

Additional context

A local change that rejects a second STOP or a START during drain with EBUSY was built and tested on rpi-6.18.y at 731e90c14fb88950a44575276f2f190493af713f. On the same CM4 it produced one EOS event and no teardown timeout; START after a completed drain resumed encoding. The existing behavior before both queues are streaming was left unchanged (see #7733).

Ngôn ngữ chính
C
Star
13.4k
Fork
5.5k
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
32

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của raspberrypi/linux

Tất cả issue của raspberrypi/linux

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.