CN114513544A - Local area network wireless screen projection method and device and computer readable storage medium - Google Patents

Local area network wireless screen projection method and device and computer readable storage medium Download PDF

Info

Publication number
CN114513544A
CN114513544A CN202111673026.9A CN202111673026A CN114513544A CN 114513544 A CN114513544 A CN 114513544A CN 202111673026 A CN202111673026 A CN 202111673026A CN 114513544 A CN114513544 A CN 114513544A
Authority
CN
China
Prior art keywords
terminal
opposite terminal
screen projection
address
area network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111673026.9A
Other languages
Chinese (zh)
Other versions
CN114513544B (en
Inventor
张世明
吴柏鸿
杜成亮
朱浩华
吕周谨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Emeet Technology Co ltd
Original Assignee
Shenzhen Emeet Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Emeet Technology Co ltd filed Critical Shenzhen Emeet Technology Co ltd
Priority to CN202111673026.9A priority Critical patent/CN114513544B/en
Publication of CN114513544A publication Critical patent/CN114513544A/en
Application granted granted Critical
Publication of CN114513544B publication Critical patent/CN114513544B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/1454Digital output to display device ; Cooperation and interconnection of the display device with other functional units involving copying of the display data of a local workstation or window to a remote workstation or window so that an actual copy of the data is displayed simultaneously on two or more displays, e.g. teledisplay
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a local area network wireless screen projection method, equipment and a computer readable storage medium, wherein the method comprises the following steps: after a screen projection instruction is detected, generating a screen projection code according to the home terminal IP address; responding to a communication connection request sent by an opposite terminal, and establishing communication connection between the local terminal and the opposite terminal; receiving a verification code sent by an opposite terminal based on the communication connection, and checking whether the verification code is valid or not according to the screen projection code; after the verification code is verified to be valid, a data transmission channel between the home terminal and the opposite terminal is established; and transmitting the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel. The invention realizes the universality of the wireless projection screen on different types of equipment.

Description

Local area network wireless screen projection method and device and computer readable storage medium
Technical Field
The invention relates to the field of wireless screen projection, in particular to a local area network wireless screen projection method, local area network wireless screen projection equipment and a computer readable storage medium.
Background
In scenes such as classroom teaching, conference demonstration, lecture demonstration and the like, a wireless screen projection technology is often used to project the screen content of a transmitting end to a receiving end so as to enhance the vividness of teaching or demonstration. With the wider user coverage, the requirements on various aspects of wireless screen projection technology are also higher and higher.
The wireless screen projection can be realized by means of a screen projection protocol, and common screen projection protocols include DLNA (digital Living Network alliance), Miracast and AirPlay. DLNA has stopped updating and is out of date to fully accommodate the rapidly evolving user needs. And Miracast does not support iPhone, Mac and other devices, and Airplay does not support android, Windows and other devices.
Disclosure of Invention
The invention mainly aims to provide a local area network wireless screen projection method, and aims to solve the problem of universality of wireless screen projection on different types of equipment.
In order to achieve the above object, the present invention provides a wireless screen projection method for a local area network, which comprises:
after a screen projection instruction is detected, generating a screen projection code according to the home terminal IP address;
responding to a communication connection request sent by an opposite terminal, and establishing communication connection between the local terminal and the opposite terminal;
receiving a verification code sent by an opposite terminal based on the communication connection, and checking whether the verification code is valid or not according to the screen projection code;
after the verification code is verified to be valid, a data transmission channel between the home terminal and the opposite terminal is established;
and transmitting the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel.
Optionally, after the screen projection instruction is detected, the step of generating the screen projection code according to the home terminal IP address includes:
after a screen projection instruction is detected, acquiring a home terminal IP address and a corresponding subnet mask under a current local area network;
and operation is carried out on the home terminal IP address and the subnet mask to obtain the network number of the home terminal IP address under the current local area network;
obtaining the maximum number of IP addresses which can exist in the current local area network according to the subnet mask;
and generating a screen projection code by using the home terminal IP address, the network number and the number of the IP addresses according to a preset rule.
Optionally, the step of establishing a communication connection with the peer end in response to the communication connection request sent by the peer end includes:
monitoring the connection state of a local communication port;
after a communication connection request sent by an opposite terminal is detected, responding to the communication connection request, and establishing communication connection between the local terminal and the opposite terminal, wherein the number of the opposite terminals is at least one.
Optionally, after the verification that the verification code is valid is verified, the step of establishing a data transmission channel between the home terminal and the opposite terminal includes:
after the verification code is verified to be valid, sending a to-be-selected coding and decoding format supported by the local terminal to the opposite terminal in an Offer signaling mode based on the communication connection;
receiving Answer signaling returned by an opposite terminal, and determining a target coding and decoding format used in the data transmission channel;
receiving an opposite terminal candidate sent by an opposite terminal through the communication connection, and establishing a data transmission channel;
and if the data transmission channel is failed to be established, receiving the other opposite terminal candidate, and establishing the data transmission channel by using the new opposite terminal candidate until the data transmission channel is established successfully.
Optionally, the step of transmitting the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel includes:
acquiring video stream data to be screen-projected at a local terminal, coding the video stream data by using the target coding and decoding format, and converting the video stream data transmission format;
and transmitting the coded video stream data to an opposite terminal through the data transmission channel.
Optionally, after the step of transmitting the local video stream data to the peer based on the data transmission channel, the method further includes:
and if the interruption of the video stream data transmission process is detected, feeding back screen projection failure prompt information.
In addition, in order to achieve the above object, the present invention further provides a local area network wireless screen projection method, including:
after detecting that the verification code is input, resolving an IP address of an opposite terminal according to the verification code;
according to the IP address of the opposite terminal, sending a communication connection request to the opposite terminal, and establishing communication connection between the local terminal and the opposite terminal;
based on the communication connection, sending a verification code to the opposite terminal so that the opposite terminal can verify whether the verification code is valid based on a preset screen projection instruction;
sending local terminal candidate to the opposite terminal, and establishing a data transmission channel between the local terminal and the opposite terminal;
and receiving video stream data to be screen-projected sent by the opposite terminal based on the data transmission channel, and displaying a screen-projected picture.
Optionally, after detecting that the verification code is input completely, the step of analyzing the IP address of the opposite end according to the verification code includes:
after the verification code is input, acquiring a home terminal IP address and a corresponding subnet mask under the current local area network;
and operation is carried out on the home terminal IP address and the subnet mask to obtain the network number of the home terminal IP address under the current local area network;
obtaining the maximum number of IP addresses which can exist in the current local area network according to the subnet mask;
and acquiring the verification code, and analyzing the IP address of the opposite terminal by using the verification code, the network number and the number of the IP addresses according to a preset rule.
In addition, to achieve the above object, the present invention further provides a local area network wireless screen projection device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the local area network wireless screen projection method as described above.
Furthermore, to achieve the above object, the present invention further provides a computer-readable storage medium, having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of the wireless screen projection method for local area network as described above.
According to the method and the device, after a screen projection instruction is detected, a screen projection code is generated according to the IP address of the local terminal, communication connection is established with the opposite terminal, a verification code sent by the opposite terminal is received, whether the verification code is valid is verified, the IP address of the opposite terminal is received after the verification code is verified to be valid, a data transmission channel is established with the opposite terminal, video stream data to be projected by the local terminal is transmitted to the opposite terminal based on the data transmission channel, and the purpose of wireless screen projection on different types of equipment is achieved.
Drawings
Fig. 1 is a schematic structural diagram of a local area network wireless screen projection device in a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a wireless screen projection method for a local area network according to a first embodiment of the present invention;
FIG. 3 is a detailed flowchart of step S110 in FIG. 2;
FIG. 4 is a detailed flowchart of step S120 in FIG. 2;
FIG. 5 is a diagram of a TCP server connected to multiple TCP clients;
FIG. 6 is a detailed flowchart of step S140 in FIG. 2;
FIG. 7 is a detailed flowchart of step S150 in FIG. 2;
FIG. 8 is a flowchart illustrating a wireless screen projection method for a local area network according to another embodiment of the present invention;
FIG. 9 is a detailed flowchart of step S210 in FIG. 8;
fig. 10 is a schematic diagram of bidirectional screen projection of the local area network wireless screen projection device according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main technical scheme of the invention is as follows: after a screen projection instruction is detected, generating a screen projection code according to the home terminal IP address; responding to a communication connection request sent by an opposite terminal, and establishing communication connection between the local terminal and the opposite terminal; receiving a verification code sent by an opposite terminal based on the communication connection, and checking whether the verification code is valid or not according to the screen projection code; after the verification code is verified to be valid, a data transmission channel between the home terminal and the opposite terminal is established; and transmitting the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel. The invention realizes the universality of the wireless projection screen among different types of equipment.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a local area network wireless screen projection device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the local area network wireless screen projection device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of a local area network wireless projection device and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of storage medium, may include therein an operating system, a data storage module, a network communication module, a user interface module, and a computer program.
In the local area network wireless screen projection device shown in fig. 1, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 of the local area network wireless screen projection device of the present invention may be disposed in the local area network wireless screen projection device, and the local area network wireless screen projection device calls the computer program stored in the memory 1005 through the processor 1001 and executes the local area network wireless screen projection method provided by the embodiment of the present invention.
An embodiment of the present invention provides a local area network wireless screen projection method, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of a local area network wireless screen projection method according to the present invention.
In this embodiment, the local area network wireless screen projection method includes:
step S110, after detecting a screen projection instruction, generating a screen projection code according to a home terminal IP address;
when a user has a screen projection requirement, the local terminal equipment can be operated, and the local terminal equipment generates a screen projection code based on a screen projection instruction generated by the user operation. The screen-projecting code can be used for identifying an IP (Internet Protocol) address between the home terminal and the opposite terminal, so that a corresponding relation exists between the screen-projecting code and the home terminal IP address. The subnet mask and the network number derived from the home terminal IP address and the maximum number of IP addresses which can exist in the local area network where the home terminal IP address is located can be used for generating the screen projection code.
The subnet mask may be used to indicate which bits in the IP address identify the subnet in which the host is located and which bits identify the bit mask of the host that needs to be used in conjunction with the IP address. After the IP address is divided into subnets, the IP address can be divided into a network number, a subnet number and a subnet host number.
After the home terminal IP address under the current local area network is obtained, the subnet mask of the home terminal IP address can be synchronously obtained. The general IP address and subnet mask are represented using a dotted decimal notation such as IP address 192.168.116.98, subnet mask 255.255.254.0. Considering the IP address and subnet mask as a 4 byte length number, the above listed IP address and subnet mask can be represented in hexadecimal as: IP address 0xC0a87462 and subnet mask 0xFFFFFE 00.
Step S120, responding to a communication connection request sent by an opposite terminal, and establishing communication connection between the local terminal and the opposite terminal;
and after the opposite terminal obtains the local terminal IP address according to the screen projection code, the opposite terminal can send a communication connection request to the local terminal according to the local terminal IP address, and after the local terminal responds to the communication connection request, the communication connection between the local terminal and the opposite terminal is established.
Step S130, receiving a verification code sent by an opposite terminal based on the communication connection, and checking whether the verification code is valid according to the screen projection code;
the screen-projecting codes of different IP addresses are different, the same IP address can correspond to a plurality of screen-projecting codes, and the screen-projecting codes have the characteristic of dynamic. And after receiving a verification code sent by the opposite terminal, if the verification code is not matched with the screen projection code, verifying that the verification code is invalid. In the verification process, the condition that the overdue verification code is received due to the fact that the screen-projecting code is not updated timely can also occur, and the overdue verification code can also be verified to be invalid. And after the verification that the verification code is invalid, the communication connection is disconnected.
And if the verification code is verified to be invalid, the communication connection is disconnected, and wireless screen projection cannot be carried out.
Step S140, after the verification code is verified to be valid, a data transmission channel between the home terminal and the opposite terminal is established;
after the verification code is verified to be valid, the communication connection which is established previously is maintained, the target coding and decoding format of the video stream data is determined through the communication connection, and the video stream data is compressed to remove the redundancy in time and space, so that the storage and the transmission are convenient. And then receiving the peer candidate of the peer to obtain the peer IP address, so as to establish the data transmission channel between the local peer and the peer. The opposite terminal IP address of the opposite terminal is usually more than one, but not all the opposite terminal IP addresses can successfully establish a data transmission channel between the local terminal and the opposite terminal. If the attempt to establish the data transmission channel using the peer IP address received through the peer candidate fails, another peer candidate is continuously received until the data transmission channel is successfully established.
And S150, transmitting the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel.
And after the data transmission channel is successfully established, encoding the video stream data to be subjected to screen projection at the local terminal by using the target encoding and decoding format, and transmitting the encoded video stream data to the opposite terminal to finish wireless screen projection.
In this embodiment, a screen projection code is generated according to the IP address of the home terminal, a communication connection between the home terminal and the opposite terminal is established, a verification code sent by the opposite terminal is received, after the verification that the verification code is valid is verified, the opposite terminal candidate is received, a data transmission channel between the home terminal and the opposite terminal is established, video stream data to be projected by the home terminal is transmitted to the opposite terminal, and the universality of wireless screen projection among different types of devices is enhanced.
Further, in another embodiment of the local area network wireless screen projection method according to the present invention, referring to fig. 3, after detecting the screen projection instruction in step S110, generating the screen projection code according to the home terminal IP address includes:
step S111, after detecting a screen projection instruction, acquiring a home terminal IP address and a corresponding subnet mask under a current local area network;
after a screen projection instruction is detected, firstly, a home terminal IP address under a current local area network and a subnet mask corresponding to the home terminal IP address need to be acquired. The general IP address and subnet mask are represented using a dotted decimal notation such as IP address 192.168.116.98, subnet mask 255.255.254.0. Considering the IP address and subnet mask as a 4 byte length number, the above listed IP address and subnet mask can be represented in hexadecimal as: IP address 0xC0a87462 and subnet mask 0xFFFFFE 00.
Step S112, the local terminal IP address and the subnet mask are subjected to AND operation to obtain the network number of the local terminal IP address under the current local area network;
after the IP address is divided into the sub-networks, the IP address is divided into a network number, a sub-network number and a sub-network host number. The devices in the same LAN have different IP addresses and the same network number.
The IP address represented by the hexadecimal number and the subnet mask are anded to obtain the network number of the local IP address under the current lan, that is, 192.168.116.98(0xC0a87462) &255.255.254.0(0 xffffe 00) ═ 192.168.116.0(0xC0a 87400).
Step S113, obtaining the maximum number of IP addresses available in the current local area network according to the subnet mask;
and the number of the IP addresses which can exist at most under the current local area network can be obtained by inverting the number which represents the subnet mask according to bits and then adding 1. For example, if not (0 xffffe 00) is 511, and 511+1 is 512, the maximum number of IP addresses that can exist in the current lan is 512. Further, the current range of IP addresses in a LAN is 192.168.116.0-192.168.117.255.
And step S114, generating screen projection codes by using the home terminal IP address, the network number and the number of the IP addresses according to preset rules.
Taking the example of using 6-bit capital letters as the screen-projecting codes, each screen-projecting code can be regarded as a twenty-six system number with a length of 6 bits. The preset rules may be: IP address-network number + (random number × number of IP addresses) ═ screen cast code.
For example, the IP address 192.168.116.98 has a network number of 192.168.116.0, the number of IP addresses is 512, and when the random number is 1, 192.168.116.98-192.168.116.0+ (1 × 512) ═ 610, 610 is converted into 26-ary, and the screen projection code AAAAXM is obtained.
In this embodiment, according to a preset rule, the home terminal IP address, the network number, and the maximum number of IP addresses that can exist in the current local area network are used to perform calculation, so as to generate a screen-projecting code, where the screen-projecting code has a dynamic characteristic that a same IP address can correspond to multiple screen-projecting codes, and screen-projecting codes generated according to different IP addresses are not repeated.
Further, in another embodiment of the local area network wireless screen projection method of the present invention, referring to fig. 4, the step S120 of responding to the communication connection request sent by the peer end, and establishing a communication connection with the peer end includes:
step S121, monitoring the connection state of a local communication port;
the communication connection can be established by using a Transmission Control Protocol (TCP), and two ends of the TCP connection are a TCP server and a TCP client. The home terminal can be regarded as a TCP server terminal. Establishing communication connection, firstly, initializing a socket by a TCP server, then binding the socket with a communication port, monitoring the communication port, and waiting for connection of a TCP client.
Step S122, after detecting a communication connection request sent by an opposite terminal, responding to the communication connection request, and establishing communication connection between the local terminal and the opposite terminal, wherein the number of the opposite terminals is at least one.
Accordingly, the peer may be considered a TCP client. When the local terminal communication port is in a monitoring state, if a TCP connection request sent by the opposite terminal is detected, the TCP connection request is responded, and the TCP connection between the local terminal and the opposite terminal is established.
If TCP connection requests sent by a plurality of peer terminals are detected, the home terminal may establish a new thread on the basis of the established TCP connection, and process another TCP connection request, as shown in fig. 5, to implement that one TCP server connects a plurality of TCP clients.
In this embodiment, a communication connection with at least one peer is established in response to a communication connection request sent by the peers, and the video stream data of the local peer can be projected to a plurality of peers.
Further, in another embodiment of the local area network wireless screen projection method according to the present invention, referring to fig. 6, after verifying that the verification code is valid, step S140 receives an opposite terminal IP address of the opposite terminal, and establishing a data transmission channel between the local terminal and the opposite terminal based on the opposite terminal IP address includes:
step S141, after the verification code is verified to be valid, based on the communication connection, sending the format to be selected, coded and decoded, which is supported by the local terminal, to the opposite terminal in the form of Offer signaling;
WebRTC (Web Real-Time Communication, Web page Real-Time Communication) is composed of a set of standards, protocols, and JavaScript API (Application Programming Interface), and can be used to implement audio, video, and data sharing between browsers (end-to-end).
When transmitting video stream data, some codec formats are usually used to compress the video stream data to remove temporal and spatial redundancies for storage and transmission. Common codec formats include: MPEG (Moving Picture Experts Group) series MPEG-1, MPEG-2, MPEG-4, MPEG-7, MPEG-21, H.26X series H.261, H.263, H.264, H.265/HEVC, etc.
And after the verification code is verified to be valid, the established communication connection is maintained. The local terminal can perform WebRTC negotiation with the opposite terminal and send an Offer signaling to the opposite terminal, wherein the Offer signaling comprises a format to be selected, coded and decoded, which is supported by the local terminal.
Step S142, receiving Answer signaling returned from the opposite terminal, and determining a target coding and decoding format used in the data transmission channel;
and after the opposite terminal generates the Answer signaling, receiving the Answer signaling returned by the opposite terminal, wherein the Answer signaling comprises the screened format of the coding and decoding to be selected. And the opposite terminal screens the to-be-selected coding and decoding formats according to the coding and decoding formats supported by the opposite terminal, so as to obtain the screened to-be-selected coding and decoding formats.
The format of the selected codec may be various, and the format of the selected codec may also be various. When the video stream data to be projected is actually transmitted, the local terminal selects one of the screened coding and decoding formats to be selected as a target coding and decoding format.
Step S143, receiving the opposite terminal IP address of the opposite terminal as the actual IP address through the communication connection, and establishing a data transmission channel;
after negotiating a target coding and decoding format by Offer and Answer, sending local terminal candidate to the opposite terminal, and receiving opposite terminal candidate sent by the opposite terminal, wherein the opposite terminal candidate comprises an opposite terminal IP address. And taking the IP address of the opposite end as an actually used IP address, and trying To establish a P2P (Point To Point) connection by using the actually used IP address To be used as the data transmission channel.
Step S144, if the data transmission channel is failed to be established, receiving another peer candidate, and establishing a data transmission channel using the new peer candidate until the data transmission channel is successfully established.
The peer IP address of the peer is typically more than one, and not all peer IP addresses may be used to establish the P2P connection. The home terminal and the opposite terminal need to be under the same local area network, so that the wide area network IP address of the opposite terminal does not need to be received, thereby reducing the sending times of the candidate and the times of trying to carry out P2P connection.
If the data transmission channel is failed to be established, it indicates that the peer IP address received through the candidate address is unavailable, and needs to receive another peer candidate address to obtain a new peer IP address, and tries to establish the P2P connection again. When the P2P connection is successfully established, or all peer IP addresses have been received by the peer candidate, the process of establishing the transmission channel is finished.
In this embodiment, a data transmission channel between the home terminal and the peer terminal is established through WebRTC negotiation, and sending of candidate of a non-local area network IP address is removed, so that the number of times of trying to perform P2P connection is reduced, network resources are saved, and efficiency of establishing the data transmission channel is improved.
Further, in another embodiment of the local area network wireless screen projection method according to the present invention, referring to fig. 7, after step S150 transmits the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel and step S150, the method further includes:
step S151, acquiring video stream data to be screen-projected at a local terminal, coding the video stream data by using the target coding and decoding format, and converting the video stream data transmission format;
before the wireless screen projection process starts, video stream data to be projected on a screen at a local terminal needs to be acquired. According to the actual scene needs of wireless screen projection, the WebRTC can be configured not to transmit audio, and resources used in screen projection are reduced. And coding video stream data to be subjected to screen projection by using the target coding and decoding format, and converting the transmission format of the video stream data to obtain the video stream data which is ready for wireless screen projection at the local terminal.
Step S152, transmitting the coded video stream data to an opposite terminal through the data transmission channel;
the transmission channel may be a P2P connection established through WebRTC. The local terminal encodes the video stream data to be projected, starts to transmit, and transmits the encoded video stream data to the opposite terminal through the P2P connection.
Step S153, if the interruption of the video stream data transmission process is detected, feeding back screen projection failure prompt information.
The video stream data transmission process may be interrupted for various reasons, such as disconnection of the current lan network, exceeding of the coverage of the current lan by the local terminal or the opposite terminal, switching of the current lan by the local terminal or the opposite terminal, and the like. And after the transmission process is interrupted, screen projection failure prompt information can be fed back according to the interruption reason so that the user can select to continue screen projection or quit screen projection.
In this embodiment, through the P2P connection, the video stream data to be screen-projected at the local terminal is encoded and transmitted to the opposite terminal, so that the transmission efficiency of the video stream data is improved, and the WebRTC is configured not to transmit audio, thereby reducing the resources used during screen projection.
The invention also provides a local area network wireless screen projection method, and referring to fig. 8, fig. 8 is a schematic flow chart of another embodiment of the local area network wireless screen projection method of the invention.
In this embodiment, the local area network wireless screen projection method includes:
step S210, after detecting that the verification code is input, resolving an opposite terminal IP address according to the verification code;
parsing the captcha may be considered a reverse process of generating the screen-projected code. The verification code can be used for identifying the IP address of the opposite terminal, so that the corresponding relation exists between the verification code and the IP address of the opposite terminal. Because the embodiment of the invention needs to be realized under the condition that the local terminal and the opposite terminal are in the same local area network, the related information of the current local area network, which can be obtained by the local terminal, can be used for analyzing the verification code.
The current local area network related information comprises: subnet mask, network number and the maximum number of IP addresses that can exist of the home IP address. The subnet mask may be used to indicate which bits in the IP address identify the subnet in which the host is located and which bits identify the bit mask of the host that needs to be used in conjunction with the IP address.
Step S220, according to the IP address of the opposite terminal, a communication connection request is sent to the opposite terminal, and communication connection between the local terminal and the opposite terminal is established;
after the IP address of the opposite terminal is obtained through analysis, the IP address of the opposite terminal can be used for sending a communication connection request to the opposite terminal, and after the opposite terminal responds to the communication connection request, communication connection between the local terminal and the opposite terminal is established.
Step S230, based on the communication connection, sending a verification code to the opposite terminal so that the opposite terminal can verify whether the verification code is valid based on a preset screen projection instruction;
the verification codes of different IP addresses are different, and the same IP address can correspond to a plurality of verification codes. And after the verification code is sent to the opposite terminal, the opposite terminal checks the verification code. And if the verification code is verified to be valid, the communication connection is kept for subsequent communication. If the verification code is verified to be invalid, the communication connection is disconnected, and the valid verification code needs to be input again to ensure the stability of the communication connection.
Step S240, sending local terminal candidate to the opposite terminal, and establishing a data transmission channel between the local terminal and the opposite terminal;
and after the opposite terminal verifies that the verification code is valid, the communication connection is maintained, and the local terminal candidate can be sent to the opposite terminal through the communication connection so as to provide the local terminal IP address for the opposite terminal. Often more than one home IP address can be used to successfully establish the data transmission channel, rather than all home IP addresses. If the local terminal IP address sent by the local terminal candidate fails to attempt to establish the data transmission channel, another local terminal candidate is continuously sent until the data transmission channel is successfully established.
And step S250, receiving video stream data to be screen-projected sent by the opposite terminal based on the data transmission channel, and displaying a screen projection picture.
After the data transmission channel is successfully established, the target coding and decoding format of the video stream data needs to be determined, and the video stream data is compressed to remove the time and space redundancies, so that the storage and the transmission are convenient. And after a target coding and decoding format is negotiated by using the WebRTC and the opposite terminal through the communication connection, decoding the received video stream data by using the target coding and decoding format, displaying a decoded screen projection picture, and completing the wireless screen projection.
In this embodiment, an IP address of the opposite terminal is analyzed according to the verification code, a communication connection request is sent to the opposite terminal, a communication connection between the home terminal and the opposite terminal is established, the verification code is sent to the opposite terminal, and the home terminal candidate is sent, a data transmission channel between the home terminal and the opposite terminal is established, video stream data of a screen to be projected sent by the opposite terminal is received, a screen projection picture is displayed, and the universality of the wireless screen projection among different types of equipment is enhanced.
Further, in another embodiment of the local area network wireless screen projection method according to the present invention, referring to fig. 9, after detecting that the verification code is input, analyzing the IP address of the opposite end according to the verification code in step S210 includes:
step S211, after the input of the verification code is finished, acquiring the home terminal IP address and the corresponding subnet mask under the current local area network;
after the verification code is input, the home terminal IP address under the current local area network and the subnet mask corresponding to the home terminal IP address are acquired. The general IP address and subnet mask are represented using a dotted decimal notation such as IP address 192.168.116.48, subnet mask 255.255.254.0. Considering the IP address and subnet mask as a 4 byte length number, the above listed IP address and subnet mask can be represented in hexadecimal as: IP address 0xC0a87430 and subnet mask 0xFFFFFE 00.
Step S212, the local terminal IP address and the subnet mask are subjected to AND operation to obtain the network number of the local terminal IP address under the current local area network;
the home terminal and the opposite terminal are in the same local area network, the IP addresses of the home terminal and the opposite terminal are different, and the network numbers are the same.
The above IP address represented by hexadecimal and subnet mask are and-operated to obtain the network number of the local IP address under the current lan, that is, 192.168.116.48(0xC0a87430) &255.255.254.0(0 xffffe 00) ═ 192.168.116.0(0xC0a 87400).
Step S213, obtaining the maximum number of IP addresses available in the current local area network according to the subnet mask;
and the number of the IP addresses which can exist at most under the current local area network can be obtained by inverting the number which represents the subnet mask according to bits and then adding 1. For example, if not (0 xffffe 00) is 511, and 511+1 is 512, the maximum number of IP addresses that can exist in the current lan is 512. Further, the current range of IP addresses in a LAN is 192.168.116.0-192.168.117.255.
Step S214, obtaining the verification code, and resolving the IP address of the opposite terminal by using the verification code, the network number and the number of the IP addresses according to a preset rule.
Taking 6-bit capital letters as screen-projecting codes as an example, each screen-projecting code can be regarded as a twenty-six system number with a length of 6 bits, and the expression rule of the verification code should be the same as that of the screen-projecting codes. Then, the number represented by the verification code is converted into a decimal number, the decimal number is divided by the number of the IP addresses, the remainder is obtained, namely the remainder can represent the serial number of the IP address of the opposite terminal in the IP address range of the current local area network, and the IP address of the opposite terminal can be obtained according to the serial number.
For example, the verification code AAABRE converts the twenty-six system number AAABRE into a decimal number 1122, the number of the IP addresses in the current local area network is 512, the network number of the local IP address is 192.168.116.0, 1122 is divided by 512, the remainder 98 is obtained, 98+192.168.116.0 is 192.168.116.98, and the IP address of the opposite terminal is 192.168.116.98 through analysis.
In this embodiment, according to a preset rule, the home terminal IP address, the network number, and the maximum number of IP addresses that can exist in the current local area network are used for calculation, so as to analyze the IP address of the opposite terminal, thereby achieving the purpose of completing the identification of the opposite terminal without a signaling server in the wireless screen projection process.
Further, referring to fig. 10, fig. 10 is a schematic diagram of bidirectional screen projection of a local area network wireless screen projection device according to the present invention, where the local area network wireless screen projection device includes:
the system comprises a screen-projecting code generating module, a screen-projecting code analyzing module, a TCP server module, a TCP client module and a WebRTC module.
The screen projection code generating module is used for generating a screen projection code according to the home terminal IP address;
the screen projecting code analysis module is used for analyzing an IP address of an opposite terminal;
the TCP server module is used for responding to a communication connection request sent by an opposite terminal;
the TCP client module is used for sending a communication connection request to an opposite terminal;
the WebRTC module is used for establishing a data transmission channel between the home terminal and the opposite terminal.
In this embodiment, the two devices participating in the wireless screen projection can implement bidirectional screen projection based on the screen projection code generation module, the screen projection code analysis module, the TCP server module, the TCP client module, and the WebRTC module.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A local area network wireless screen projection method is characterized by comprising the following steps:
after a screen projection instruction is detected, generating a screen projection code according to the home terminal IP address;
responding to a communication connection request sent by an opposite terminal, and establishing communication connection between the local terminal and the opposite terminal;
receiving a verification code sent by an opposite terminal based on the communication connection, and checking whether the verification code is valid or not according to the screen projection code;
after the verification code is verified to be valid, a data transmission channel between the home terminal and the opposite terminal is established;
and transmitting the video stream data to be projected on the screen of the local terminal to the opposite terminal based on the data transmission channel.
2. The local area network wireless screen projection method of claim 1, wherein the step of generating the screen projection code according to the home terminal IP address after detecting the screen projection instruction comprises:
after a screen projection instruction is detected, acquiring a home terminal IP address and a corresponding subnet mask under a current local area network;
and operation is carried out on the home terminal IP address and the subnet mask to obtain the network number of the home terminal IP address under the current local area network;
obtaining the maximum number of IP addresses which can exist in the current local area network according to the subnet mask;
and generating screen projection codes by using the home terminal IP address, the network number and the number of the IP addresses according to preset rules.
3. The wireless screen projection method of the local area network as claimed in claim 1, wherein the step of establishing the communication connection between the local terminal and the opposite terminal in response to the communication connection request sent by the opposite terminal comprises:
monitoring the connection state of a local communication port;
after a communication connection request sent by an opposite terminal is detected, responding to the communication connection request, and establishing communication connection between the local terminal and the opposite terminal, wherein the number of the opposite terminals is at least one.
4. The local area network wireless screen projection method of claim 1, wherein the step of establishing a data transmission channel between the local terminal and the opposite terminal after verifying that the verification code is valid comprises:
after the verification code is verified to be valid, sending a to-be-selected coding and decoding format supported by the local terminal to the opposite terminal in an Offer signaling form based on the communication connection;
receiving Answer signaling returned by an opposite terminal, and determining a target coding and decoding format used in the data transmission channel;
receiving an opposite terminal candidate sent by an opposite terminal through the communication connection, and establishing a data transmission channel;
and if the data transmission channel is failed to be established, receiving another new opposite terminal candidate, and establishing the data transmission channel by using the new opposite terminal candidate until the data transmission channel is established successfully.
5. The local area network wireless screen projection method of claim 4, wherein the step of transmitting the video stream data to be projected on the screen at the local terminal to the opposite terminal based on the data transmission channel comprises:
acquiring video stream data to be screen-projected at a local terminal, coding the video stream data by using the target coding and decoding format, and converting the video stream data transmission format;
and transmitting the coded video stream data to an opposite terminal through the data transmission channel.
6. The local area network wireless screen projection method according to any one of claims 1-5, wherein after the step of transmitting the local video stream data to the opposite terminal based on the data transmission channel, further comprising:
and if the interruption of the video stream data transmission process is detected, feeding back screen projection failure prompt information.
7. A local area network wireless screen projection method is characterized by comprising the following steps:
after detecting that the verification code is input, resolving an IP address of an opposite terminal according to the verification code;
according to the address of the opposite terminal I P, sending a communication connection request to the opposite terminal, and establishing communication connection between the local terminal and the opposite terminal;
based on the communication connection, sending a verification code to the opposite terminal so that the opposite terminal can verify whether the verification code is valid based on a preset screen projection instruction;
sending local terminal candidate to the opposite terminal, and establishing a data transmission channel between the local terminal and the opposite terminal;
and receiving video stream data to be screen-projected sent by the opposite terminal based on the data transmission channel, and displaying a screen-projected picture.
8. The wireless screen projection method of the local area network as claimed in claim 7, wherein the step of analyzing the IP address of the opposite terminal according to the verification code after detecting that the verification code is input completely comprises:
after the verification code is input, acquiring a home terminal IP address and a corresponding subnet mask under the current local area network;
and operation is carried out on the home terminal IP address and the subnet mask to obtain the network number of the home terminal IP address under the current local area network;
according to the subnet mask, the number of IP addresses which can exist at most under the current local area network is obtained;
and acquiring the verification code, and analyzing the opposite end I P address by using the verification code, the network number and the IP address number according to a preset rule.
9. A local area network wireless screen projection device, the device comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the local area network wireless screen projection method according to any of claims 1 to 8.
10. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the local area network wireless screen projection method according to any one of claims 1 to 8.
CN202111673026.9A 2021-12-31 2021-12-31 Local area network wireless screen-throwing method, equipment and computer readable storage medium Active CN114513544B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111673026.9A CN114513544B (en) 2021-12-31 2021-12-31 Local area network wireless screen-throwing method, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111673026.9A CN114513544B (en) 2021-12-31 2021-12-31 Local area network wireless screen-throwing method, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN114513544A true CN114513544A (en) 2022-05-17
CN114513544B CN114513544B (en) 2023-06-13

Family

ID=81548000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111673026.9A Active CN114513544B (en) 2021-12-31 2021-12-31 Local area network wireless screen-throwing method, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114513544B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170287347A1 (en) * 2016-04-01 2017-10-05 Teh-Chau LIAU Multi-screen casting system for flipped teaching classroom
CN110996019A (en) * 2019-12-25 2020-04-10 深圳市创维群欣安防科技股份有限公司 Screen projection method and system based on wireless transmission and storage medium
CN111831247A (en) * 2020-09-15 2020-10-27 深圳乐播科技有限公司 Screen projection method, device and equipment based on two-dimensional code and storage medium
CN111930329A (en) * 2020-09-15 2020-11-13 深圳乐播科技有限公司 Screen projection method, device and equipment based on PIN code and storage medium
CN112135186A (en) * 2020-09-22 2020-12-25 深圳乐播科技有限公司 Screen projection method, device, equipment and storage medium based on small program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170287347A1 (en) * 2016-04-01 2017-10-05 Teh-Chau LIAU Multi-screen casting system for flipped teaching classroom
CN110996019A (en) * 2019-12-25 2020-04-10 深圳市创维群欣安防科技股份有限公司 Screen projection method and system based on wireless transmission and storage medium
CN111831247A (en) * 2020-09-15 2020-10-27 深圳乐播科技有限公司 Screen projection method, device and equipment based on two-dimensional code and storage medium
CN111930329A (en) * 2020-09-15 2020-11-13 深圳乐播科技有限公司 Screen projection method, device and equipment based on PIN code and storage medium
CN112135186A (en) * 2020-09-22 2020-12-25 深圳乐播科技有限公司 Screen projection method, device, equipment and storage medium based on small program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
任衡: ""基于互动课堂的屏幕直播系统延迟优化与设计实现"", 《中国优秀硕士学位论文全文数据库(电子期刊)信息科技辑》 *

Also Published As

Publication number Publication date
CN114513544B (en) 2023-06-13

Similar Documents

Publication Publication Date Title
CN112738644B (en) Video stream transmission method and device based on WebRTC
US10516666B2 (en) Authentication method, apparatus, and system
US20100011012A1 (en) Selective Compression Based on Data Type and Client Capability
CN109450948B (en) Data transmission method and device
CN111405042B (en) Electronic device discovery method and device, storage medium and electronic device
CN113766317A (en) Video transmission method, video transmission device, electronic equipment and storage medium
CN113489805B (en) Butt joint method, device, equipment and storage medium of cloud desktop system
CN105159643A (en) Two-dimensional code-based wireless screen transmission authentication method and system
CN108235111B (en) Information sharing method and intelligent set top box
KR102064284B1 (en) Device, system, and method to perform real-time communication
CN114302202A (en) Audio and video screen projection method, device, equipment, system and storage medium
CN110650097B (en) Data broadcasting method and device and computer readable storage medium
CN114138325A (en) Gray scale publishing method and device
CN111782299A (en) Game access method and device
CN109889521B (en) Memory, communication channel multiplexing implementation method, device and equipment
CN104486665A (en) Remote assistance method and device of mobile terminal
CN114513544B (en) Local area network wireless screen-throwing method, equipment and computer readable storage medium
CN109100944B (en) IMS-based data acquisition and processing system
CN115334059A (en) Audio and video intercommunication method, device, equipment and storage medium
CN113727113B (en) Video decoding method, stream pushing method and system
US11265357B2 (en) AV1 codec for real-time video communication
KR100407207B1 (en) Device for implementing group communication between cellular phone
CN108965768B (en) Method and system for transmitting multimedia data
CN114143030B (en) Verification processing method and device, electronic equipment and storage medium
CN112511811B (en) Multi-camera processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant