Skip to content
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

bcm2835_codec fixes #3790

Merged
merged 3 commits into from
Aug 13, 2020
Merged

bcm2835_codec fixes #3790

merged 3 commits into from
Aug 13, 2020

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Aug 13, 2020

These are from investigating seeking not working with gst-play. It does now.

6by9 added 3 commits August 13, 2020 17:10
The allocated input and output buffers are initialised in
buf_init and should only be cleared up in buf_cleanup.
stop_streaming was (incorrectly) cleaning up the buffers to
avoid an issue in videobuf2 that had been fixed by the orphaned
buffer support.

Remove the erroneous cleanup.

Signed-off-by: Dave Stevenson <[email protected]>
…fernum

start_streaming passes a count of how many buffers have been queued
to videobuf2.

Allow this value to update the number of buffers the VPU allocates
on a port to avoid buffer recycling issues.

Signed-off-by: Dave Stevenson <[email protected]>
start_streaming enabled the VPU component if ctx->component_enabled
was not set.
stop_streaming disabled the VPU component if both ports were
disabled. It didn't clear ctx->component_enabled.

If seeking, this meant that the component never got re-enabled,
and buffers never got processed afterwards.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9
Copy link
Contributor Author

6by9 commented Aug 13, 2020

@popcornmix I don't know whether these will fix FFmpeg/Kodi as well.

The second patch is working around an issue in GStreamer that has been fixed in 1.16, but I believe is still valid within the V4L2 API, so we ought to support.

@popcornmix
Copy link
Collaborator

I can test with ffmpeg/kodi.
Do you believe header bytes need to be fed in again after a seek? (i.e. have we flushed decoder in such a way it will have forgotten previous ones)

@6by9
Copy link
Contributor Author

6by9 commented Aug 13, 2020

Not sure - I didn't analyse the packet that GStreamer fed back in after the seek.

We have done a full codec shutdown on the VPU, however video_decode updates an internal structure which may be enough to restore the codec state after the seek.

@6by9
Copy link
Contributor Author

6by9 commented Aug 13, 2020

If FFmpeg doesn't work, then the way I read the V4L2 M2M spec, as long as it follows the specified procedure then the codec is responsible for remembering the header bytes. That's based on the warning regarding H264 and seeking over a change of SPS/PPS - that wouldn't be necessary if the codec was expected to drop the header bytes.

GStreamer shuts down both OUTPUT and CAPTURE queues on seek, therefore I'd view that as reasonable to forget everything.

@pelwell pelwell merged commit cc069e1 into raspberrypi:rpi-5.4.y Aug 13, 2020
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Aug 14, 2020
kernel: bcm2835_codec fixes
See: raspberrypi/linux#3790

kernel: FKMS - correct possible_crtcs flags, and increase the number of planes
See: raspberrypi/linux#3740

kernel: config: Add USB gadget support to bcm2711 config
kernel: overlays: Regenerate upstream-pi4
kernel: ARM: dts: Add required USB power domain for XCHI
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Aug 14, 2020
kernel: bcm2835_codec fixes
See: raspberrypi/linux#3790

kernel: FKMS - correct possible_crtcs flags, and increase the number of planes
See: raspberrypi/linux#3740

kernel: config: Add USB gadget support to bcm2711 config
kernel: overlays: Regenerate upstream-pi4
kernel: ARM: dts: Add required USB power domain for XCHI
@6by9
Copy link
Contributor Author

6by9 commented Aug 14, 2020

Still waiting on tenterhooks to know if worked with Kodi!

@popcornmix
Copy link
Collaborator

Had some build issues and ended up having to do a clean build.
There's a kodi build on Pi4 and an LE cross-compile in progress. Hopefully one will work.

@popcornmix
Copy link
Collaborator

Got an LE build running, but no joy. H264 video plays but I don't get any video frames out after a seek.

@popcornmix
Copy link
Collaborator

Not sure if there's any useful info here, but after a seek, there are complaints in dmesg (not immediately but after a few seconds).
http://ix.io/2uh3

@timemaster5
Copy link

Hmm, unfortunately, the problem persists. I tested on Raspberry pi 3b+ with youtube playing 1080p video on wpewebkit-fdo platform. Tested on kernel 5.4.59.

@moritzvieli
Copy link

I don't understand enough details in this topic, but this patch fixed the seeking issue for me: #3325 (comment)

@timemaster5
Copy link

I believe this issue is also related to this one #3791, where I posted the full dmesg

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.

5 participants