CN109495599A - Data transmission method and system, electronic device and computer readable storage medium - Google Patents
Data transmission method and system, electronic device and computer readable storage medium Download PDFInfo
- Publication number
- CN109495599A CN109495599A CN201811367118.2A CN201811367118A CN109495599A CN 109495599 A CN109495599 A CN 109495599A CN 201811367118 A CN201811367118 A CN 201811367118A CN 109495599 A CN109495599 A CN 109495599A
- Authority
- CN
- China
- Prior art keywords
- client
- data transmission
- sfu
- node
- transmission channel
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/09—Mapping addresses
- H04L61/25—Mapping addresses of the same type
- H04L61/2503—Translation of Internet protocol [IP] addresses
- H04L61/256—NAT traversal
- H04L61/2575—NAT traversal using address mapping retrieval, e.g. simple traversal of user datagram protocol through session traversal utilities for NAT [STUN]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a kind of data transmission methods, are applied to client, this method comprises: sending the request that burrows to STUN server, establish P2P data transmission channel with other side's client with request;If the P2P data transmission channel is successfully established, P2P audio/video communication is carried out with other side's client;If the P2P data transmission channel establishes failure, audio, video data transfer communication is carried out by SFU node and other side's client.The present invention also provides a kind of data transmission system, electronic device and computer readable storage mediums.The present invention can reduce bandwidth cost and operation cost, and can support the audio/video communication between a large number of users.
Description
Technical field
The present invention relates to technical field of data transmission more particularly to a kind of data transmission method and system, electronic device and
Computer readable storage medium.
Background technique
It is existing that VoIP (Voice over Internet Protocol, the networking telephone) audio-video is done based on P2P mode
The technical solution of communication, comprising: user a and user b by STUN (Simple Traversal of UDP over NATs,
The UDP simple traversal of NAT) server establishes P2P and burrows data transmission channel, if it succeeds, being passed by the P2P data that burrow
Do P2P audio/video communication in defeated channel;If it fails, then being done in audio, video data by relaying (relay) server on public network
Turn communication.
But this mode have the defects that it is as follows: if it is logical to support to do VoIP audio-video on line between million users
Letter, but the relay server node of public network is limited, it is likely that the transfer demand being unable to satisfy between a large number of users.Moreover,
In order to guarantee audio/video communication quality, the bandwidth running cost of the relay server of use is expensive, causes communications cost very high.
Summary of the invention
In view of this, the present invention proposes a kind of data transmission method and system, electronic device and computer-readable storage medium
Matter, to solve at least one above-mentioned technical problem.
Firstly, to achieve the above object, the present invention proposes a kind of data transmission method, it is applied to client, the method
Include:
The request that burrows is sent to STUN server, P2P data transmission channel is established with other side's client with request;
If the P2P data transmission channel is successfully established, P2P audio/video communication is carried out with other side's client;And
If the P2P data transmission channel establishes failure, pass through selective forwarding cell S FU node and other side visitor
Family end carries out audio, video data transfer communication.
Optionally, the method also includes:
It establishes and fails when the P2P data transmission channel between the client and other side's client, and can not pass through
When the SFU node carries out transfer communication, the middle revolution between other side's client is carried out by public network Relay Server
According to transmission.
Optionally, described to send the request that burrows to STUN server, the transmission of P2P data is established with request and other side's client
Channel includes:
Itself outer net IP and port are obtained by the STUN server with regard near field;
Itself outer net IP and port are sent to other side's client by Internet network;
IP and the port of other side's client are obtained by Internet network;
Test data packet is sent to the outer net IP of other side's client and port, and receives other side's client and sends
Test data packet, to establish the P2P data transmission channel.
Optionally, described to include: by SFU node and other side's client progress audio, video data transfer communication
Choose the SFU that P2P data transmission channel can be successfully established with the client and other side's client
Node;
The client transmits audio, video data to described by P2P data transmission channel between the SFU node
SFU node, with by the P2P data transmission channel between the SFU node and other side's client by the audio-video number
Other side's client is gone in;
The client receives the SFU node transfer by the P2P data transmission channel between the SFU node
The audio, video data that other side's client is sent.
Optionally, the selection can be successfully established the transmission of P2P data with the client and other side's client and lead to
The SFU node in road includes:
According to the NAT type of the client and other side's client, selection can carry out P2P with the NAT type
Multiple SFU nodes of data transmission;
One is chosen from the multiple SFU node according to preset rules, is attempted and the client and other side visitor
P2P data transmission channel is established at family end respectively, if two P2P data transmission channels can be successfully established, by the SFU node
As the transfer between the client and other side's client;
It is lost if the P2P data transmission channel between the client or other side's client and the SFU node is established
It loses, then continues to choose next SFU node, attempt to establish P2P data biography respectively with the client and other side's client
Defeated channel, until finding the SFU that can be successfully established P2P data transmission channel with the client and other side's client
Node;
P2P data transmission channel can be successfully established with the client and other side's client if it does not exist
SFU node, then the client and other side's client can not carry out transfer communication by the SFU node.
Optionally, the SFU node is the node in content distributing network.
In addition, to achieve the above object, it is described to deposit the present invention also provides a kind of electronic device, including memory, processor
The data distributing program that can be run on the processor is stored on reservoir, the data distributing program is held by the processor
Such as above-mentioned data transmission method is realized when row.
Further, to achieve the above object, the present invention also provides data transmission system, the system comprises:
STUN server;
Selective forwarding cell S FU node;
At least two clients;
Two clients send the request that burrows to the corresponding STUN server, establish P2P with other side with request
Data transmission channel;
If the P2P data transmission channel is successfully established, transmitted between two clients by the P2P data
Channel carries out P2P audio/video communication;
If the P2P data transmission channel establishes failure, carried out between two clients by the SFU node
Audio, video data transfer communication.
Optionally, it establishes and fails when the P2P data transmission channel between two clients, and can not be by described
When SFU node carries out transfer communication, two clients do interim data transmission by public network Relay Server.
Optionally, audio, video data transfer communication packet is carried out by the SFU node between described two clients
It includes:
Choose the SFU node that P2P data transmission channel can be successfully established with described two clients;
Described two clients transmit audio-video number by the P2P data transmission channel between the SFU node respectively
According to the extremely SFU node, the sound to be regarded by the P2P data transmission channel between the SFU node and other side's client
Frequency data relay is to other side's client;
Described two clients receive the SFU by the P2P data transmission channel between the SFU node respectively and save
The audio, video data that other side's client of point transfer is sent.
Optionally, the SFU node is the node in content distributing network.
Further, to achieve the above object, the present invention also provides a kind of computer readable storage medium, the computers
Readable storage medium storing program for executing is stored with data distributing program, and the data distributing program can be executed by least one processor, so that institute
It states at least one processor and executes such as above-mentioned data transmission method.
Compared to the prior art, data transmission method proposed by the invention and system, electronic device and computer-readable
Storage medium, since SFU Node distribution is in the equipment of user, bandwidth for transmission can be used freely, so compared to public affairs are passed through
Net Relay Server carries out for the scheme of relay services, and bandwidth cost and operation cost can reduce very much.In addition, online simultaneously
User it is more, the equipment that can be used as SFU node is more, therefore can support the audio/video communication between a large number of users.
Detailed description of the invention
Fig. 1 is a kind of flow diagram for data transmission method that first embodiment of the invention proposes;
Fig. 2 is the refinement flow diagram of S10 in Fig. 1;
Fig. 3 is the refinement flow diagram of S14 in Fig. 1;
Fig. 4 is a kind of flow diagram for data transmission method that second embodiment of the invention proposes;
Fig. 5 is a kind of configuration diagram for electronic device that third embodiment of the invention proposes;
Fig. 6 is a kind of configuration diagram for data transmission system that fourth embodiment of the invention proposes;
Fig. 7 is a kind of flow diagram for data transmission method that fifth embodiment of the invention proposes;
Fig. 8 is the refinement flow diagram of S30 in Fig. 7;
Fig. 9 is the refinement flow diagram of S34 in Fig. 7;
Figure 10 is a kind of flow diagram for data transmission method that sixth embodiment of the invention proposes.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not
For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot
It is interpreted as its relative importance of indication or suggestion or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the
One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment
Art scheme can be combined with each other, but must be based on can be realized by those of ordinary skill in the art, when technical solution
Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims
Protection scope within.
First embodiment
As shown in fig.1, first embodiment of the invention proposes a kind of data transmission method, it is applied to client.In this reality
It applies in example, the execution sequence of the step in flow chart shown in FIG. 1 can change according to different requirements, and certain steps can be with
It omits.This method comprises:
S10, sends the request that burrows to STUN server, establishes P2P data transmission channel with other side's client with request.
If need to carry out the transmission of P2P audio, video data between the client and other side's client, taken first by STUN
P2P data transmission channel is established in business device trial.
Referring to Fig.2, Fig. 2 show the refined flow chart of S10.In the present embodiment, above-mentioned S10 includes:
S100 obtains itself outer net IP and port (port) by the STUN server with regard near field.
S102 sends to other side's client itself outer net IP and port by Internet network.
S104 obtains the outer net IP and port of other side's client by Internet network.The outer net IP of other side's client
The STUN server acquisition with regard near field is passed through by other side's client with port.
S106 sends outer net from test data packet to other side's client IP and port, and receives the transmission of other side's client
Test data packet, to establish P2P data transmission channel.
Wherein, anti-to other side in time after the client or other side's client receive the test data packet of other side's transmission
Present ACK Echo Frame.As long as the ACK that at least one party receives other side's feedback within a preset time in the client and other side's client is returned
Answer frame, it is determined that the P2P data transmission channel is successfully established.If the client and other side's client all time-out do not receive other side
The ACK Echo Frame of feedback, it is determined that the P2P data transmission channel establishes failure.
S12 carries out P2P audio/video communication with other side's client when the P2P data transmission channel is successfully established.
If the P2P data transmission channel can establish success, directly by being somebody's turn to do between the client and other side's client
P2P data transmission channel sends audio, video data to other side.
In the present embodiment and following each embodiments, above-mentioned audio, video data can be VoIP audio, video data.
S14 passes through selective forwarding unit (Selective when the P2P data transmission channel establishes failure
Forwarding Unit, SFU) node and other side's client carry out audio, video data transfer communication.
If the P2P data transmission channel establishes failure, needed between the client and other side's client using its other party
Formula establishes transmission channel.In the present embodiment, the communication agent by SFU node is attempted, the client and other side client are carried out
Audio, video data transfer communication between end.The SFU node is the node in content distributing network.
The refined flow chart of S14 is shown refering to Fig. 3, Fig. 3.In the present embodiment, above-mentioned S14 includes:
S140 chooses the SFU node that P2P data transmission channel can be successfully established with the client and other side's client.
The SFU node requirements and the client and other side's client can be successfully established P2P data transmission channel, if
Either party burrows unsuccessfully with the SFU node, then the SFU node loses the function of transfer.When the P2P data transmission channel is established
When failure, according to the client and the NAT type of other side's client, selection can be with two NAT types (client and right
Square client may be same NAT type or NAT type not of the same race) carry out the transmission of P2P data SFU node, it is such
There may be multiple for SFU node.Then choose one of SFU node according to preset rules (such as nearby principle), attempt with
The client and other side's client establish P2P data transmission channel respectively, if two passes can be successfully established, by the SFU
Node is as the transfer between the client and other side's client.If having any one and this in the client and other side's client
P2P data transmission channel between SFU node establishes failure, then the SFU node loses the function of transfer, continues to choose next
SFU node is attempted to establish P2P data transmission channel respectively with the client and other side's client, until finding and the client
And other side's client can be successfully established the SFU node of P2P data transmission channel.It is objective with the client and other side if it does not exist
Family end can be successfully established the SFU node of P2P data transmission channel, then can not pass through between the client and other side's client
SFU node carries out transfer communication.
S142, the client are transmitted audio, video data by the P2P data transmission channel between the SFU node and are extremely somebody's turn to do
SFU node, to pass through the P2P data transmission channel between the SFU node and other side's client for the audio, video data transfer
To other side's client.
S144, the client receive the SFU node transfer by the P2P data transmission channel between the SFU node
The audio, video data that other side's client is sent.
Data transmission method provided in this embodiment, since SFU Node distribution is in the equipment of user, bandwidth for transmission can be with
It is free to use, so for compared to the scheme for carrying out relay services by public network relay server, bandwidth cost and operation at
This can be reduced very much.In addition, user online simultaneously is more, the equipment that can be used as SFU node is more, therefore can support big
Measure the audio/video communication between user.
Second embodiment
As shown in fig.4, second embodiment of the invention proposes a kind of data transmission method.In the present embodiment, according to not
With demand, the execution sequence of the step in flow chart shown in Fig. 4 can change, and certain steps can be omitted.The present embodiment
In, the S20-S24 in above-mentioned data transmission method is similar with the S10-S14 of first embodiment, and difference is that this method is also wrapped
Include S26.
S20, sends the request that burrows to STUN server, establishes P2P data transmission channel with other side's client with request.
S22 carries out P2P audio/video communication with other side's client when the P2P data transmission channel is successfully established.
S24 carries out audio-video number by SFU node and other side's client when the P2P data transmission channel establishes failure
According to transfer communication.
S26 is established when the P2P data transmission channel between the client and other side's client and is failed, and can not pass through SFU
It is (i.e. logical there is no can be successfully established the P2P data transmission that burrows with the client and other side's client that node carries out transfer communication
The SFU node in road) when, the interim data between other side's client is carried out by public network relay server and is transmitted.
If either party burrows unsuccessfully with the SFU node in the client and other side's client, which is lost
The function of transfer needs to realize between the client and other side's client by transferring in public network relay server at this time
Audio, video data transmission.
Data transmission method provided in this embodiment can not be successfully established P2P between the client and other side's client
When data transmission channel, attempt to carry out audio, video data transfer communication by the communication agent of SFU node.Due to SFU node point
In the equipment of user, bandwidth for transmission can be used freely cloth, so compared to following the service in being carried out by public network relay server
For the scheme of business, bandwidth cost and operation cost can be reduced very much.In addition, user online simultaneously is more, SFU section can be used as
The equipment of point is more, therefore can support the audio/video communication between a large number of users.When be not present and the client and other side
When client can be successfully established the SFU node of P2P data transmission channel, the client is just realized using public network relay server
Audio, video data between end and other side's client transmits, and ensures going on smoothly for data transmission.
3rd embodiment
As shown in fig.5, third embodiment of the invention proposes a kind of electronic device 10.In the present embodiment, which fills
Setting 10 can be above-mentioned client.
The electronic device 10 includes: memory 11, processor 13, network interface 15 and communication bus 17.Wherein, network connects
Mouth 15 optionally may include standard wireline interface and wireless interface (such as WI-FI interface).Communication bus 17 is for realizing these
Connection communication between component.
Memory 11 includes at least a type of readable storage medium storing program for executing.The readable storage medium storing program for executing of above-mentioned at least one type
It can be the non-volatile memory medium of such as flash memory, hard disk, multimedia card, card-type memory.In some embodiments, above-mentioned to deposit
Reservoir 11 can be the internal storage unit of electronic device 10, such as the hard disk of the electronic device 10.In further embodiments,
It is hard that above-mentioned memory 11 is also possible to the plug-in type being equipped on the external memory unit of electronic device 10, such as electronic device 10
Disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card
(Flash Card) etc..
Above-mentioned memory 11 can be used for storing the application software and Various types of data for being installed on electronic device 10, such as data
The related data generated in the program code and its operational process of transfer program 100.
Processor 13 can be a central processing unit, microprocessor or other data processing chips in some embodiments,
Program code or processing data for being stored in run memory 11.
Fig. 5 illustrates only the electronic device 10 with component 11,13,15,17 and data distributing program 100, but answers
Understand, Fig. 5 does not show that all components of electronic device 10, can substitute and implement more or less component.
In 10 embodiment of electronic device shown in Fig. 5, as being stored in a kind of memory 11 of computer storage medium
The program code of data distributing program 100 when processor 13 executes the program code of above-mentioned data distributing program 100, is realized such as
Lower method:
(1) request that burrows is sent to STUN server, with request and establishes P2P data transmission channel with other side's client.
(2) if the P2P data transmission channel is successfully established, P2P audio/video communication is carried out with other side's client.
(3) if the P2P data transmission channel establishes failure, audio-video number is carried out by SFU node and other side's client
According to transfer communication.
Preferably, which can also carry out above procedure code to realize following method:
(4) it establishes and fails when the P2P data transmission channel between the client and other side's client, and SFU can not be passed through
It is (i.e. logical there is no can be successfully established the P2P data transmission that burrows with the client and other side's client that node carries out transfer communication
The SFU node in road) when, the interim data between other side's client is carried out by public network relay server and is transmitted.
The detailed description of the above method please refers to above-mentioned first embodiment and second embodiment, and details are not described herein.
Electronic device (client) provided in this embodiment, can not be successfully established between the client and other side's client
When P2P data transmission channel, attempt to carry out audio, video data transfer communication by the communication agent of SFU node.Due to SFU node
It is distributed in the equipment of user, bandwidth for transmission can be used freely, so being relayed compared to by public network relay server
For the scheme of service, bandwidth cost and operation cost can be reduced very much.In addition, user online simultaneously is more, SFU can be used as
The equipment of node is more, therefore can support the audio/video communication between a large number of users.When there is no with the client and right
When square client can be successfully established the SFU node of P2P data transmission channel, the visitor is just realized using public network relay server
Audio, video data transmission between family end and other side's client, ensures going on smoothly for data transmission.
Fourth embodiment
As shown in fig.6, a kind of framework of the data transmission system preferred embodiment proposed for fourth embodiment of the invention
Schematic diagram.
In the present embodiment, data transmission system 1 includes STUN server 2, SFU node 3 and at least two clients 4,
Data communication is carried out by wired or wireless network between above-mentioned each device.The SFU node 3 is the section in content distributing network
Point.
In the present embodiment, it needs to carry out P2P when between two clients 4 (local client 41 and remote client end 42)
When audio, video data transmits, P2P data transmission channel is established by the trial of STUN server 2 first.If P2P data transmission is logical
Road is successfully established, then carries out audio/video communication by the P2P data transmission channel between two clients 4.If the P2P data pass
Defeated Path Setup failure, then pass through the communication agent of SFU node 3, it is logical to carry out audio, video data transfer between two clients 4
Letter.Wherein the SFU node 3 needs be successfully established P2P data transmission channel with the two clients 4.If the two clients
P2P data transmission channel between end 4 establishes failure, and there is no can be successfully established P2P data with the two clients 4 to pass
The SFU node 3 in defeated channel, then the two clients 4 need to do interim data transmission by public network relay server.
The detailed description of the function of each device please refers to following 5th embodiments and the 6th in above-mentioned data transmission system 1
Embodiment, details are not described herein.
5th embodiment
As shown in fig.7, fifth embodiment of the invention proposes a kind of data transmission method, it is applied to above-mentioned data transmission system
System 1.In the present embodiment, the execution sequence of the step in flow chart shown in Fig. 7 can change according to different requirements, certain
A little steps can be omitted.This method comprises:
S30, two clients 4 send the request that burrows to corresponding STUN server 2, establish P2P number with other side with request
According to transmission channel.
If needing to carry out P2P audio, video data biography between two clients 4 (local client 41 and remote client end 42)
When defeated, P2P data transmission channel is established by the trial of STUN server 2 first.
The refined flow chart of S30 is shown refering to Fig. 8, Fig. 8.In the present embodiment, above-mentioned S30 includes:
S300, two clients 4 obtain outer net IP and the port of itself by the STUN server 2 with regard near field respectively
(port)。
S302, two clients 4 send the outer net IP and port of itself by Internet network to other side respectively.
S304, two clients 4 obtain the outer net IP and port of other side by Internet network respectively.
S306, two clients 4 respectively send outer net from test data packet to other side IP and port, to establish P2P data
Transmission channel.
Wherein, when local client 41 or remote client end 42 receive other side transmission test data packet after, in time to
Other side's feeding back ACK Echo Frame.As long as at least one party receives pair within a preset time in local client 41 and remote client end 42
The ACK Echo Frame just fed back, it is determined that the P2P data transmission channel is successfully established.If local client 41 and remote client end
42 all time-out do not receive the ACK Echo Frame that other side feeds back, it is determined that the P2P data transmission channel establishes failure.
S32 is logical by P2P data transmission between two clients 4 when the P2P data transmission channel is successfully established
Road carries out P2P audio/video communication.
If the P2P data transmission channel can establish success, between local client 41 and remote client end 42 directly
Audio, video data is sent to other side by the P2P data transmission channel.
S34 carries out sound view by SFU node 3 between two clients 4 when the P2P data transmission channel establishes failure
Frequency is according to transfer communication.
If the P2P data transmission channel establishes failure, need to use between local client 41 and remote client end 42
Other modes establish transmission channel.In the present embodiment, the communication agent by SFU node 3 is attempted, local client 41 is carried out
Audio, video data transfer communication between remote client end 42.
The refined flow chart of S34 is shown refering to Fig. 9, Fig. 9.In the present embodiment, above-mentioned S34 includes:
S340 chooses the SFU node 3 that P2P data transmission channel can be successfully established with two clients 4.
The SFU node 3 requires that P2P data transmission channel can be successfully established with two clients 4, if any one
Side burrows unsuccessfully with the SFU node 3, then the SFU node 3 loses the function of transfer.It establishes and fails when the P2P data transmission channel
When, according to the NAT type of two clients 4, selection can (two clients 4 may be same with two NAT types
Kind of NAT type or NAT type not of the same race) the SFU node 3 of P2P data transmission is carried out, there may be more for such SFU node 3
It is a.Then one of SFU node 3 is chosen according to preset rules (such as nearby principle), attempts to distinguish with two clients 4
Establish P2P data transmission channel, if two passes can be successfully established, by the SFU node 3 as two clients 4 it
Between transfer.If there is the P2P data transmission channel between any one client 4 and the SFU node 3 to establish failure, the SFU
Node 3 loses the function of transfer, continues to choose next SFU node 3, attempts to establish P2P data respectively with two clients 4
Transmission channel, until finding the SFU node 3 that can be successfully established P2P data transmission channel with two clients 4.If no
In the presence of the SFU node 3 that can be successfully established P2P data transmission channel with two clients 4, then two clients 4 it
Between can not pass through SFU node 3 carry out transfer communication.
S342, the SFU node 3 is by the P2P data transmission channel between two clients 4, by two clients 4
Other side is gone in the audio, video data of transmission.
In the present embodiment, local client 41 and remote client end 42 pass through the P2P between the SFU node 3 respectively
Data transmission channel transmits audio, video data to the SFU node 3, and then the SFU node 3 will be in received audio, video data
The P2P data transmission channel between remote client end 42 or local client 41 is gone to, to realize 41 He of local client
Audio, video data communication between remote client end 42.
Data transmission method provided in this embodiment, since SFU node 3 is distributed in the equipment of user, bandwidth for transmission can
Freely to use, so for compared to the scheme for carrying out relay services by public network relay server, bandwidth cost and operation
Cost can reduce very much.In addition, user online simultaneously is more, the equipment that can be used as SFU node 3 is more, therefore can prop up
Support the audio/video communication between a large number of users.
Sixth embodiment
As shown in fig.10, sixth embodiment of the invention proposes a kind of data transmission method.In the present embodiment, according to not
With demand, the execution sequence of the step in flow chart shown in Fig. 10 can change, and certain steps can be omitted.The present embodiment
In, the S40-S44 in above-mentioned data transmission method is similar with the S30-S34 of sixth embodiment, and difference is that this method is also wrapped
Include S46.
S40, two clients 4 send the request that burrows to corresponding STUN server 2, establish P2P number with other side with request
According to transmission channel.
S42 is logical by P2P data transmission between two clients 4 when the P2P data transmission channel is successfully established
Road carries out P2P audio/video communication.
S44 carries out sound view by SFU node 3 between two clients 4 when the P2P data transmission channel establishes failure
Frequency is according to transfer communication.
S46, when between two clients 4 P2P data transmission channel establish failure, and can not by SFU node 3 into
When row transfer communication, interim data transmission is done by public network relay server between two clients 4.
If either party burrows unsuccessfully with the SFU node 3 in two clients 4, which loses transfer
Function, need at this time by transferred in public network relay server realize two clients 4 between audio, video data pass
It is defeated.
Above-mentioned process is illustrated with a specific example below:
(1) user A and user B be in the same room VoIP, if user A can directly pass through with user B it is corresponding
STUN server establish P2P data transmission channel, then by the P2P data transmission channel carry out VoIP audio, video data biography
It is defeated.
(2) if user A and user B is directly established, P2P data transmission channel is unsuccessful, according to user A's and user B
NAT (Network Address Translation, network address translation) type, selection can with user A and user B all at
Function establishes the SFU node of P2P data transmission channel.
(3) the SFU node is attempted to establish P2P data transmission channel with user A.
(4) similarly the SFU node is attempted to establish P2P data transmission channel with user B.
(5) if user A or user B and the SFU node burrow unsuccessfully, connection can not be established, then user A and user B is logical
It crosses public network relay server and does voip network transmission.
(6) success if user A and user B burrow with the SFU node respectively, user A by audio, video data by with
The P2P data transmission channel that the SFU node is established is sent to the SFU node.
(7) similarly audio, video data is sent to this by the P2P data transmission channel established with the SFU node by user B
SFU node.
(8) audio, video data that the SFU node sends user A passes through in the P2P data transmission channel between user B
It is given to user B, at this moment user B receives the audio, video data of user A transmission.
(9) audio, video data that similarly the SFU node sends user B is transmitted logical by the P2P data between user A
User A is given in road, at this moment user A receives the audio, video data of user B transmission.
It is logical can not to be successfully established the transmission of P2P data between two clients 4 for data transmission method provided in this embodiment
When road, attempt to carry out audio, video data transfer communication by the communication agent of SFU node 3.Since SFU node 3 is distributed in user
Equipment on, bandwidth for transmission can be used freely, thus compared to by public network relay server carry out relay services scheme
For, bandwidth cost and operation cost can reduce very much.In addition, user online simultaneously is more, setting for SFU node 3 can be used as
It is standby more, therefore the audio/video communication between a large number of users can be supported.When there is no can successfully build with two clients 4
When the SFU node 3 of vertical P2P data transmission channel, the sound between two clients 4 is just realized using public network relay server
Video data transmission ensures going on smoothly for data transmission.
7th embodiment
The present invention also provides another embodiments, that is, provide a kind of computer readable storage medium, above-mentioned computer
Readable storage medium storing program for executing is stored with data distributing program 100, and above-mentioned data distributing program 100 can be executed by least one processor,
So that at least one above-mentioned processor executes such as above-mentioned data transmission method.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in a storage medium
In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a client (can be mobile phone, computer, electronics
Device, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (12)
1. a kind of data transmission method is applied to client, which is characterized in that the described method includes:
The request that burrows is sent to STUN server, P2P data transmission channel is established with other side's client with request;
If the P2P data transmission channel is successfully established, P2P audio/video communication is carried out with other side's client;And
If the P2P data transmission channel establishes failure, pass through selective forwarding cell S FU node and other side's client
Carry out audio, video data transfer communication.
2. data transmission method as described in claim 1, which is characterized in that the method also includes:
It establishes and fails when the P2P data transmission channel between the client and other side's client, and can not be by described
When SFU node carries out transfer communication, the interim data between other side's client is carried out by public network Relay Server and is passed
It is defeated.
3. data transmission method as claimed in claim 1 or 2, which is characterized in that described burrow to the transmission of STUN server is asked
It asks, establishing P2P data transmission channel with other side's client with request includes:
Itself outer net IP and port are obtained by the STUN server with regard near field;
Itself outer net IP and port are sent to other side's client by Internet network;
IP and the port of other side's client are obtained by Internet network;
Test data packet is sent to the outer net IP of other side's client and port, and receives the survey that other side's client is sent
Data packet is tried, to establish the P2P data transmission channel.
4. data transmission method as claimed in claim 1 or 2, which is characterized in that described to pass through SFU node and other side visitor
Family end carries out audio, video data transfer communication
Choose the SFU node that P2P data transmission channel can be successfully established with the client and other side's client;
The client is saved by the P2P data transmission channel transmission audio, video data between the SFU node to the SFU
Point, with by the P2P data transmission channel between the SFU node and other side's client by the audio, video data transfer
To other side's client;
The client is received described in the SFU node transfer by the P2P data transmission channel between the SFU node
The audio, video data that other side's client is sent.
5. data transmission method as claimed in claim 4, which is characterized in that the selection and the client and the other side
The SFU node that client can be successfully established P2P data transmission channel includes:
According to the network address translation NAT type of the client and other side's client, selection can be with the NAT type
Carry out multiple SFU nodes of P2P data transmission;
One is chosen from the multiple SFU node according to preset rules, is attempted and the client and other side's client
Establish P2P data transmission channel respectively, if two P2P data transmission channels can be successfully established, using the SFU node as
Transfer between the client and other side's client;
If the P2P data transmission channel between the client or other side's client and the SFU node establishes failure,
Continue to choose next SFU node, attempts to establish P2P data respectively with the client and other side's client and transmit to lead to
Road saves until finding the SFU that can be successfully established P2P data transmission channel with the client and other side's client
Point;
The SFU section of P2P data transmission channel can be successfully established with the client and other side's client if it does not exist
Point, then the client and other side's client can not carry out transfer communication by the SFU node.
6. data transmission method as described in claim 1, which is characterized in that the SFU node is in content distributing network
Node.
7. a kind of electronic device, which is characterized in that the electronic device includes memory, processor, is stored on the memory
There is the data distributing program that can be run on the processor, is realized such as when the data distributing program is executed by the processor
Data transmission method described in any one of claims 1-6.
8. a kind of data transmission system, which is characterized in that the system comprises:
STUN server;
Selective forwarding cell S FU node;
At least two clients;
Two clients send the request that burrows to the corresponding STUN server, establish P2P data with other side with request
Transmission channel;
If the P2P data transmission channel is successfully established, pass through the P2P data transmission channel between two clients
Carry out P2P audio/video communication;
If the P2P data transmission channel establishes failure, pass through SFU node progress sound view between two clients
Frequency is according to transfer communication.
9. data transmission system as claimed in claim 8, it is characterised in that:
It establishes and fails when the P2P data transmission channel between two clients, and can not be by SFU node progress
When turning communication, two clients do interim data transmission by public network Relay Server.
10. data transmission system as claimed in claim 8 or 9, which is characterized in that pass through between described two clients
The SFU node carries out audio, video data transfer communication
Choose the SFU node that P2P data transmission channel can be successfully established with described two clients;
Described two clients transmit audio, video data extremely by the P2P data transmission channel between the SFU node respectively
The SFU node, with by the P2P data transmission channel between the SFU node and other side's client by the audio-video number
Other side's client is gone in;
Described two clients are received in the SFU node by the P2P data transmission channel between the SFU node respectively
The audio, video data that the other side's client turned is sent.
11. data transmission system as claimed in claim 8, which is characterized in that the SFU node is in content distributing network
Node device.
12. a kind of computer readable storage medium, the computer-readable recording medium storage has data distributing program, the number
It can be executed by least one processor according to transfer program, so that at least one described processor is executed as appointed in claim 1-6
Data transmission method described in one.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811367118.2A CN109495599B (en) | 2018-11-16 | 2018-11-16 | Data transmission method and system, electronic device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811367118.2A CN109495599B (en) | 2018-11-16 | 2018-11-16 | Data transmission method and system, electronic device and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109495599A true CN109495599A (en) | 2019-03-19 |
CN109495599B CN109495599B (en) | 2023-09-19 |
Family
ID=65695092
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811367118.2A Active CN109495599B (en) | 2018-11-16 | 2018-11-16 | Data transmission method and system, electronic device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109495599B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110177288A (en) * | 2019-05-29 | 2019-08-27 | 北京大米科技有限公司 | Audio/video data transmission method, device, electronic equipment and computer-readable medium |
CN110505270A (en) * | 2019-07-03 | 2019-11-26 | 西安万像电子科技有限公司 | Data transmission method, system and device |
CN110730203A (en) * | 2019-09-04 | 2020-01-24 | 华为技术有限公司 | P2P communication method and device |
WO2020248963A1 (en) * | 2019-06-11 | 2020-12-17 | 华为技术有限公司 | Method and apparatus for establishing end-to-end network connection, and network system |
WO2021184225A1 (en) * | 2020-03-17 | 2021-09-23 | 华为技术有限公司 | Communication method and apparatus |
CN114915748A (en) * | 2021-02-09 | 2022-08-16 | 华为技术有限公司 | Method, system and related device for dynamically switching audio and video communication modes |
CN115686384A (en) * | 2022-12-30 | 2023-02-03 | 北京探索者软件股份有限公司 | Data transmission method and device for CAD client, storage medium and electronic device |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060120293A1 (en) * | 2004-12-07 | 2006-06-08 | Wing Daniel G | Method and apparatus for discovering Internet addresses |
CN101102310A (en) * | 2007-07-25 | 2008-01-09 | 中国科学院沈阳计算技术研究所有限公司 | SIP soft switching system supporting P2P media transmission and its implementation method |
WO2010091724A1 (en) * | 2009-02-11 | 2010-08-19 | Nokia Siemens Networks Oy | Network component and method for operating said network component |
US8601144B1 (en) * | 2012-11-27 | 2013-12-03 | Sansay, Inc. | Systems and methods for automatic ICE relay candidate creation |
CN103702062A (en) * | 2013-12-27 | 2014-04-02 | Tcl集团股份有限公司 | Audio and video communication method, device and system |
CN103718532A (en) * | 2013-03-26 | 2014-04-09 | 华为技术有限公司 | Data transmission method, apparatus and terminal device |
US20160099890A1 (en) * | 2014-10-02 | 2016-04-07 | Microsoft Corporation | Relay Optimization using Software Defined Networking |
CN107196838A (en) * | 2017-07-20 | 2017-09-22 | 韩锐 | Communication means and system based on transnational, the ultralow delay of video class in webpage |
US20180007205A1 (en) * | 2016-07-01 | 2018-01-04 | At&T Intellectual Property I, Lp | Customer care database creation system and method |
-
2018
- 2018-11-16 CN CN201811367118.2A patent/CN109495599B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060120293A1 (en) * | 2004-12-07 | 2006-06-08 | Wing Daniel G | Method and apparatus for discovering Internet addresses |
CN101102310A (en) * | 2007-07-25 | 2008-01-09 | 中国科学院沈阳计算技术研究所有限公司 | SIP soft switching system supporting P2P media transmission and its implementation method |
WO2010091724A1 (en) * | 2009-02-11 | 2010-08-19 | Nokia Siemens Networks Oy | Network component and method for operating said network component |
US8601144B1 (en) * | 2012-11-27 | 2013-12-03 | Sansay, Inc. | Systems and methods for automatic ICE relay candidate creation |
CN103718532A (en) * | 2013-03-26 | 2014-04-09 | 华为技术有限公司 | Data transmission method, apparatus and terminal device |
CN103702062A (en) * | 2013-12-27 | 2014-04-02 | Tcl集团股份有限公司 | Audio and video communication method, device and system |
US20160099890A1 (en) * | 2014-10-02 | 2016-04-07 | Microsoft Corporation | Relay Optimization using Software Defined Networking |
US20180007205A1 (en) * | 2016-07-01 | 2018-01-04 | At&T Intellectual Property I, Lp | Customer care database creation system and method |
CN107196838A (en) * | 2017-07-20 | 2017-09-22 | 韩锐 | Communication means and system based on transnational, the ultralow delay of video class in webpage |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110177288A (en) * | 2019-05-29 | 2019-08-27 | 北京大米科技有限公司 | Audio/video data transmission method, device, electronic equipment and computer-readable medium |
WO2020248963A1 (en) * | 2019-06-11 | 2020-12-17 | 华为技术有限公司 | Method and apparatus for establishing end-to-end network connection, and network system |
CN110505270A (en) * | 2019-07-03 | 2019-11-26 | 西安万像电子科技有限公司 | Data transmission method, system and device |
CN110730203A (en) * | 2019-09-04 | 2020-01-24 | 华为技术有限公司 | P2P communication method and device |
WO2021184225A1 (en) * | 2020-03-17 | 2021-09-23 | 华为技术有限公司 | Communication method and apparatus |
CN114915748A (en) * | 2021-02-09 | 2022-08-16 | 华为技术有限公司 | Method, system and related device for dynamically switching audio and video communication modes |
CN115686384A (en) * | 2022-12-30 | 2023-02-03 | 北京探索者软件股份有限公司 | Data transmission method and device for CAD client, storage medium and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN109495599B (en) | 2023-09-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109495599A (en) | Data transmission method and system, electronic device and computer readable storage medium | |
US8650312B2 (en) | Connection establishing management methods for use in a network system and network systems using the same | |
CN111479121B (en) | Live broadcasting method and system based on streaming media server | |
US20150304364A1 (en) | Method, System, and Terminal for Web Real-Time Communication | |
CN109660637A (en) | P2P burrows transmission method and system, electronic device and computer readable storage medium | |
US9699237B2 (en) | Managed media relay selection for real-time communications | |
CN102215276A (en) | Video monitoring system and method of media traverse of network address translation equipment | |
EP2109285A1 (en) | Conference system and method | |
US20130326070A1 (en) | Cascading architecture for audio and video streams | |
US8650313B2 (en) | Endpoint discriminator in network transport protocol startup packets | |
US9413590B2 (en) | Method for management of a secured transfer session through an address translation device, corresponding server and computer program | |
JP2006203575A (en) | Communicating method | |
CN105897853A (en) | Peer-to-peer network connection method and device | |
CN103516573B (en) | Data transmission method among client terminals in restricted network and client terminals | |
CN103685398A (en) | Communication connection establishment method and communication system | |
JP2009194674A (en) | Communication terminal device and control method of communication terminal device | |
US20090028110A1 (en) | Seamless Establishment and Maintenance of Network Connections for Mobile Applications | |
US10375175B2 (en) | Method and apparatus for terminal application accessing NAS | |
EP3832969A1 (en) | Method and apparatus for service request, negotiation and response, and network device and system | |
CN109120578B (en) | Method and device for realizing link connection processing | |
CN103828322B (en) | Media data transmission method and device | |
CN105230074B (en) | Video cache switching handling method, device and system | |
US20070243859A1 (en) | Method and Apparatus for Efficiently Transferring Data within a Telecommunications Network | |
CN108234398B (en) | Multimedia communication method and system and related equipment | |
CN116708381B (en) | Cross-network data transmission method and device, storage medium 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 |