Video device default resource contention is not sufficient
The default implementation of the resource contention handling gives a favor to the client which already owns the resource in the case when that client and the other client which asks for the resource are of the same priority.
This is especially a problem when both requests are originated by the same application.
Spec is silent on how resource management should be handled for such cases. It mostly cares of resource contention management between different apps rather than requests from the single app assuming the app should handle resource contention itself.
- An application taken video device as part of the resource acquisition for the abstract player (ServiceContext.select()). Such an acquisition is called implicit and produces special class of resource usage - ServiceContextResourceUsage. This resource remains busy until player is stopped (which normally never happens as some service is almost always presenting)
- The same app when trying to change video configuration also needs to acquire video device (which is done automatically by the HVideoDevice.setVideoConfiguration() implementation. In this case ApplicationResourceUsage is constructed for the request.
- Both requests are originated by the same app thus same priority, etc. The default contention handler will keep the resource for the first client, i.e. player and reject a request to change the video config.
This is really arbitrary thing which needs discussion.
Here are some thoughts/approaches.
- It can be an application responsibility to stop the player before accessing video device. In this case nothing has to change in the implementation.
- Implicit requests may have less priority for the default contention handler. In this case an ApplicationResourceUsage will get a favor over ServiceContextResourceUsage
- Specs says that the default contention handling can treat different resources differently. Thus the default contention logic for the video device can be modified to give a favor to the explicit application requests over implicit ones
- No resource management for the requests from the same app, the priority have the one who come last.