vlc | branch: master | Steve Lhomme <[email protected]> | Mon May 9 22:08:48 2016 +0200| [eaf14d15feb49f61b549f8f02a48c096d1f19d54] | 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=eaf14d15feb49f61b549f8f02a48c096d1f19d54 --- modules/stream_out/chromecast/cast.cpp | 2 ++ modules/stream_out/chromecast/chromecast.h | 4 ++++ modules/stream_out/chromecast/chromecast_ctrl.cpp | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp index 94808f5..bc4c462 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 fc1f524..b174a00 100644 --- a/modules/stream_out/chromecast/chromecast.h +++ b/modules/stream_out/chromecast/chromecast.h @@ -34,6 +34,7 @@ #include <vlc_tls.h> #include <vlc_interrupt.h> +#include <atomic> #include <sstream> #include "cast_channel.pb.h" @@ -88,6 +89,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 +150,7 @@ private: void processMessage(const castchannel::CastMessage &msg); void notifySendRequest(); + std::atomic_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 28fe8cf..367aa37 100644 --- a/modules/stream_out/chromecast/chromecast_ctrl.cpp +++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp @@ -100,6 +100,7 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device , i_sock_fd(-1) , p_creds(NULL) , p_tls(NULL) + , requested_stop(false) , conn_status(CHROMECAST_DISCONNECTED) , cmd_status(NO_CMD_PENDING) , i_receiver_requestId(0) @@ -871,6 +872,11 @@ bool intf_sys_t::handleMessages() bool b_msgReceived = false; uint32_t i_payloadSize = 0; + if ( requested_stop.exchange(false) && !mediaSessionId.empty() ) + { + msgPlayerStop(); + } + int i_ret = recvPacket( b_msgReceived, i_payloadSize, &i_received, p_packet, &b_pingTimeout, &i_waitdelay, &i_retries); @@ -908,3 +914,9 @@ void intf_sys_t::notifySendRequest() { vlc_interrupt_raise( p_ctl_thread_interrupt ); } + +void intf_sys_t::requestPlayerStop() +{ + requested_stop = true; + notifySendRequest(); +} _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
