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

Abierto
#7,784 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
40/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c, linux
Área
embedded-iot

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).

Lenguaje dominante
C
Estrellas
13.4k
Forks
5.5k
Merge medio
2 d 11 h
PR fusionados (30 d)
32

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de raspberrypi/linux

Todos los issues de raspberrypi/linux

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.