bangnoise / ofxHapPlayer

A Hap player for OpenFrameworks
Other
147 stars 44 forks source link

Issue with multiple players #70

Open fred-dev opened 3 years ago

fred-dev commented 3 years ago

I want to use a ping pong system of multiple players to get seamless playback. There would be several pairs of players - all playerFronts and playerBacks are loaded on startup. When playerFronts[0] is done, playerbacks[0] is displayed (it is already loaded), playerFronts[0] should then load and wait until playerbacks[0] is done and around we go.

When I try to load a player while the rest are running everything crashes.

When I try this with a single player I can call load pretty much any time without stopping and it will load incredibly fast and efficiently.

Is there something I need to do to load on the fly while using multiple players?

bangnoise commented 3 years ago

Which OF version and OS? Can you provide the simplest possible project which reproduces this issue?

fred-dev commented 3 years ago

I am on OSX 10.15.7 (19H15) with OF 0.11.2 Here is a basic example https://github.com/fred-dev/ofxHapPlayer_PingPong_test I am using hap movies with aac audio converted with AVF Batch Converter - using just the built in sound card on a macbook pro.

bangnoise commented 3 years ago

Ah yeah, I see multiple issues - just as a note to myself: there's bad usage of std::condition_variable, plus deadlock when audio threads are destroyed, plus deadlock if you destroy a Demuxer and it tries to call foundMovie() before it dies.

Even once that's fixed, multiple audio streams have their own issues and it'll require a fairly hefty workaround due to limitations in OF - as detailed in #29.

fred-dev commented 3 years ago

Hi cool, I saw the thread, it is a difficult issue. It does not solve the deeper problem but Roy Macdonald made some small changes and has a fork of this repo to make this work with ofxSoundObjects , connecting to a single instance of ofSoundstream

https://github.com/roymacdonald/ofxHapPlayer/tree/ofxSoundObjects_integration

. As I said it does not solve the deeper problem and makes using ofxHapPlayer with audio somewhat more complex, but very flexible as it allows for multichannel routing.

bangnoise commented 3 years ago

OK I'll fix the problems with deadlock and crashing in this issue when I get time - if nobody beats me to it.

dimitre commented 3 years ago

Not sure if it helps but the issue was always triggered by video closing (if I load another video file in the same ofxHapPlayer object or in program exit)