[Merge] lp:~justinmcp/media-hub/proxy-player into lp:media-hub

Justin McPherson justin.mcpherson at canonical.com
Thu Apr 7 05:20:28 UTC 2016



Diff comments:

> 
> === modified file 'src/core/media/service_implementation.cpp'
> --- src/core/media/service_implementation.cpp	2016-03-02 18:32:46 +0000
> +++ src/core/media/service_implementation.cpp	2016-04-06 01:02:31 +0000
> @@ -297,6 +298,45 @@
>      });
>  }
>  
> +std::shared_ptr<media::Player> media::ServiceImplementation::create_proxy_session(

I like this idea. But ATM the configuration is hidden from clients, and the contents of the struct look a little "low level" to be exposed. Should the contents be exposed and new fields added, or should the current configuration struct be hidden completely, and a new version created?

> +        const media::Player::Configuration& conf)
> +{
> +    auto player = std::make_shared<media::ProxyPlayerImplementation<media::PlayerSkeleton>>(media::ProxyPlayerImplementation<media::PlayerSkeleton>::Configuration
> +    {
> +        media::PlayerSkeleton::Configuration
> +        {
> +            conf.bus,
> +            conf.service,
> +            conf.session,
> +            d->request_context_resolver,
> +            d->request_authenticator
> +        },
> +        conf.key,
> +        d->client_death_observer,
> +        d->power_state_controller
> +    });
> +
> +    auto key = conf.key;
> +    player->on_client_disconnected().connect([this, key]()
> +    {
> +        // Call remove_player_for_key asynchronously otherwise deadlock can occur
> +        // if called within this dispatcher context.
> +        // remove_player_for_key can destroy the player instance which in turn
> +        // destroys the "on_client_disconnected" signal whose destructor will wait
> +        // until all dispatches are done
> +        d->configuration.external_services.io_service.post([this, key]()
> +        {
> +            if (!d->configuration.player_store->has_player_for_key(key))
> +                return;
> +
> +            if (d->configuration.player_store->player_for_key(key)->lifetime() == Player::Lifetime::normal)
> +                d->configuration.player_store->remove_player_for_key(key);
> +        });
> +    });
> +
> +    return player;
> +}
> +
>  void media::ServiceImplementation::pause_all_multimedia_sessions(bool resume_play_after_phonecall)
>  {
>      d->configuration.player_store->enumerate_players([this, resume_play_after_phonecall](const media::Player::PlayerKey& key, const std::shared_ptr<media::Player>& player)


-- 
https://code.launchpad.net/~justinmcp/media-hub/proxy-player/+merge/268862
Your team Ubuntu Phablet Team is subscribed to branch lp:media-hub.



More information about the Ubuntu-reviews mailing list