Commit eaf14d15 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

chromecast: send a STOP message when we have no ES to send

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 19c661f0
......@@ -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 = "";
......
......@@ -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);
......
......@@ -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();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment