Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
6147305c
Commit
6147305c
authored
Dec 23, 2015
by
Steve Lhomme
Committed by
Jean-Baptiste Kempf
Dec 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chromecast: make conn_status private and use getter/setter
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
f2993b77
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
18 deletions
+39
-18
modules/stream_out/chromecast/cast.cpp
modules/stream_out/chromecast/cast.cpp
+7
-7
modules/stream_out/chromecast/chromecast.h
modules/stream_out/chromecast/chromecast.h
+24
-3
modules/stream_out/chromecast/chromecast_ctrl.cpp
modules/stream_out/chromecast/chromecast_ctrl.cpp
+8
-8
No files found.
modules/stream_out/chromecast/cast.cpp
View file @
6147305c
...
...
@@ -212,7 +212,7 @@ static int Open(vlc_object_t *p_this)
Clean
(
p_stream
);
return
VLC_EGENERIC
;
}
p_sys
->
p_intf
->
conn_status
=
CHROMECAST_TLS_CONNECTED
;
p_sys
->
p_intf
->
setConnectionStatus
(
CHROMECAST_TLS_CONNECTED
)
;
char
psz_localIP
[
NI_MAXNUMERICHOST
];
if
(
net_GetSockAddress
(
p_sys
->
i_sock_fd
,
psz_localIP
,
NULL
))
...
...
@@ -265,7 +265,7 @@ static int Open(vlc_object_t *p_this)
int
i_ret
=
0
;
const
mtime_t
deadline
=
mdate
()
+
6
*
CLOCK_FREQ
;
vlc_mutex_lock
(
&
p_intf
->
lock
);
while
(
p_sys
->
p_intf
->
conn_status
!=
CHROMECAST_MEDIA_LOAD_SENT
)
while
(
p_sys
->
p_intf
->
getConnectionStatus
()
!=
CHROMECAST_MEDIA_LOAD_SENT
)
{
i_ret
=
vlc_cond_timedwait
(
&
p_sys
->
p_intf
->
loadCommandCond
,
&
p_intf
->
lock
,
deadline
);
if
(
i_ret
==
ETIMEDOUT
)
...
...
@@ -305,7 +305,7 @@ static void Close(vlc_object_t *p_this)
vlc_cancel
(
p_sys
->
chromecastThread
);
vlc_join
(
p_sys
->
chromecastThread
,
NULL
);
switch
(
p_sys
->
p_intf
->
conn_status
)
switch
(
p_sys
->
p_intf
->
getConnectionStatus
()
)
{
case
CHROMECAST_MEDIA_LOAD_SENT
:
case
CHROMECAST_APP_STARTED
:
...
...
@@ -387,7 +387,7 @@ static void disconnectChromecast(sout_stream_t *p_stream)
vlc_tls_SessionDelete
(
p_sys
->
p_tls
);
vlc_tls_Delete
(
p_sys
->
p_creds
);
p_sys
->
p_tls
=
NULL
;
p_sys
->
p_intf
->
conn_status
=
CHROMECAST_DISCONNECTED
;
p_sys
->
p_intf
->
setConnectionStatus
(
CHROMECAST_DISCONNECTED
)
;
}
}
...
...
@@ -599,7 +599,7 @@ static void* chromecastThread(void* p_data)
{
msg_Err
(
p_stream
,
"The connection to the Chromecast died."
);
vlc_mutex_locker
locker
(
&
p_sys
->
p_intf
->
lock
);
p_sys
->
p_intf
->
conn_status
=
CHROMECAST_CONNECTION_DEAD
;
p_sys
->
p_intf
->
setConnectionStatus
(
CHROMECAST_CONNECTION_DEAD
)
;
break
;
}
...
...
@@ -628,12 +628,12 @@ static void* chromecastThread(void* p_data)
{
msg_Err
(
p_stream
,
"The connection to the Chromecast died."
);
vlc_mutex_locker
locker
(
&
p_sys
->
p_intf
->
lock
);
p_sys
->
p_intf
->
conn_status
=
CHROMECAST_CONNECTION_DEAD
;
p_sys
->
p_intf
->
setConnectionStatus
(
CHROMECAST_CONNECTION_DEAD
)
;
}
}
vlc_mutex_lock
(
&
p_sys
->
p_intf
->
lock
);
if
(
p_sys
->
p_intf
->
conn_status
==
CHROMECAST_CONNECTION_DEAD
)
if
(
p_sys
->
p_intf
->
getConnectionStatus
()
==
CHROMECAST_CONNECTION_DEAD
)
{
vlc_mutex_unlock
(
&
p_sys
->
p_intf
->
lock
);
break
;
...
...
modules/stream_out/chromecast/chromecast.h
View file @
6147305c
...
...
@@ -31,6 +31,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <queue>
...
...
@@ -71,6 +72,24 @@ struct intf_sys_t
void
msgAuth
();
void
msgReceiverClose
(
std
::
string
destinationId
);
connection_status
getConnectionStatus
()
const
{
return
conn_status
;
}
void
setConnectionStatus
(
connection_status
status
)
{
if
(
conn_status
!=
status
)
{
#ifndef NDEBUG
msg_Dbg
(
p_stream
,
"change Chromecast connection status from %d to %d"
,
conn_status
,
status
);
#endif
conn_status
=
status
;
vlc_cond_broadcast
(
&
loadCommandCond
);
}
}
void
msgPing
();
void
msgPong
();
void
msgConnect
(
const
std
::
string
&
destinationId
=
DEFAULT_CHOMECAST_RECEIVER
);
...
...
@@ -80,12 +99,14 @@ struct intf_sys_t
void
msgPlayerLoad
();
enum
connection_status
conn_status
;
std
::
queue
<
castchannel
::
CastMessage
>
messagesToSend
;
unsigned
i_requestId
;
void
processMessage
(
const
castchannel
::
CastMessage
&
msg
);
private:
enum
connection_status
conn_status
;
unsigned
i_requestId
;
};
#endif
/* VLC_CHROMECAST_H */
modules/stream_out/chromecast/chromecast_ctrl.cpp
View file @
6147305c
...
...
@@ -111,7 +111,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
else
{
vlc_mutex_locker
locker
(
&
lock
);
conn_status
=
CHROMECAST_AUTHENTICATED
;
setConnectionStatus
(
CHROMECAST_AUTHENTICATED
)
;
msgConnect
(
DEFAULT_CHOMECAST_RECEIVER
);
msgReceiverLaunchApp
();
}
...
...
@@ -164,25 +164,25 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
if
(
p_app
)
{
if
(
!
appTransportId
.
empty
()
&&
conn_status
==
CHROMECAST_AUTHENTICATED
)
&&
getConnectionStatus
()
==
CHROMECAST_AUTHENTICATED
)
{
conn_status
=
CHROMECAST_APP_STARTED
;
setConnectionStatus
(
CHROMECAST_APP_STARTED
)
;
msgConnect
(
appTransportId
);
msgPlayerLoad
();
conn_status
=
CHROMECAST_MEDIA_LOAD_SENT
;
setConnectionStatus
(
CHROMECAST_MEDIA_LOAD_SENT
)
;
vlc_cond_signal
(
&
loadCommandCond
);
}
}
else
{
switch
(
conn_status
)
switch
(
getConnectionStatus
()
)
{
/* If the app is no longer present */
case
CHROMECAST_APP_STARTED
:
case
CHROMECAST_MEDIA_LOAD_SENT
:
msg_Warn
(
p_stream
,
"app is no longer present. closing"
);
msgReceiverClose
(
appTransportId
);
conn_status
=
CHROMECAST_CONNECTION_DEAD
;
setConnectionStatus
(
CHROMECAST_CONNECTION_DEAD
)
;
default:
break
;
}
...
...
@@ -214,7 +214,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
msg_Err
(
p_stream
,
"Media load failed"
);
msgReceiverClose
(
appTransportId
);
vlc_mutex_lock
(
&
lock
);
conn_status
=
CHROMECAST_CONNECTION_DEAD
;
setConnectionStatus
(
CHROMECAST_CONNECTION_DEAD
)
;
vlc_mutex_unlock
(
&
lock
);
}
else
...
...
@@ -235,7 +235,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
{
msg_Warn
(
p_stream
,
"received close message"
);
vlc_mutex_lock
(
&
lock
);
conn_status
=
CHROMECAST_CONNECTION_DEAD
;
setConnectionStatus
(
CHROMECAST_CONNECTION_DEAD
)
;
vlc_mutex_unlock
(
&
lock
);
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment