Method for quickly establishing wireless projection connection of PC device
By using the mDNS protocol for device discovery and connection within the same local area network, the problem of slow and unstable wireless screen mirroring connection for PC devices under the Miracast specification is solved, achieving fast and stable screen mirroring connection.
Patent Information
- Application Number
- CN202310240764.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-03-14
AI Technical Summary
Under the existing Miracast specification, wireless screen mirroring connections for PC devices are slow and unstable, especially prone to failure during P2P connections.
The mDNS protocol is used to discover devices within the same local area network. By using mDNS query requests and responses, the IP and port information of the sink device can be obtained directly, simplifying the connection process and establishing a TCP connection.
It improves device discovery speed and connection establishment speed, achieves a connection success rate of 99%, and significantly enhances stability.
Smart Images

Figure CN116347150B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technology of device connection in local area network, in particular to the method for quickly establishing PC device wireless screen projection connection. BACKGROUND
[0002] WiFi Alliance defines Miracast specification, which provides technical framework for wireless link, mutual discovery, pairing, connection and multimedia display to realize image and sound projection from source device to sink device.
[0003] Physical layer, which depends on 2.4GHz or 5GHz wireless channel group.
[0004] Link layer, which realizes device discovery and link establishment through Wifi-P2P technology, or TDLS technology and Wifi Infrastructure.
[0005] IP layer allocates IP address to sending and receiving devices through C / S structure of DHCP.
[0006] On IP layer, session is defined, which is TCP-based control session and UDP-based stream data session. Among them, control layer includes: multimedia capability negotiation and setting through RTSP, and receiving end control over sending end through UIBC. Data layer is H.264 code stream packaged by RTP. Its technical framework diagram is shown in Figure 1
[0007] Based on Miracast specification, two operating systems with very large usage, commercial Android system and Windows 10, both integrate WFD source and sink functions. Many domestic Android mobile phone manufacturers' products have WFD source function, and many smart TV manufacturers based on Android system have WFD sink function. Windows 10 system has both source and sink functions.
[0008] In the market, general WFD source projection to sink uses common Miracast R1 specification, which is the earliest version of protocol specification, that is, to realize device discovery and link establishment based on wifi-p2p, and then to negotiate IP and establish multimedia session based on IP. The advantage of this method is that it does not need wifi network, that is, source and sink do not need to access the same wireless local area network at the same time. However, its disadvantages are also obvious:
[0009] 1) Wireless card driver must support P2P function.
[0010] 2) P2P connection process has multiple links, the connection speed is slow, the probability of problems in the process is also large, and the success rate is not particularly high, for example, using a Huawei Android mobile phone or a Windows 10 computer, screen projection of a SONY television with an Android system will fail. SUMMARY
[0011] To solve the problems in the prior art, the application provides a PC device wireless screen projection connection quick establishment method, which is realized based on two PC devices in the same wireless local area network, wherein the two PC devices are respectively used as a source and a sink, and the discovery of the devices is completed through the following steps:
[0012] Step S1: the source starts the screen projection function, joins the multicast group through the mDNS protocol, publishes the displaysrc_tcp service, and announces to the local area network that it supports the source function of Miracast;
[0013] Step S2: the sink starts the projection receiving function, joins the multicast group through the mDNS protocol, publishes the display_tcp service, and announces to the local area network that it supports the sink function of Miracast;
[0014] Step S3: the source starts the front-end interface process to discover and analyze the service, and the front-end interface process searches the sink device in the local area network that supports the display_tcp service;
[0015] Step S4: the sink receives the mDNS query request for the display_tcp service sent by the source, and replies to the source with a response frame containing its hostname;
[0016] Step S5: the source analyzes the hostname according to the received response frame, presents the sink device list on the front-end interface, and provides the user with a sink object for selection.
[0017] In step S3, the front-end interface process discovers and analyzes the sink device in the local area network that supports the display_tcp service by sending an mDNS query request.
[0018] In step S3, the front-end interface process discovers and analyzes the sink device in the local area network that supports the display_tcp service by sending an mDNS query request.
[0019] Step S6: the source organizes an mDNS query message according to the hostname device selected by the user, multicasts it out, and queries the specific information of the hostname;
[0020] Step S7: the sink end receives the mDNS query message associated with the host name of itself, informs the IP and port number information of itself, and implements the listening to the TCP port, and waits for the access of the source end device;
[0021] Step S8: the source end directly establishes the TCP connection with the IP and port number informed by the sink end, after the success, first listens to the RTSP service port of itself, and then sends the source name, RTSP service port number and session start command of itself to the corresponding sink end.
[0022] The application improves the device discovery speed and the connection establishment speed when the screen is projected, and improves the stability of the connection. BRIEF DESCRIPTION OF DRAWINGS
[0023] Figure 1 : the implementation flowchart of the control session based on TCP and the stream data session based on UDP of the prior art.
[0024] Figure 2 : the technical conception diagram of the PC device wireless screen projection connection fast establishment method of the application.
[0025] Figure 3 : the device discovery process implementation flowchart of the PC device wireless screen projection connection fast establishment method of the application.
[0026] Figure 4 : the device connection process implementation flowchart of the PC device wireless screen projection connection fast establishment method of the application. DETAILED DESCRIPTION
[0027] In order to have a further understanding of the technical scheme and beneficial effects of the application, the technical scheme of the application and the beneficial effects generated thereby are described in detail below with reference to the drawings.
[0028] The terms involved in the application are explained as follows:
[0029] Miracast: a set of specifications certified by WIFI alliance, which defines the specifications of device discovery, pairing, connection and multimedia display.
[0030] WFD: Wi-Fi Display, which can be understood as a device supporting the specifications.
[0031] Sink: in the wireless screen projection connection based on the Miracast framework, the receiving and display device of the projected image.
[0032] Source: in the wireless screen projection connection based on the Miracast framework, the sending source device of the projected image.
[0033] WLAN: wireless local area network.
[0034] RTSP: real-time streaming protocol.
[0035] The application scenario of analyzing wireless screen projection is all near field communication. Therefore, in most cases, the source device and the sink device are in the same WLAN, and therefore, a technical solution is implemented to optimize the following scenarios according to the R2 protocol of Miracast.
[0036] Two devices with Kirin operating system in the same wireless local area network, respectively playing the roles of WFD source and sink, establish a projection relationship, accelerate the establishment of a multimedia session, and improve the success rate of connection.
[0037] As shown in Figure 2 , the overall technical solution implementation is divided into: device discovery modification; connection session establishment optimization.
[0038] According to the description in the overall technical solution, it should be noted that the prerequisite for the specific implementation of the present application - two computers equipped with wireless network cards, both need to be equipped with Kirin operating system. The main purpose of the present application is to take Kirin operating system as the environment, to take the source module and sink module of wireless screen projection as the object, to extend based on the Miracast specification, and to improve the speed and success rate of establishing a multimedia session connection between the WFD source end and the sink end.
[0039] Based on the overall technical solution provided in Figure 2 , the present application mainly modifies the device discovery process and the device connection session establishment process.
[0040] Figure 3 The device discovery process implementation flowchart of the PC device wireless screen projection connection fast establishment method of the present application is shown in Figure 3 , the device discovery process of two computers A and B as the source and sink of WFD based on the wireless local area network is as follows:
[0041] A starts the screen projection function. Then, according to the RFC 6335 specification, it joins the multicast group and publishes the displaysrc._tcp service through the mDNS protocol, and announces its support for the source function of Miracast to the local area network. - displaysrc._tcp is a service type based on the mDNS protocol specification published in the local area network. This service type specifically refers to the service of providing desktop image source data based on the Miracast specification developed by the Wifi Alliance, which is published by the device providing source image data.
[0042] B opens the projection receiving function. Then, through the mDNS protocol, according to the specification of RFC 6335, it joins the multicast group, publishes the display._tcp service, and announces itself to support the sink function of Miracast in the local area network. The display._tcp service is a service type published in the local area network based on the mDNS protocol specification. This service type is specifically for receiving desktop image source data provided by the displaysrc._tcp service published device and displaying it based on the Miracast specification developed by the Wifi Alliance. The device that displays the image source data publishes it.
[0043] Miracast is a wireless display protocol developed by the Wifi Alliance, which runs a device (source device, source end) to display its desktop content on another device (target device, sink end).
[0044] A starts a front-end interface process to discover and analyze the service. As long as the user does not exit the interface, the process will search for sink devices supporting the display._tcp service in the local area network according to the specification of RFC 6335. This discovery process is achieved by sending an mDNS query request.
[0045] mDNS is a standard network protocol described in the specification of RFC 6335, mainly used for device discovery within the local area network. Query is a request to actively query a service.
[0046] B receives the mDNS query request sent by A for the display._tcp service, and replies to A with a response frame containing its hostname.
[0047] A parses the hostname from the received response frame and presents a list of sink devices on the front-end interface for the user to select the sink object for projection.
[0048] At this point, device discovery is complete, no longer relying on P2P, but on the existing WLAN network. Simplification of the connection process:
[0049] P2P connection establishment, need to go through P2P Group negotiation first to establish including Group master-slave role, transmission channel etc. Rules, then two devices through the process of Formation complete the establishment of P2P link. Formation process contains certificate generation, key exchange process, process is relatively long, the longest can reach 10s, and sometimes negotiation failure. But using the scheme based on WLAN, the device between the completion of discovery, start connection is simple. Still take the scene of A, B two devices.
[0050] Figure 4 The device connection process implementation flow chart of the wireless projection connection quick establishment method of the PC device of the application is shown as Figure 4 As shown in the figure, two computers A and B are respectively as the source and sink end of WFD, and the user makes the selection of connecting B on A:
[0051] A organizes mDNS query message according to the host name device selected by the user, multicasts, inquires the specific information of the host name.
[0052] B receives the mDNS query message associated with its own host name, informs the ip, port number and other information, and implements listening to the TCP port, waits for the access of the source device.
[0053] A directly establishes TCP connection with the IP and port number informed by B, succeeds, first listens to its own RTSP service port, then sends its own source name, RTSP port number and session start command to B.
[0054] It can be seen that the connection process is simple, and the IP and port are directly obtained through mDNS to establish connection.
[0055] Next, the process of starting multimedia session establishment is started-B receives the session start command, connects the RTSP port of A, carries out RTSP negotiation, establishes multimedia session, and starts projection playing.
[0056] In summary, the Miracast R2 specification is landed on the domestic Linux operating system, and is integrated into the system. When both ends of the device use Kirin operating system, as long as they are connected to the same WiFi LAN, the source end device can quickly find the sink device, improve the speed of device discovery and connection establishment when projecting, and improve the stability of connection. After 500 tests, all are completed within 5s, and the connection success rate is 99%.
[0057] Although the present application has been described with reference to the preferred embodiments thereof, it is to be understood that the application is not limited to the details described herein and that various modifications and changes can be made without departing from the spirit and scope of the present application. It is therefore desired that what is claimed be what the application is intended to cover.
Claims
1. A method for quickly establishing a wireless projection connection of a PC device, characterized in that, The application is realized based on two PC devices in the same wireless local area network, wherein the two PC devices are respectively as source and sink, and the device discovery is completed through the following steps: Step S1: the source starts the screen projection function, joins the multicast group through the mDNS protocol, publishes the displaysrc_tcp service, and announces to the local area network that it supports the source function of Miracast; Step S2: the sink starts the projection receiving function, joins the multicast group through the mDNS protocol, publishes the display_tcp service, and announces to the local area network that it supports the sink function of Miracast; Step S3: the source starts the front-end interface process, discovers and analyzes the service, and searches the sink device supporting the display_tcp service in the local area network; Step S4: the sink receives the mDNS query request of the source for the display_tcp service, and replies to the source with the response frame containing the host name of the sink; Step S5: the source analyzes the host name according to the received response frame, presents the sink device list on the front-end interface, and provides the user with the sink object for selection.
2. The method of claim 1, wherein the PC device wireless projection connection quick establishment method is characterized in that, In step S3, the front-end interface process discovers and analyzes the sink device supporting the display_tcp service in the local area network through the mDNS query request.
3. The method of claim 1, wherein the PC device wireless projection connection quick establishment method is characterized in that, The source realizes the connection with the sink through the following method: Step S6: the source organizes the mDNS query message according to the host name device selected by the user, multicasts it, and queries the specific information of the host name; Step S7: the sink receives the mDNS query message associated with the host name, informs the IP and port number information of the sink, and listens to the TCP port corresponding to the port number, and waits for the access of the source device; Step S8: the source directly establishes the TCP connection with the IP and port number of the sink, successfully listens to the RTSP service port of the source, and then sends the source name, RTSP service port number and session start command of the source to the corresponding sink.
Citation Information
Patent Citations
Screen data acquisition method and device
CN106970849A
Wireless screen projection method and wireless router
CN108399056A