-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Dual video playback with HDMI audio output get stuck when one of them is paused #547
Comments
See: popcornmix/omxplayer#317 |
Thanks for referencing that other issue. I only searched through firmware issues. As mentioned by another poster in the referenced issue: It seems to work when using the jack audio output. Is that coincidental and might break in the future or are the two audio implementations (hdmi vs local) different in the way they implement pausing? Can I rely on local output working as intended? How much do I have to pay you to fix the problem with HDMI audio? :-) |
A quick look at the analogue audio driver shows analogue behaves like hdmi when force_pwm_open=0, but with force_pwm_open=1 (the default) it implements pause differently. I'm not currently sure if hdmi could use this scheme for pausing. I've added it to my list of things to investigate, but as it's a pretty niche use case, this isn't very high priority. |
Thanks for investigating! It would be really awesome if pausing would work with HDMI as well, as that limitation seems arbitrary and seamlessly playing videos & audio over HDMI is a useful feature. Meanwhile: Is there any obvious workaround I'm missing? I cargo culted a bit and OMX_StatePause'ing the audio_renderer before stopping the clock seems to work. At least the other video continues to play. But I can't tell if audio works, since I don't have an HDMI display with audio output right now (which is also the reason why I didn't notice this whole problem earlier). If I understood your suggested solution in the reference issue correctly, I'd have to go for a purely arm side clock that replaces the OMX clock component, so I can schedule video and audio (which I then software-mix?) myself. That seems like a major change which I'd love to avoid if possible. Any other hints? |
Any chance this issue might get some love? I'm still stuck with either implementing an ugly workaround which will probably break in the future or having partially broken HDMI audio support in my program. My workaround right now is to single step the decoder for 1 frame. When the frame reaches the renderer I pause the audio component, then stop the clock. This leads to a small bit of audio (probably 1/60s for 60fps videos?) playing before I can stop the clock which I could mute so it's not noticeable. But of course this results in a single dropped "audio frame" which is noticeable when trying to do seamless video playback. As I said: ugly. Any hints on improving this are more than welcome. |
Bump. I'm also having this problem and would love to have it fixed - any chance this will happen? |
Bump. I second that. Would love to see this issue go! |
Please fix! HDMI is getting more and more important... (S-Video already got removed) |
Is there any chance this might get fixed at some point? Frame-exact video playback is difficult to do without that, as I have to preload a video file, stop playback and then start at the exact moment in time. Due to this problem this doesn't work with HDMI enabled unless it's the only video loaded/playing. Which is something I can't guarantee due to the dynamic nature of my tool. Is there anything I can do to get this fixed? |
Me too would like this problem fixed |
Any chance this might get fixed? |
I'm taking a look. The code is fairly impenetrable, and uses DMA to make things even more complicated, but I am starting to get a vague idea on how it works. Got something to try today, which may or may not have some effect. If it doesn't, not sure where to go from there! |
Thanks a lot for taking a look. I suspected that this isn't an easy problem to solve and probably requires quite a bit of reorganizing. Happy to test any new version! |
Hmm, my attempted fix does seem to work. Which is unexpected. I'd like someone with more experience of the issue to test the firmware, I've just tested with 2 OMXplayer instances. I'm just building a release, I'll upload to dropbox or similar sometime today. |
That's some existing news! Thanks again for taking the time to look into this. |
OK, can you try this firmware. https://www.dropbox.com/s/6ocsedtam6hs10u/hdmi_audo_pause_firmware.zip?dl=0 Note, I have included start.elf and start_x.elf, as I don't know which you use. You may also need to appropriate fixup.bat files as well. Good luck! |
I'll have a look at the new firmware later today. Thanks! |
This actually works for one of my previously broken test case. Awesome! What a nice present! What are the steps going forward? Is this stable already or more like a proof of concept? Out of curiosity: What did you change? Decouple the audio mixing(?) from the 'audio' sinks/clocks? |
That's good news! I'd like as much testing as possible, especially in the area of syncing audio to video when rapid pausing. I believe the fault is to do with reference counting the number of pauses, compared with the number of instances. Only when the number of pauses equals the number of instances should it actually stop the HDMI output completely (or replace with silence). It was stopping output on the first pause instead. So an easy fix compared with what I originally thought was the problem , that of the DMA being stopped or similar. |
Oh. That sounds easier than I expected. Nice catch. I can definitely do some more testing. |
So far in all my experiments everything works pretty well. Any idea on when this fix might be included in an official release? |
It seems that this fix still didn't end up in
Any chance it might be included in a future release? |
I thought it was already included! @popcornmix @pelwell Did it get lost, or did I forget to PR it? |
@JamesH65 Look at gitlab merge request 102! |
Ah Ha. Should now be going through the merge process. Not sure when it will appear in public, but its on its way. Probably less than a week to hit rpi-update. |
See: raspberrypi/firmware#955 firmware: hat_lib: Only probe HAT EEPROM if ID pins are inputs firmware: Added a arm_display_kick function firmware: Possible fix for HDMI audio pause See: raspberrypi/firmware#547 firmware: arm_loader: Always set the turbo frequencies immediately See: raspberrypi/firmware#956
I've run into another very similar problem and I would suspect that it's the same underlying problem. Try the following:
This only happens when
|
Sorry about delay - missed the follow up question. I can replicate this, and I suspect you are right that it is similar. The local driver doesn't have any reference counting either. I'll drop some in, and see what happens. |
Hmm, similar fix as the HDMI doesn't fix the issue, but not sure why...will keep looking. |
OK, found it. Have asked for a fix to be merged to our firmware tree. Still awaiting review, but hopefully in rpi-update in the next week or so. |
kernel: overlays: Add ssd1306 overlay for OLED display See: #1098 kernel: overlays: mcp23017: Support the MCP23008 See: raspberrypi/linux#2818 kernel: overlays: Add mcp342x overlay See: raspberrypi/linux#2819 kernel: configs: Add CONFIG_USB_UAS=m See: raspberrypi/linux#2813 firmware: interface: Drop vcfiled See: raspberrypi/userland#525 firmware: Add reference counting to the local audio players See: #547 firmware: arm_loader: Add reporting the firmware git hash via the mailbox firmware: vcos: Add reporting of which variant was built See: raspberrypi/linux#2806 firmware: Update vcdbg help See: #594
kernel: overlays: Add ssd1306 overlay for OLED display See: raspberrypi/firmware#1098 kernel: overlays: mcp23017: Support the MCP23008 See: raspberrypi/linux#2818 kernel: overlays: Add mcp342x overlay See: raspberrypi/linux#2819 kernel: configs: Add CONFIG_USB_UAS=m See: raspberrypi/linux#2813 firmware: interface: Drop vcfiled See: raspberrypi/userland#525 firmware: Add reference counting to the local audio players See: raspberrypi/firmware#547 firmware: arm_loader: Add reporting the firmware git hash via the mailbox firmware: vcos: Add reporting of which variant was built See: raspberrypi/linux#2806 firmware: Update vcdbg help See: raspberrypi/firmware#594
Merge has now been done, so will be in rpi-update in the next few days. Would apreciate some testing on this, but in my checks all seemed well. If happy, please close the issue. |
rpi-update firmware contains @JamesH65's fix. |
I've just tested this with both analog and HDMI output and both cases now work as expected. Thanks for fixing. Bug report can be considered closed. |
Cool, thanks for testing. |
Hi.
I encountered a problem when having multiple OMX pipelines setup like this:
I start playback on each pipeline by feeding video data and decoded audio data into the buffers of video_decoder and audio_render. This works fine and I can play two videos at the same time without problems.
The problem is when both audio_render components are configured to send audio to HDMI using OMX_IndexConfigBrcmAudioDestination. Once I do that and stop one of the clocks by setting its xScale value to 0, the other video gets stuck after a few moments. It seems that it can't request another audio input buffer from the audio_render component and the complete pipeline stalls. Once I restart the clock of the other video, both videos continue.
First I thought I might have some problem in my code, but I was able to reproduce the problem with omxplayer: You need a longer video with sounds. I used the I am legend trailer from here: http://www.dvdloc8.com/clip.php?movieid=13599&clipid=4
Then in two terminals run these commands:
and
Now pause one of them by pressing space and wait for approximately 10 seconds: The other one will get stuck. It takes a bit longer to reproduce with omxplayer, since it seems to allocate more audio buffers.
When switching any or both of the audio targets to local it works as expected, so it seems HDMI related.
I tested on Raspbian wheezy
The text was updated successfully, but these errors were encountered: