Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to Windows #8

Open
M9Apar opened this issue Mar 1, 2017 · 10 comments
Open

Can't connect to Windows #8

M9Apar opened this issue Mar 1, 2017 · 10 comments

Comments

@M9Apar
Copy link

M9Apar commented Mar 1, 2017

hi, its not able to connect to any windows device using mircast for 4.4.2, any android device connected successfully and its frame has been render but if we follow same thing with windows it won't connect, wifiDisaplay sink struck at "kWhatReportLateness"

@xuwen0306
Copy link

xuwen0306 commented Mar 3, 2017 via email

@M9Apar
Copy link
Author

M9Apar commented Mar 3, 2017

Hi following is my board logs it runs on Android 4.4.2 and we have windows laptop runs 8.1(available in logs) and it support miracast that we tested using other Sink Application, also we tested with windows 10 running mobile same issue occurs
07-16 00:13:33.422 3151-3151/? D/P2pSinkActivity:
onReceive() [android.net.wifi.p2p.THIS_DEVICE_CHANGED]
07-16 00:13:33.432 3151-3151/? D/P2pSinkActivity: Device: K2_Dongle
 deviceAddress: 46:2c:05:2d:8c:f0
 primary type: 10-0050F204-5
 secondary type: null
 wps: 0
 grpcapab: 0
 devcapab: 0
 status: 0
 wfdInfo: WFD enabled: trueWFD DeviceInfo: 19
 WFD CtrlPort: 7236
 WFD MaxThroughput: 50
 [Connected]
07-16 00:13:33.582 3151-3151/? D/P2pSinkActivity:
onReceive() [android.net.wifi.p2p.PEERS_CHANGED]
07-16 00:13:33.592 3151-3151/? D/P2pSinkActivity:  try requestPeers()
07-16 00:13:33.592 3151-3151/? D/P2pSinkActivity:
onReceive() [android.net.wifi.p2p.CONNECTION_STATE_CHANGE]
07-16 00:13:33.602 3151-3151/? D/P2pSinkActivity: NetworkInfo: type: WIFI_P2P[]
  state: CONNECTED/CONNECTED
  reason: (unspecified)
  extra: (none)
  roaming: false
  failover: false
  isAvailable: true
  isConnectedToProvisioningNetwork: false
07-16 00:13:33.602 3151-3151/? D/P2pSinkActivity:
invokeSink() call requestGroupInfo()
07-16 00:13:33.612 3505-3505/? I/dnsmasq: DHCPDISCOVER(p2p-p2p0-9) 0e:8b:fd:5b:83:21
07-16 00:13:33.612 3505-3505/? I/dnsmasq: DHCPOFFER(p2p-p2p0-9) 192.168.49.246 0e:8b:fd:5b:83:21
07-16 00:13:33.612 3505-3505/? I/dnsmasq: DHCPREQUEST(p2p-p2p0-9) 192.168.49.246 0e:8b:fd:5b:83:21
07-16 00:13:33.612 3505-3505/? I/dnsmasq: DHCPACK(p2p-p2p0-9) 192.168.49.246 0e:8b:fd:5b:83:21 TEJAS-ULTRA
07-16 00:13:33.632 3151-3151/? D/P2pSinkActivity:  onGroupInfoAvailable():
07-16 00:13:33.642 3151-3151/? D/P2pSinkActivity: network: DIRECT-cq-K2_Dongle
 isGO: true
 GO: Device:
 deviceAddress: 46:2c:05:2d:8c:f0
 primary type: null
 secondary type: null
 wps: 0
 grpcapab: 0
 devcapab: 0
 status: 4
 wfdInfo: WFD enabled: falseWFD DeviceInfo: 0
 WFD CtrlPort: 0
 WFD MaxThroughput: 0
 Client: Device: TEJAS-ULTRA
 deviceAddress: 0c:8b:fd:5b:83:22
 primary type: 1-0050F200-0
 secondary type: null
 wps: 392
 grpcapab: 40
 devcapab: 36
 status: 0
 wfdInfo: WFD enabled: trueWFD DeviceInfo: 272
 WFD CtrlPort: 7236
 WFD MaxThroughput: 300
 interface: p2p-p2p0-9
 networkId: 9
 password: wffvMztr

07-16 00:13:33.692 3151-3151/? D/P2pSinkActivity: invokeSink() isWifiDisplaySource(TEJAS-ULTRA)=[true] port[7236]
07-16 00:13:33.702 3151-3151/? D/P2pSinkActivity: invokeSink() watch /proc/net/arp thread start.
07-16 00:13:33.712 3151-3506/? D/RarpImpl: execRarp() [0]IP address HW type Flags HW address Mask Device
07-16 00:13:33.712 3151-3506/? D/RarpImpl: execRarp() [1]192.168.49.246 0x1 0x2 0e:8b:fd:5b:83:21 * p2p-p2p0-9
07-16 00:13:33.712 3151-3506/? I/RarpImpl: parseArpLine() this is header line. don't create arp[IP address HW type Flags HW address Mask Device]
07-16 00:13:33.722 3151-3506/? D/RarpImpl: parseArpLine() created arp[ IP address:192.168.49.246¥n HW type:0x1¥n Flags:0x2¥n HW address:0e:8b:fd:5b:83:21¥n Mask:*¥n Device:p2p-p2p0-9]
07-16 00:13:36.722 3151-3151/? D/P2pSinkActivity: invokeSink() Source Addr[192.168.49.246:7236]
07-16 00:13:36.732 3151-3507/? D/Mira_for_You_JNI: Sink Display[1360, 768] Special[0] Nexus10[0]
07-16 00:13:36.732 3151-3507/? E/WifiDisplaySink: WifiDisplaySink() fopen error[2]
07-16 00:13:36.732 3151-3507/? D/WifiDisplaySink: WifiDisplaySink() Sink is Nexus10[0], FullHD[0]
07-16 00:13:36.732 3151-3507/? D/Mira_for_You_JNI: Source Addr[192.168.49.246] Port[7236]
07-16 00:13:38.742 3151-3507/? I/NetworkSession: connecting socket 57 to 192.168.49.246:7236
07-16 00:13:38.742 3151-3507/? I/WifiDisplaySink: We're now connected.
07-16 00:13:38.752 3151-3507/? D/NetworkSession: --> --> --> sendRequest() session[1] time[-1] result[0]
07-16 00:13:38.752 3151-3507/? D/NetworkSession: [-1][RTSP/1.0 200 OK
Date: Sat, 16 Jul 2016 07:13:38 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 1
Public: org.wfa.wfd1.0, GET_PARAMETER, SET_PARAMETER

                                             ]

07-16 00:13:38.752 3151-3507/? D/NetworkSession: --> --> --> sendRequest() session[1] time[-1] result[0]
07-16 00:13:38.752 3151-3507/? D/NetworkSession: [146][OPTIONS * RTSP/1.0
Date: Sat, 16 Jul 2016 07:13:38 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 1
Require: org.wfa.wfd1.0

                                             ]

07-16 00:13:39.032 3151-3507/? D/NetworkSession: --> --> --> sendRequest() session[1] time[-1] result[0]
07-16 00:13:39.032 3151-3507/? D/NetworkSession: [-1][RTSP/1.0 200 OK
Date: Sat, 16 Jul 2016 07:13:39 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 2
Content-Type: text/parameters
Content-Length: 181

                                             wfd_video_formats: 28 00 01 01 ffffffff ffffffff ffffffff 00 0000 0000 00 none none
                                             wfd_audio_codecs: AAC 0000000F 00
                                             wfd_client_rtp_ports: RTP/AVP/UDP;unicast 19000 0 mode=play
                                             ]

07-16 00:13:39.262 3151-3507/? D/NetworkSession: --> --> --> sendRequest() session[1] time[-1] result[0]
07-16 00:13:39.262 3151-3507/? D/NetworkSession: [-1][RTSP/1.0 200 OK
Date: Sat, 16 Jul 2016 07:13:39 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 3

                                             ]

07-16 00:13:39.262 3151-3507/? D/NetworkSession: --> --> --> sendRequest() session[1] time[-1] result[0]
07-16 00:13:39.262 3151-3507/? D/NetworkSession: [206][SETUP rtsp://x.x.x.x:x/wfd1.0/streamid=0 RTSP/1.0
Date: Sat, 16 Jul 2016 07:13:39 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 2
Transport: RTP/AVP/UDP;unicast;client_port=8760-8761

                                             ]

07-16 00:13:39.262 3151-3507/? D/NetworkSession: --> --> --> sendRequest() session[1] time[-1] result[0]
07-16 00:13:39.262 3151-3507/? D/NetworkSession: [-1][RTSP/1.0 200 OK
Date: Sat, 16 Jul 2016 07:13:39 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 4

                                             ]

07-16 00:13:39.262 3151-3507/? E/WifiDisplaySink: Invalid server_port description '63683-63685'.
07-16 00:13:39.262 3151-3507/? A/WifiDisplaySink: frameworks/av/media/libstagefright/wifi-display/sink/WifiDisplaySink.cpp:652 CHECK_EQ( err,(status_t)OK) failed: -1007 vs. 0
07-16 00:13:39.262 3151-3507/? A/libc: Fatal signal 6 (SIGABRT) at 0x00000c4f (code=-6), thread 3507 (Thread-70)

thats it nothing else after it, mira4u P2PSinkActivity destoy, but if we connect it with any other android device it works like charm,
and i also added patch from fix, but still the same for only Windows device

@kensuke
Copy link
Owner

kensuke commented Mar 4, 2017

https://github.com/kensuke/How-to-Miracast-on-AOSP/blob/master/frameworks/av/media/libstagefright/wifi-display/sink/WifiDisplaySink.cpp#L368

int rtpPort, rtcpPort;
if (sscanf(serverPortStr.c_str(), "%d-%d", &rtpPort, &rtcpPort) != 2
        || rtpPort <= 0 || rtpPort > 65535
        || rtcpPort <=0 || rtcpPort > 65535
        || rtcpPort != rtpPort + 1) {                             // failed this condition '63683-63685'
    ALOGE("Invalid server_port description '%s'.",
            serverPortStr.c_str());

    return ERROR_MALFORMED;
}

@M9Apar
Copy link
Author

M9Apar commented Mar 4, 2017

Hi we tested windows pc as well laptop with other Android app and it cast smoothly, but since we working on product we can't use it, and about above condition then ports well below range I dnt find issue with it

@kensuke
Copy link
Owner

kensuke commented Mar 4, 2017

rtpPort = 63683;
rtcpPort = 63685;

if (rtcpPort != rtpPort + 1) return ERROR_MALFORMED;
else // go through next steps..

@M9Apar
Copy link
Author

M9Apar commented Mar 4, 2017

So thts cause libc to crash?

@kensuke
Copy link
Owner

kensuke commented Mar 4, 2017

/frameworks/av/media/libstagefright/wifi-display/sink/WifiDisplaySink.cpp
libstagefright_wfd.so

@M9Apar
Copy link
Author

M9Apar commented Mar 4, 2017

So i think if I comment tht condition then it should work ?

@M9Apar
Copy link
Author

M9Apar commented Mar 6, 2017

confirmed that there is an issue if we comment or bypass that condition then also it crashed on same @ libc

@xuwen0306
Copy link

There are 2 issues in your logcat:

Sink received SETUP request and response OK, but the request has invalid argument:
[206][SETUP rtsp://x.x.x.x:x/wfd1.0/streamid=0 RTSP/1.0
Date: Sat, 16 Jul 2016 07:13:39 +0000
User-Agent: stagefright/1.2 (Linux;Android 4.4.2)
CSeq: 2
Transport: RTP/AVP/UDP;unicast;client_port=8760-8761

issue1: in the first Line, the IP address should be valid (like 192.168.0.1 ), but not "x.x.x.x".
issue2: in Transport section, source side should send "server_port:xxxx-xxxx", xxxx means the port server using.

Maybe issue1 is not critical, but issue2 could caused the libc crash.

For more easier debug, you can use tcpdump to capture the TCP package from the port.

Basically usage: tcpdump -i p2p_interface_name -w path_to_store_the_file.pcap

You can use wireshark to open the pcap file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants