ofxHapPlayer icon indicating copy to clipboard operation
ofxHapPlayer copied to clipboard

Issue with multiple players

Open fred-dev opened this issue 3 years ago • 6 comments

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?

fred-dev avatar Apr 28 '21 06:04 fred-dev

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

bangnoise avatar Apr 28 '21 08:04 bangnoise

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.

fred-dev avatar May 05 '21 01:05 fred-dev

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.

bangnoise avatar May 05 '21 15:05 bangnoise

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.

fred-dev avatar May 06 '21 02:05 fred-dev

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

bangnoise avatar May 06 '21 07:05 bangnoise

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)

dimitre avatar May 06 '21 14:05 dimitre