Handle resource requests through singleton.
authorRobin Burchell <robin.burchell@jollamobile.com>
Tue, 3 Jun 2014 09:07:23 +0000 (11:07 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 4 Jun 2014 11:58:08 +0000 (13:58 +0200)
commitae567c3f35f98f61c4797a9073b942c20c6e67c6
treedfc5a974ce6b07674e02291acfdea82a5e4db074
parent7e41e842f8c6dccedd124fb0609be1a57c7c095a
Handle resource requests through singleton.

Many applications have multiple objects dealing with audio, and each
needs to request audio resources from resource policy manager. Resource
policy manager handles audio resources per-manager. Each ResourceSet
instance creates new manager, which causes applications having multiple
audio objects to fight for the audio resources internally, even though
the streams are played from the same process id.

To overcome this in QtMultimedia applications, handle all ResourceSet
operations through singleton. This way one client has only one manager
id registered, and resource acquiring and releasing can be limited to
only when no resources are acquired or all resources are freed. To
reduce unnecessary noise from resource policy plugin to the clients,
keep track of client states and only notify clients which themselves
request for resources etc.

Change-Id: Ifa4488a9f6298a3f601399e9d339f7bd819be757
Done-with: Juho Hämäläinen <juho.hamalainen@tieto.com>
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
src/plugins/resourcepolicy/resourcepolicy.pro
src/plugins/resourcepolicy/resourcepolicyimpl.cpp
src/plugins/resourcepolicy/resourcepolicyimpl.h
src/plugins/resourcepolicy/resourcepolicyint.cpp [new file with mode: 0644]
src/plugins/resourcepolicy/resourcepolicyint.h [new file with mode: 0644]