vlc | branch: master | Steve Lhomme <[email protected]> | Mon May 9 12:53:19 2016 +0200| [d131ca2b1f94268877f58b30e22ad1ad5df3069b] | committer: Jean-Baptiste Kempf
chromecast: send a STOP message when we have no ES to send Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d131ca2b1f94268877f58b30e22ad1ad5df3069b --- modules/stream_out/chromecast/cast.cpp | 2 ++ modules/stream_out/chromecast/chromecast.h | 3 +++ modules/stream_out/chromecast/chromecast_ctrl.cpp | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp index 99455ed..5bc962a 100644 --- a/modules/stream_out/chromecast/cast.cpp +++ b/modules/stream_out/chromecast/cast.cpp @@ -187,6 +187,8 @@ static void Del(sout_stream_t *p_stream, sout_stream_id_sys_t *id) if ( p_sys->streams.empty() ) { + p_sys->p_intf->requestPlayerStop(); + sout_StreamChainDelete( p_sys->p_out, p_sys->p_out ); p_sys->p_out = NULL; p_sys->sout = ""; diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h index f89b2af..93b72fb 100644 --- a/modules/stream_out/chromecast/chromecast.h +++ b/modules/stream_out/chromecast/chromecast.h @@ -87,6 +87,8 @@ struct intf_sys_t void setHasInput( bool has_input, const std::string mime_type = ""); + void requestPlayerStop(); + private: vlc_object_t * const p_module; const int i_port; @@ -147,6 +149,7 @@ private: void processMessage(const castchannel::CastMessage &msg); void notifySendRequest(); + bool requested_stop; int sendMessage(const castchannel::CastMessage &msg); diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp index 5ed85d4..e9af82a 100644 --- a/modules/stream_out/chromecast/chromecast_ctrl.cpp +++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp @@ -102,6 +102,7 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device , i_send_ready_fd(-1) , p_creds(NULL) , p_tls(NULL) + , requested_stop(false) , conn_status(CHROMECAST_DISCONNECTED) , cmd_status(NO_CMD_PENDING) , i_receiver_requestId(0) @@ -883,6 +884,11 @@ bool intf_sys_t::handleMessages() // Not cancellation-safe part. vlc_mutex_lock(&lock); + if ( requested_stop ) + { + msgPlayerStop(); + requested_stop = false; + } /* dummy socket that we close to unblock the receiver, so we can send data */ i_send_ready_fd = vlc_socket( AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, true ); @@ -943,3 +949,16 @@ void intf_sys_t::notifySendRequest() i_send_ready_fd = -1; } } + +void intf_sys_t::requestPlayerStop() +{ + vlc_mutex_locker locker(&lock); + if ( conn_status == CHROMECAST_CONNECTION_DEAD ) + return; + + if ( mediaSessionId.empty() ) + return; + + requested_stop = true; + notifySendRequest(); +} _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
