Hi,
Some Devices (I've seen this with a Dell Windows 10 tablet) send messages
like this:
----------------------------------->8---------------------------------
RTSP/1.0 200 OK
Transport:
RTP/AVP/UDP;unicast;client_port=1990;server_port=50004;ssrc=3ea8613d;rtcp-fb-ssrc=dae4bde4
Server: MSMiracastSource/10.00.10011.16485 guid/40662FBB-9420-11E5-8275-0023545C6497
Blocksize: 1450
Session: 431521898
CSeq: 2
----------------------------------->8---------------------------------
The parser fails to parse the 'Transport:' line because of the extra stuff
at the end, and the state machine stops there.
I've worked around this with the diff below. However, this does not handle
port ranges, or if the server port is missing. I don't know much about
yacc. Is there a better way to handle this, than duplicating each version
with and without the extra part?
Regards,
Michael
diff --git a/libwds/rtsp/headerlexer.l b/libwds/rtsp/headerlexer.l
index bfc0fb957e18..79d592950b61 100644
--- a/libwds/rtsp/headerlexer.l
+++ b/libwds/rtsp/headerlexer.l
@@ -76,6 +76,7 @@ ERROR ({DIGIT}){3}
";timeout=" return token::WFD_TIMEOUT;
";server_port=" return token::WFD_SERVER_PORT;
+";ssrc=".* return token::WFD_TRANSPORT_OTHER;
^(?-i:"OPTIONS") {
BEGIN(INITIAL);
diff --git a/libwds/rtsp/parser.ypp b/libwds/rtsp/parser.ypp
index 1eaea890dba5..95e2607a66d1 100644
--- a/libwds/rtsp/parser.ypp
+++ b/libwds/rtsp/parser.ypp
@@ -251,6 +251,7 @@
%token <sval> WFD_SESSION_ID
%token WFD_TIMEOUT
%token WFD_TRANSPORT
+%token WFD_TRANSPORT_OTHER
%token WFD_SERVER_PORT
%type <message> options set_parameter get_parameter setup play teardown pause
@@ -488,6 +489,11 @@ wfd_transport:
$$->set_client_port ($2);
$$->set_server_port ($4);
}
+ | WFD_TRANSPORT WFD_NUM WFD_SERVER_PORT WFD_NUM WFD_TRANSPORT_OTHER {
+ $$ = new TransportHeader();
+ $$->set_client_port ($2);
+ $$->set_server_port ($4);
+ }
| WFD_TRANSPORT WFD_NUM '-' WFD_NUM WFD_SERVER_PORT WFD_NUM {
$$ = new TransportHeader();
$$->set_client_port ($2);
--
Pengutronix e.K. | |
Industrial Linux Solutions |
http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |