Skip to content

media: bcm2835-codec: Increase video callbacks limit #4658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

popcornmix
Copy link
Collaborator

The previous commit limited callbacks to DPB+5.
This has been found insufficient for kodi and ffmpeg
decoding h.264. Increase to DPB+6

Fixes: f814bfc

Signed-off-by: Dom Cobley [email protected]

The previous commit limited callbacks to DPB+5.
This has been found insufficient for kodi and ffmpeg
decoding h.264. Increase to DPB+6

Fixes: f814bfc

Signed-off-by: Dom Cobley <[email protected]>
@popcornmix
Copy link
Collaborator Author

See discussion here
(and wait for confirmation that fixes @satmandu's issue).

It is possibly 7 may be needed, but lets wait and see.

Ping @jc-kynesim @6by9

@satmandu
Copy link

@popcornmix I'm getting the same issue as before when I apply https://patch-diff.githubusercontent.com/raw/raspberrypi/linux/pull/4658.patch to Top of tree rpi-5.15.y.

Trying a rebuild with 7...

@satmandu
Copy link

satmandu commented Oct 28, 2021

No luck even with it set to 7.

FYI vc-log gives me this:

[  297.297033] vcos: mmal: mmal_component_parameter_set: parameter id 0x00020038 not supported

Removing the -vcodec h264_v4l2m2m from the ffplay command line once again allows it to work.

@popcornmix
Copy link
Collaborator Author

@satmandu what does vcgencmd version report?

@satmandu
Copy link

Ah I have the default ubuntu firmware...

sudo vcgencmd version
Aug 31 2021 14:52:47
Copyright (c) 2012 Broadcom
version 67615e950e1e28b92dfae6303cf7a8b879a8908f (clean) (release) (start)

@satmandu
Copy link

With the newest firmware...

sudo vcgencmd version
Oct 28 2021 14:14:14
Copyright (c) 2012 Broadcom
version bcdfe55d56b75b4be52c10d73bdb4a60e2b49f75 (clean) (release) (start)

I get this from vc-log:

[  280.423679] unknown: video_decode:6:RIL: colourspace changing

And still the same breakage with no video to display.

ffplay version 4.4-6ubuntu5 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-7ubuntu1)
  configuration: --prefix=/usr --extra-version=6ubuntu5 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rtsp, from 'rtsp://<rtsp URL>/live':0
  Metadata:
    title           : Session streamed by the WYZE Media Server
    comment         : live
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080, 20 fps, 20 tbr, 90k tbn, 40 tbc
  Stream #0:1: Audio: pcm_alaw, 16000 Hz, 1 channels, s16, 128 kb/s
[h264_v4l2m2m @ 0x7f7804f600] Using device /dev/video10
[h264_v4l2m2m @ 0x7f7804f600] driver 'bcm2835-codec' on card 'bcm2835-codec-decode' in mplane mode
[h264_v4l2m2m @ 0x7f7804f600] requesting formats: output=H264 capture=YU12

@jc-kynesim
Copy link
Contributor

@6by9 does a colourspace change cause a format change event? If so I'm going to guess that that is a ffmpeg without proper support for that.

@6by9
Copy link
Contributor

6by9 commented Oct 29, 2021

does a colourspace change cause a format change event?

Yes it does as it is part of the V4L2 format.

@satmandu
Copy link

If I need to be trying this with an ffmpeg binary built from raspi-os 64-bit that's fine too...

If someone can point me to the dsc file so I can rebuild that for ubuntu...

@6by9
Copy link
Contributor

6by9 commented Oct 29, 2021

I'm not sure this will even have been fixed in Raspberry Pi OS, but I haven't seen issues.

https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/v4l2_context.c#L195 does not follow the specification given in https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/dev-decoder.html#dynamic-resolution-change.
It only does anything if the resolution has changed, but the spec gives no option:

A source change triggers an implicit decoder drain, similar to the explicit Drain sequence. The decoder is stopped after it completes. The decoding process must be resumed with either a pair of calls to VIDIOC_STREAMOFF() and VIDIOC_STREAMON() on the CAPTURE queue, or a call to VIDIOC_DECODER_CMD() with the V4L2_DEC_CMD_START command.

If neither of those is done (actually the codec doesn't support V4L2_DEC_CMD_START at present), then decode will be stopped waiting for it to happen.
reinit shouldn't be conditional on the return value from v4l2_resolution_changed(&s->capture, &cap_fmt);, it should always be 1.

@popcornmix
Copy link
Collaborator Author

No longer needed as "media: bcm2835-codec: Limit video callbacks" has been reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants