CN109561137A - Establish method, apparatus, terminal device and the medium of P2P network - Google Patents
Establish method, apparatus, terminal device and the medium of P2P network Download PDFInfo
- Publication number
- CN109561137A CN109561137A CN201811354513.7A CN201811354513A CN109561137A CN 109561137 A CN109561137 A CN 109561137A CN 201811354513 A CN201811354513 A CN 201811354513A CN 109561137 A CN109561137 A CN 109561137A
- Authority
- CN
- China
- Prior art keywords
- node
- network
- nodes
- live streaming
- streaming client
- 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
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/80—Responding to QoS
-
- 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/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Information Transfer Between Computers (AREA)
Abstract
This application discloses a kind of method, apparatus for establishing P2P network, terminal device and storage medium, the method includes the steps: after entering a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room send connection request;Connection is established with the node for responding the request;The number of nodes that record has connected with this live streaming client;When the number of nodes having connected with this live streaming client is less than preset value, the node into the corresponding P2P network of the direct broadcasting room sends connection request again.The problem of aiming to solve the problem that the P2P network for how establishing suitable live scene.
Description
Technical field
This application involves internet areas, more particularly to live streaming field.
Background technique
Peer-to-peer (P2P) is a kind of distributed network, and the participant of P2P network shares one that they are possessed
Divide hardware resource (processing capacity, storage capacity, network-connectivity, printer etc.), these shared resources needs are mentioned by network
For service and content, can directly be accessed by other peer nodes (peer) without being subjected to intermediate entities.Ginseng in this network
It is both that resource (service and content) supplier (obtains the number of nodes of resource, the referred to as reality of this node from this node with person
Degree out), and be resource acquisition person's (providing the number of nodes of resource to this node, referred to as this node actually enters degree).
Live streaming can fast and accurately transmit field data, and strong telepresenc allows more and more people to pass through website, computer
Or mobile phone is broadcast live to watch.Real-time live data streams are usually actively distributed to each spectator client by server, for
Family viewing.Ordinary circumstance has hundreds of thousands user even up to a million and is watched in real time with live data streams all the way, if utilizing P2P
Mode be broadcast live the distribution of data flow and improve the efficiency of data distribution then can greatly mitigate the pressure of server.But
It is there is very big difference with the scene of traditional P2P technical application due to being broadcast live, traditional P2P technology is mainly used in sharing
The scene (such as video resource downloading of the websites such as video on demand) of video or audio data, compares and deposits with above-mentioned scene, live streaming
All the time may there be the characteristics of a large amount of user passes in and out direct broadcasting room, so that the dynamic of the P2P network moment based on live streaming becomes
Change, and change frequency is exceedingly fast, but live scene has real-time, and the feature extremely low to delay Caton tolerance rate, if
It continues to use traditional P2P technology and establishes P2P network, certainly will be suitble to directly hardly consistent with the requirement of real-time of live streaming so how to establish
The P2P network for broadcasting scene becomes urgent problem to be solved.
Summary of the invention
In order to solve the above-mentioned technical problem, the application provides method, apparatus, terminal device and the medium for establishing P2P network.
The application's in a first aspect, providing a kind of method for establishing P2P network, comprising steps of
Into after a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room send connection request;
Connection is established with the node for responding the request;
The number of nodes that record has connected with this live streaming client;
It is corresponding to the direct broadcasting room again when the number of nodes having connected with this live streaming client is less than preset value
Node in P2P network sends connection request.
In some instances, the number of nodes that the record has connected with this live streaming client, specifically includes step:
The node identification having connected with this live streaming client is stored to a buffer area;
Signaling information periodically is interacted with the node having connected, the signaling information of connected node is unsatisfactory for presetting if it exists
It is required that then discharging the node identification of the buffer area storage;
Periodically record the quantity for the node identification stored in the buffer area.
In some instances, described other nodes into the corresponding P2P network of the direct broadcasting room return connection request, including
Step:
To server requesting node list, the address of node information for meeting preset condition is carried in the node listing;
After receiving the node listing, the node in Xiang Suoshu node listing sends connection request.
In some instances, in location information, P2P network of the preset condition according to equipment where this live streaming client
The hardware configuration of the uplink capacity, connection, Network status and/or the place equipment that respectively save determines.
In some instances, in the P2P network, other number of nodes that any node is actively connected are set no more than first
Determine threshold value, other number of nodes that any node actively connects are not more than the second given threshold, and first given threshold is greater than
Second given threshold.
In some instances, the live streaming resource includes data packet, and the data packet is obtained by server from main broadcaster's client
The live data streams taken are split, and are encapsulated by server according to customized format, include in the customized format
First identifier, first identifier for describing each data packet uniqueness, the data packet by the node in P2P network directly or
It connects from server and obtains.
In some instances, it after the node with the response request establishes connection, further comprises the steps of:
Negotiate to subscribe to the node having connected;
After negotiating successfully, subscribed node, will be described when getting data packet from server by other nodes
The data packet of live streaming client subscription is pushed to the live streaming client.
In the second aspect originally asked, a kind of device for establishing P2P network is provided, comprising:
Request module, after entering a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room are sent
Connection request;
Processing module, for establishing connection with the node for responding the request;What record had connected with this live streaming client
Number of nodes;It is corresponding to the direct broadcasting room again when the number of nodes having connected with this live streaming client is less than preset value
Node in P2P network sends connection request.
In the third aspect originally asked, a kind of terminal device is provided, comprising:
Processor;And
Memory, the memory are configured to store computer program, and the computer program is configured to described
Processor executes the operation as described in aforementioned first aspect any one method.
In the fourth aspect of the application, a kind of computer readable storage medium is provided, computer program is stored thereon with, it should
Program is executed by processor the operation as described in aforementioned first aspect any one method.
The embodiment of the present application is by recording the number of nodes having connected with this live streaming client;When with this live streaming client
When the number of nodes of connection is less than preset value, the node into the corresponding P2P network of the direct broadcasting room sends connection request again,
It keeps the number of nodes of connection to be no less than preset value to safeguard and be broadcast live client, can not obtained directly to guarantee to be broadcast live client
When broadcasting flow-medium data, live broadcast stream media data quickly can be obtained from the node having connected, reduce and re-establish connection
Time reduces traditional P2P network construction mode bring and plays the delay and Caton problem occurred when live data streams, fabulous
Ground is adapted to the higher live scene of requirement of real-time.
Detailed description of the invention
Fig. 1 is a kind of network architecture for live broadcast system that the embodiment of the present application proposes;
Fig. 2 is a kind of flow chart for method for establishing P2P network that the embodiment of the present application proposes;
Fig. 3 a is the flow chart for the method that the another kind proposed in the embodiment of the present application establishes P2P network;
Fig. 3 b is the flow chart for the method that the another kind proposed in the embodiment of the present application establishes P2P network;
Fig. 4 is that existing P2P network establishes schematic diagram;
Fig. 5 a is the P2P network diagram proposed in the embodiment of the present application;
Fig. 5 b is another P2P network diagram proposed in the embodiment of the present application;
Fig. 6 is the flow chart for the method that the another kind proposed in the embodiment of the present application establishes P2P network;
Fig. 7 a- Fig. 7 c is the network built under three kinds of different server architectures in the embodiment of the present application;
Fig. 8 is the flow chart for the method that the another kind proposed in the embodiment of the present application establishes P2P network;
Fig. 9 is the schematic diagram for the device for establishing P2P network that the embodiment of the present application illustrates;
Figure 10 is the schematic diagram for the terminal device that the embodiment of the present application illustrates.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistent with the application.On the contrary, they be only with it is such as appended
The example of the consistent device and method of some aspects be described in detail in claims, the application.
It is only to be not intended to be limiting the application merely for for the purpose of describing particular embodiments in term used in this application.
It is also intended in the application and the "an" of singular used in the attached claims, " described " and "the" including majority
Form, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein refers to and wraps
It may be combined containing one or more associated any or all of project listed.
It will be appreciated that though various information, but this may be described using term first, second, third, etc. in the application
A little information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other out.For example, not departing from
In the case where the application range, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as
One information.Depending on context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determination ".
Referring to Fig.1, the live scene schematic diagram based on P2P network illustrated for the embodiment of the present application, first
Spectator client, the second spectator client, third spectator client and main broadcaster's client be respectively installed in terminal device 110,
120, on 130 and 140, main broadcaster's client can call camera recorded video, shooting photo by screen capture, and cooperation
Etc. other modes make live broadcast stream media data, live broadcast stream media data include a frame frame picture frame and audio data, then lead to
It crosses network and the live broadcast stream media data of production is sent to server-side 100.Server-side 100 is used to provide the background service of live streaming,
Such as the corresponding relationship of each main broadcaster's client and spectator client is saved, live broadcast stream media data are cut in the management of P2P network
At several data packets, data packet is encapsulated according to customized format, and the distribution etc. of the data packet after being packaged, when first
In same direct broadcasting room, server-side 100 can be with for spectator client, the second spectator client and third client and main broadcaster's client
Notify that the first spectator client, the second spectator client and third spectator client establish P2P network, first in P2P network
Spectator client, the second spectator client and third spectator client between each other can be with interaction data packets, to mitigate server
Pressure, improve it is each live streaming client obtain live broadcast stream media data efficiency.Live streaming client in P2P network is also referred to as
Node.
Refer to the social network-i i-platform, immediate communication platform that numerous users condense together described in the embodiment of the present application
Enter direct broadcasting room by way of logging in client Deng, user, user exists in direct broadcasting room with the identity of member, same straight
Comprising there are many members, such as spectators, main broadcaster etc. of identity in broadcasting.User can be optionally added or exit direct broadcasting room.For tool
There is the user of certain permission, direct broadcasting room member can be added or deleted, can also create or dismiss direct broadcasting room, it is this kind of with permission
The identity of user is main broadcaster.In direct broadcasting room, any number of members can chat, converse, video or push electronics present etc.
Interaction.
" main broadcaster's client " " spectator client " described in the embodiment of the present application can refer to installation on the terminal device soft
Part, in some cases, the live streaming client and spectator client are integrated on a software, when the identity of user is main broadcaster
When, which can be referred to as main broadcaster's client, and when the identity of user is spectators, which is referred to as spectators client
End.Live streaming client in present specification is main broadcaster's client or spectator client.
There is very big difference with the scene of traditional P2P technical application due to being broadcast live, traditional P2P technology is mainly used in
The scene (such as video resource downloading of the websites such as video on demand) of shared video or audio data, compared to above-mentioned scene, directly
It broadcasts and there are the characteristics that having all the time a large amount of user to pass in and out direct broadcasting room, so that the P2P network moment based on live streaming is dynamic
State variation, and change frequency is exceedingly fast, but this is for real-time, and the live scene extremely low to delay Caton tolerance rate
It is unacceptable, so how to establish the P2P network of suitable live scene becomes urgent problem to be solved.
In order to solve the above-mentioned technical problem, the embodiment of the present application provide it is a kind of establish the P2P network based on live streaming method,
Device, equipment and storage medium.Parameter Map 2 is a kind of method for establishing P2P network that the embodiment of the present application illustrates
Flow chart, the method includes the steps:
Client executing S210 is broadcast always: after entering a direct broadcasting room, other in the corresponding P2P network of Xiang Suoshu direct broadcasting room
Node sends connection request;
S220: connection is established with the node for responding the request;
S230: the number of nodes that record has connected with this live streaming client;
S240: when the number of nodes having connected with this live streaming client is less than preset value, again to the direct broadcasting room pair
Node in the P2P network answered sends connection request.
In some instances, described to enter a direct broadcasting room, it specifically may is that user clicks to enter the control of the direct broadcasting room
Afterwards, into the direct broadcasting room.
In some instances, after live streaming client sends connection request to other nodes in P2P network, request is received
Other nodes can be according to selecting returning response or to be not responding to the case where itself, if live streaming client receives the sound of node return
It answers, is then successfully established connection, if live streaming client does not receive always response before the deadline, then it is assumed that connection failure.
In one specific example, the method for P2P network of the foundation described in Fig. 2 based on live streaming may is that a direct broadcasting room a
In have several spectator clients, after these spectator clients mutually establish P2P network, be broadcast live pushing away for stream medium data
It send.It broadcasts always when client 1 logs in server registration, and after entering direct broadcasting room a, into the corresponding P2P network of direct broadcasting room a
Node send connection request, certainly, live streaming client 1 can by enter direct broadcasting room a after, to server request direct broadcasting room a
Each address of node information so that live streaming client 1 can send connection to the node in the corresponding P2P network of direct broadcasting room a
Request;When be broadcast live client 1 receive the response of node after, after establishing connection with the node, more new record with live streaming client
The number of nodes that end 1 has connected, if there is the node connection that connection has been established to disconnect certainly, the number of nodes also being had connected described in update
Amount, and when the number of nodes having connected with live streaming client 1 is less than preset value, again to the corresponding P2P of the direct broadcasting room a
Node in network sends connection request, presets so as to keep the quantity of the node of connection to be no less than first with live streaming client a
Value, such as: preset value 2, live streaming client 1 and 3 node have connected, respectively node 1, node 2 and node 3, and from section
Point 1 obtains live broadcast stream media data, but since the two of them node of network jitter or node 2 and node 3 exits direct broadcasting room,
Connected node quantity is equal to 1, and less than 2, at this point, if being not processed, if node 1 also exits direct broadcasting room or because network is trembled
The reasons such as dynamic do not receive live broadcast stream media data, and live streaming client needs the node again into P2P network to request connection, such as
This, which may cause, does not receive live broadcast stream media data for a period of time, and makes that client a broadcasting live broadcast stream media data are broadcast live
When exist time or Hua Ping, and the embodiment of the present application by maintenance with live streaming client a keep connect number of nodes it is no less than pre-
If value, it is ensured that client a is when that can not obtain live broadcast stream media data for live streaming, quickly obtain live streaming from the node having connected
Stream medium data reduces the time for re-establishing connection, reduces delay and Caton, admirably adapts to higher to requirement of real-time
Live scene.
In some instances, step S230 described in reference Fig. 3 a, Fig. 2 can specifically include:
S231: the node identification having connected with this live streaming client is stored to a buffer area.
S232: signaling information periodically is interacted with the node having connected, the signaling information of connected node is discontented if it exists
Sufficient preset requirement then discharges the node identification of the buffer area storage.
S233: the quantity for the node identification stored in the buffer area is periodically recorded.
The buffer area can be queue, for safeguarding the node identification of storage.The node identification is for characterizing the P2P
The uniqueness of nodes, for example, No. IP of node or other.
The signaling information includes: the information such as the upstream bandwidth of network speed, time delay, packet loss and/or the node having connected, can
To be wherein one or more signaling message comprehensive scores, the preset requirement that meets refers to the small Mr. Yu of above-mentioned comprehensive score
A preset fraction.Except of course that scoring is also possible to discovery when this live streaming client interacts signaling information with connected node, when
Prolong greatly or when packet loss is extremely low or the upstream bandwidth of connected node is smaller, can in connection breaking, and by the node
Mark from buffer area discharge.
Fig. 3 a the embodiment described records the number of nodes having connected with this live streaming client by way of queue, can be with
The preferably node that has connected of maintenance and management and this live streaming client.
In certain some examples, the number of nodes having connected can also be cached with buffer area, after disconnecting, reduced slow
The number of nodes that area has connected is deposited, after newly establishing connection, increases the number of nodes that buffer area has connected.In other example
In, it can be periodically detected the number of nodes having connected, and record the number of nodes having connected with this live streaming client.It can be with
The number of nodes being had connected using other way record with this live streaming client, the application do not limit record and this live streaming client
The mode for the number of nodes having connected.
Number of nodes in the corresponding P2P network of one direct broadcasting room is huge, if each live streaming into direct broadcasting room is objective
Family end will send connection request to whole nodes, be bound to cause the excessive of bandwidth and occupy.It is some in order to solve the technical problem
In example, referring to Fig. 3 b, step S210 described in Fig. 2 be can specifically include:
S211: client is broadcast always (such as after live streaming client a) enters a direct broadcasting room, to server requesting node column
Table.
Node listing is sent to live streaming client a according to the relevant information of the live streaming client by server.
Wherein, the address of node information for meeting preset condition, such as IP address etc. are carried in the node listing.
The uplink energy that the preset condition respectively saves in the location information, P2P network according to equipment where this live streaming client a
The hardware configuration determination of power, connection, Network status and/or place equipment.In one specific example, server is according to institute
The location information of equipment, will exist apart from the closer a certain number of nodes records of live streaming client where stating live streaming client
In node listing, quantity can be 40 to five ten.
S212: after the live streaming client receives the node listing, the node in Xiang Suoshu node listing sends connection
Request.
In some instances, live streaming client a can be according to the address information carried in node listing, into node listing
All or part of node send connection request.
The embodiment of the present application is by obtaining the node column for meeting preset condition for this live streaming client a from server
Table combines the quality of connection to control the quantity that this live streaming client a sends the node of connection request.
It finds in practical applications, saturated phenomenon easily occurs in existing P2P network, and makes the node newly to network can not
Resource data is obtained from other nodes.For example, referring to Fig. 4, node 1,2 and 3 resource data supplier and number of resources each other two-by-two
According to taker is obtained, the resource data supplier that such as each node is at most used as two nodes, then when there is new node to enter, section
Point 1,2 and 3 can not provide resource data to the node newly entered.For this problem, the P2P network that the embodiment of the present application proposes
In, other number of nodes that any node is actively connected are not more than the first given threshold, other sections that any node actively connects
Points are not more than the second given threshold, and first given threshold is greater than the second given threshold.
It is the P2P network diagram shown in the embodiment of the present application referring to Fig. 5 a, in P2P network described in Fig. 5 a, setting is appointed
Other number of nodes that one node is actively connected are not more than the first given threshold, other number of nodes that any node actively connects are not
Greater than the second given threshold, and first given threshold is greater than the second given threshold, such as the first given threshold is 3, second
Given threshold is 2, and 1 active of node establishes connection with 2 nodes, is actively connected by 3 nodes, then node 1 is actively connected
Other number of nodes be 3, be equal to the first given threshold, other number of nodes that node 1 actively connects be 2, be equal to second setting threshold
Value, at this point, node 1 can not actively connect other nodes, also successfully can not actively be connected by other nodes;2 active of node connects
1 node is connect, is actively connected by 2 nodes, then other number of nodes that node 2 is actively connected are 2, less than the first setting threshold
Value, other number of nodes that node 2 actively connects are 1, less than the second given threshold, at this point, node 2 can also actively be connected as 2-
1=1 node, node 2 also allow actively to be connected by 3-2=1 other nodes.
So far, so far, in the P2P network proposed different from the construction method of traditional P2P network, the embodiment of the present application,
Other number of nodes that any node is actively connected are not more than the first given threshold, other number of nodes that any node actively connects
No more than the second given threshold, and first given threshold is greater than the second given threshold.That is, in the embodiment of the present application
The number of nodes (the first given threshold) for connecting the permission of each node actively, which is greater than, allows actively to connect other number of nodes (the
Two given thresholds) so that no matter how entire P2P network is set up according to the method for the embodiment of the present application, certainly exist by other
The chance that node actively connects finally makes new so that can not be saturated by the P2P network that the embodiment of the present application is set up
The node of addition can be easier in access P2P network.For example, referring to Fig. 5 b, for having 3 nodes in P2P network, respectively
It is node 1, node 2 and node 3, in the P2P network, the first given threshold is 2, and the second given threshold is 1, i.e., each node is permitted
Perhaps actively other number of nodes of connection are 1, other number of nodes for allowing actively to be connected are 2.If 1 active connecting node 2 of node,
So node 1 reaches the second given threshold, and node 1 can not actively connect other nodes, but can actively be connected by 1 node
It connects;At this point, node 3 can active connecting node 1 the case where perhaps node 2 is due to 3 active connecting node 1 of node or node 2
It is similar, in order not to repeated description, as signal by taking 3 active connecting node 1 of node as an example in Fig. 5 b, at this point, node 1 and 3 reaches
To the second given threshold, other nodes can not be actively connected, but can actively be connected by 1 node, P2P network at this time
In, node 2 can actively connect 1 other node, since node 1 and 2 has built up connection, so, node 2 is main to node 3
It is dynamic to send connection request, it completes the foundation of P2P network to node 1-3 at this time, in the P2P network, can be led without any node
Other nodes of trend send connection request, and 3 nodes can actively be connected by other nodes.When node 4 enters the P2P network
When, since the node 1-3 in the P2P network can not actively connect other nodes, so, by the node 4 for newly entering the P2P network
Into node 1-3, any node sends connection request (such as 4 active connecting node 2 of node shown in Fig. 5 b), to establish newly
P2P network.It can be seen that the method by the embodiment of the present application from the example of Fig. 5 b, and no matter the connection between node 1-3 is closed
How is system, and the chance for allowing actively to be connected by other nodes there are 3 in entire P2P network, network will not be saturated;And
Node 4 be added after new P2P network in, node 1 and node 3 can permit actively to be connected by 1 node, node 4 then by
Allow actively to be connected by 2 nodes, there is also 4 permissions for new P2P network by the chance of other nodes active connection, will not
It is saturated.
It is not more than the first given threshold, Ren Yijie based on other number of nodes that in P2P network, any node is actively connected
Other number of nodes that point actively connects are not more than the second given threshold, and first given threshold is greater than the second given threshold.
It in some instances, can be according to the address information on node listing, to node listing after live streaming client receives node listing
On all or part of node send connection request, receive request node judge itself whether also allow by other nodes actively
Connection, if other number of nodes that the node is actively connected are given live streaming client returning response, then connected less than the first given threshold
It is connected into function, if being equal to the first given threshold, returning response, live streaming client do not receive feedback before the deadline, then
Think connection failure.
It is the flow chart for another method for establishing P2P network that the embodiment of the present application is schematically shown, specifically referring to Fig. 6
Step includes:
S610: the live broadcast stream media data of acquisition are sent to server by main broadcaster's client.
S620: the live broadcast stream media data received are cut into several data packets by server, and each data packet is pressed
It is encapsulated according to customized format, includes first identifier in the customized format, first identifier is for describing each data packet
Uniqueness.
S630: with main broadcaster's client after the spectator client of same direct broadcasting room establishes P2P network, server is by institute
State node of the packet delivery to Subscriber in P2P network of encapsulation.
S210: live streaming client enters the direct broadcasting room, other nodes hair in the corresponding P2P network of Xiang Suoshu direct broadcasting room
Send connection request.
In some examples, in the P2P network, other number of nodes that any node is actively connected are no more than the first setting
Other number of nodes of threshold value, any node actively connection are not more than the second given threshold, and first given threshold is greater than the
Two given thresholds;
S220: the live streaming client and the node for responding the request establish connection, to update the P2P network.
S230: the number of nodes that the live streaming client record has connected with this live streaming client;
S240: when the number of nodes having connected with this live streaming client is less than preset value, again to the direct broadcasting room pair
Node in the P2P network answered sends connection request.
Method described in Fig. 6 be different from traditional P2P mode, first by live broadcast stream media data be cut into data packet without
It is blocks of files, the size of blocks of files may be in KB up to a hundred, and for blocks of files, and the cleavable granularity of data packet is smaller,
It can be used as smaller transmission unit to transmit in a network, such as when considering the size of the data packet after cutting, can combine
The transmission characteristic of Internet designs so that in the size of data packet and P2P network each interface channel transmission bandwidth
Match.For example, the channel established between each peer node can be UDP channel, and the size of each data packet can be the left side 1KB
The right side is slightly less than MTU (Internet layer maximum transmission unit), in this way, each data packet can be transmitted by 1 IP packet, is not required to
Occur unpacking based on IP packet, therefore the mode than cutting file is more efficient, so that having widely applicable scene.
The server that the embodiment of the present application proposes can be undertaken by a variety of entities, this depends on designer and sets to heterogeneous networks
Standby Partition of role.For example, Fig. 7 a, Fig. 7 b, Fig. 7 c are the network architectures under three kinds of different scenes, it can be seen that different business
Under mode, since business or the demand of equipment management are different, above-mentioned server can be undertaken by different types of server apparatus
Function.In Fig. 7 a, first server undertakes the role for collecting live broadcast stream media data, and second server undertakes cutting data packet
Role, third server is as the role to peer node packet distribution.In Fig. 7 b, first server is integrated with collection stream
The function of media data and cutting data packet, server of the second server as packet distribution.In Fig. 7 c, server will be received
Collection stream medium data, cutting data packet, packet distribution function be integrated in one.It may be noted that in addition to Fig. 7 a, Fig. 7 b and Fig. 7 c
Other than cited example, it is not excluded that have the network architecture or server capability of other forms.
It should be noted that in the packet encapsulation stage, in order to enable the data packet after cutting to receive client
Afterwards between ordered fabrication and client formed peer node after can interaction data packet, server can for each data packet compile
Number, as the field for describing each data packet unique identification, the unique identification is first identifier, in certain examples, can from
The format of data packet is defined to realize this purpose, can specify that specific fields as this unique identification in customized format.?
In some examples, the first identifier that the application proposes be can be in same shared resource data for distinguishing other data packets only
One mark.Certainly, it is not excluded that other modes realize this purpose.
In some examples, referring to Fig. 8, step S220 described in Fig. 2 " establishing connection with the node for responding the request " it
Afterwards, can with comprising steps of
S810: negotiate to subscribe to the node having connected.
In this step, live streaming client can with partially negotiate to subscribe in the node that has connected, it should be noted that this Shen
Please be in volume P2P network described in embodiment, the node status for establishing connection is equivalent, if node a is connected to node b activly request,
After node a and node b establishes connection, it can mutually agree to read between above-mentioned two node, that is, can be node a and obtain from node b
Live broadcast stream media data, node b is subscribed node relative to node a at this time, is also possible to node b and obtains directly from node a
Broadcasting flow-medium data.
S820: after negotiating successfully, subscribed node, will when getting data packet from server by other nodes
The data packet of the live streaming client subscription is pushed to the live streaming client.
It should be noted that wherein Fig. 2, Fig. 3 a, Fig. 3 b, Fig. 6 and Fig. 8 can be arbitrarily made with and another establish P2P network
Method, no longer repeat one by one herein.
Fig. 8 the embodiment described after negotiating successfully, is ordered by negotiating to subscribe to the node having connected first
The node read pushes the data packet of the live streaming client subscription when getting data packet from server by other nodes
To the live streaming client, avoid in existing P2P technology each node by way of drawing stream, bring request and response message are handed over
The delay mutually excessively generated and the occupancy to network bandwidth guarantee the real-time of live streaming client terminal playing live broadcast stream media data
Property.
In order to further increase the efficiency of P2P data transmission in network, in some instances, different data packets is according to
One mark is divided into multiple groups, and the specified data packet that subscribed different nodes respectively push belongs to different grouping.
Specifically, the first identifier can be the number of predetermined figure in some examples, the volume of each data packet can be used
Number to packet count carry out complementation, the grouping of each data packet is determined according to the remainder of complementation.Such as: broadcasting flow-medium data is cut always
It is cut into the data packet that number is 1-20, packet count 5 carries out complementation to 5 with the number of each data packet, such as number is 1,1/
5 remainder is 1, and remainder is 1 to belong to first group, so the data packet that number is 1 belongs to first group, and so on, it can be with
Determine that the grouping situation of each data packet, the data packet group of every group of grouping belong to 0 at subflow all the way, such as the data packet that remainder is 0
Work song stream, the data packet that remainder is 1 belong to 1 work song stream, and so on.In some instances, the packet count can be according to straight
The code rate or resolution ratio of broadcasting flow-medium data or undertake packet distribution task server quantity determine, the plan of specific complementation
Slightly without limitation.After data packet is grouped, server can based on grouping by packet delivery to the node in P2P network, example
Such as, different groups of data packet can be sent in P2P network respectively by multiple servers and obtains resource data from server
Node with improve data transfer efficiency, and increases rising for node play stream media data and broadcasts speed.Certainly, in some instances,
After data packet is grouped, each node can obtain the data of different grouping from different nodes, can be further improved P2P net
Data transmission efficiency in network.
The application can also realize the effect of above-described embodiment by way of to node-classification.A specific example
In, each node in P2P network can safeguard or the node of recording different types, and the type of node includes: both candidate nodes, work
Jump node, transmission node, superseded node or/and ossified node.Wherein,
Both candidate nodes, the node or this node transmission connection request in node listing that the slave server referred to obtains
Node, but not yet establish connection.
Live-vertex refers to that connection has been established with this node from both candidate nodes and keeps the node of connection status.It is living
Signaling information, such as packet loss, delay, network speed and/or upstream bandwidth can be periodically interacted between jump node and this node
Deng.
Transmission node refers to the node that can be used for obtaining resource data in the live-vertex.
Node is eliminated, refers to node second-rate in live-vertex, and being abandoned by this node active release.
Ossified node can be divided into two kinds, and one of which is connection to be requested in both candidate nodes, but be not connected with successfully section
Point;Another kind is in transmission node, can not transfer resource data node, it is such it may be the case that crash or suspension caused by.
Certainly, if data packet is grouped according to number, in some instances, transmission node may include ordering in P2P network
Node is read, for example, node 1 obtains 1 work song stream from node 2, node 2 is the corresponding subscription node with 1 work song stream of node 1, node 1
0 work song stream is obtained from node 3, node 3 is the corresponding subscription node with 0 work song stream of node 1.
In certain some examples, the step S230 of Fig. 2 is also possible to by that can safeguard a queue, active for recording
Node, when existing, when eliminating node and ossified node, by the superseded node and ossified node revocation in live-vertex, and working as should
When node finds that the quantity of live-vertex is less than preset value, the time to server again requests node listing, into node listing
Node is selected to send connection request, so that the quantity of the corresponding live-vertex of each node is no less than preset value.It is appreciated that
In example, above-mentioned every class node can be safeguarded with a queue.
Fig. 9 is referred to, a kind of device for establishing P2P network is provided, comprising:
Request module 910, after entering a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room
Send connection request;
Processing module 920, for establishing connection with the node for responding the request;Record has connected with this live streaming client
Number of nodes;It is corresponding to the direct broadcasting room again when the number of nodes having connected with this live streaming client is less than preset value
P2P network in node send connection request.
The embodiment that the device of P2P network is established in Fig. 9 can be using on the terminal device.Installation practice can pass through
Software realization can also be realized by way of hardware or software and hardware combining.Taking software implementation as an example, it anticipates as a logic
Device in justice is by the processor of terminal device where it by computer program instructions corresponding in nonvolatile memory
It is read into memory what operation was formed.For hardware view, as shown in Figure 10, the device institute of P2P network is established for the application
In a kind of hardware structure diagram of terminal device, in addition to processor shown in Fig. 10, memory, network interface and non-volatile deposit
Except reservoir, the client device in embodiment where device can also include other generally according to the actual functional capability of the equipment
Hardware repeats no more this.Processor is used to carry out:
Into after a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room send connection request;
Connection is established with the node for responding the request;
The number of nodes that record has connected with this live streaming client;
It is corresponding to the direct broadcasting room again when the number of nodes having connected with this live streaming client is less than preset value
Node in P2P network sends connection request.
The function of each unit and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatus
Realization process, details are not described herein.
In the embodiment of the present application, computer readable storage medium can be diversified forms, for example, in different examples
In, the machine readable storage medium may is that RAM (Radom Access Memory, random access memory), volatile deposit
Reservoir, nonvolatile memory, flash memory, memory driver (such as hard disk drive), solid state hard disk, any kind of storage dish
(such as CD, dvd) perhaps similar storage medium or their combination.Special, described computer-readable medium
Can also be paper or other be suitably capable of the medium of print routine.Using these media, these programs can be passed through
The mode of electricity gets (for example, optical scanner), can be compiled, be explained and processing in an appropriate manner, then can be by
It stores in computer media.
For device embodiment, since it corresponds essentially to embodiment of the method, so related place is referring to method reality
Apply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separation unit
The unit of explanation may or may not be physically separated, and component shown as a unit can be or can also be with
It is not physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to actual
The purpose for needing to select some or all of the modules therein to realize application scheme.Those of ordinary skill in the art are not paying
Out in the case where creative work, it can understand and implement.
The foregoing is merely the preferred embodiments of the application, not to limit the application, all essences in the application
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the application protection.
Claims (10)
1. a kind of method for establishing P2P network, which is characterized in that comprising steps of
Into after a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room send connection request;
Connection is established with the node for responding the request;
The number of nodes that record has connected with this live streaming client;
When the number of nodes having connected with this live streaming client is less than preset value, again to the corresponding P2P net of the direct broadcasting room
Node in network sends connection request.
2. the method according to claim 1, wherein the number of nodes that the record has connected with this live streaming client
Amount, specifically includes step:
The node identification having connected with this live streaming client is stored to a buffer area;
Signaling information periodically is interacted with the node having connected, the signaling information of connected node is unsatisfactory for default want if it exists
It asks, then discharges the node identification of the buffer area storage;
Periodically record the quantity for the node identification stored in the buffer area.
3. the method according to claim 1, wherein its into the corresponding P2P network of the direct broadcasting room
He returns connection request by node, comprising steps of
To server requesting node list, the address of node information for meeting preset condition is carried in the node listing;
After receiving the node listing, the node in Xiang Suoshu node listing sends connection request.
4. according to the method described in claim 3, it is characterized in that, the preset condition is according to equipment where this live streaming client
Location information, the hardware configuration of the uplink capacity, connection, Network status and/or the place equipment that respectively save in P2P network it is true
It is fixed.
5. the method according to claim 1, wherein in the P2P network, any node actively connected its
His number of nodes is not more than the first given threshold, other number of nodes that any node actively connects are not more than the second given threshold, and
First given threshold is greater than the second given threshold.
6. the method according to claim 1, wherein it is described establish connection with node that is responding the request after,
It further comprises the steps of:
Negotiate to subscribe to the node having connected;
After negotiating successfully, subscribed node, will when getting live broadcast stream media data from server by other nodes
The live broadcast stream media data-pushing of the live streaming client subscription gives the live streaming client.
7. according to the method described in claim 6, it is characterized in that, the live broadcast stream media data include by server from main broadcaster
Data packet made of the data that client obtains are split, and encapsulated by server according to customized format, it is described customized
It include first identifier in format, first identifier is for describing each data packet uniqueness, and the data packet is by the section in P2P network
Point is directly or indirectly obtained from server.
8. a kind of device for establishing P2P network characterized by comprising
Request module, after entering a direct broadcasting room, other nodes in the corresponding P2P network of Xiang Suoshu direct broadcasting room send connection
Request;
Processing module, for establishing connection with the node for responding the request;The node that record has connected with this live streaming client
Quantity;When the number of nodes having connected with this live streaming client is less than preset value, again to the corresponding P2P net of the direct broadcasting room
Node in network sends connection request.
9. a kind of terminal device characterized by comprising
Processor;And
Memory, the memory are configured to store computer program, and the computer program is configured to by the processing
Device executes the operation as described in claim 1 to 7 any one method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor
Execute the operation as described in claim 1 to 7 any one method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811354513.7A CN109561137B (en) | 2018-11-14 | 2018-11-14 | Method, device, terminal equipment and medium for establishing P2P network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811354513.7A CN109561137B (en) | 2018-11-14 | 2018-11-14 | Method, device, terminal equipment and medium for establishing P2P network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109561137A true CN109561137A (en) | 2019-04-02 |
CN109561137B CN109561137B (en) | 2021-08-24 |
Family
ID=65866156
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811354513.7A Active CN109561137B (en) | 2018-11-14 | 2018-11-14 | Method, device, terminal equipment and medium for establishing P2P network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109561137B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110489484A (en) * | 2019-07-11 | 2019-11-22 | 视联动力信息技术股份有限公司 | Method of data synchronization, device, readable storage medium storing program for executing and electronic equipment |
CN111225242A (en) * | 2020-01-17 | 2020-06-02 | 广州酷狗计算机科技有限公司 | Video playing disaster tolerance method and device and computer storage medium |
CN111479170A (en) * | 2020-03-13 | 2020-07-31 | 杭州火烧云科技有限公司 | Method and system based on video interaction and screen sharing live broadcast |
CN115865941A (en) * | 2023-02-15 | 2023-03-28 | 花瓣云科技有限公司 | Packet loss retransmission method, packet determination method, device, equipment and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080140780A1 (en) * | 2006-11-07 | 2008-06-12 | Tiversa, Inc. | System and method for enhanced experience with a peer to peer network |
US20090116430A1 (en) * | 2007-11-07 | 2009-05-07 | Motorola, Inc. | System for enabling mobile coverage extension and peer-to-peer communications in an ad hoc network and method of operation therefor |
CN101720136A (en) * | 2009-11-27 | 2010-06-02 | 成都市华为赛门铁克科技有限公司 | Method for controlling number of neighbor nodes of client and device and cache system thereof |
CN101945129A (en) * | 2010-09-10 | 2011-01-12 | 北京易视腾科技有限公司 | P2P (Peer to Peer) stream media live-broadcast low-delay transmission method and system thereof |
CN101969448A (en) * | 2009-06-17 | 2011-02-09 | 中国移动通信集团公司 | Method, system and equipment for searching active node in P2P streaming media system |
CN103312824A (en) * | 2013-07-10 | 2013-09-18 | 亿览在线网络技术(北京)有限公司 | Peer-to-peer (P2P) network intelligent speed governing method, device and system |
CN103355008A (en) * | 2010-09-16 | 2013-10-16 | 电话有限公司 | Method and single radio station for fair aggregation of internet backhaul throughput using multiple access points |
US20150381675A1 (en) * | 2012-02-16 | 2015-12-31 | Telefonaktiebolaget L M Ericsson (Publ) | P2p streaming support |
-
2018
- 2018-11-14 CN CN201811354513.7A patent/CN109561137B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080140780A1 (en) * | 2006-11-07 | 2008-06-12 | Tiversa, Inc. | System and method for enhanced experience with a peer to peer network |
US20090116430A1 (en) * | 2007-11-07 | 2009-05-07 | Motorola, Inc. | System for enabling mobile coverage extension and peer-to-peer communications in an ad hoc network and method of operation therefor |
CN101969448A (en) * | 2009-06-17 | 2011-02-09 | 中国移动通信集团公司 | Method, system and equipment for searching active node in P2P streaming media system |
CN101720136A (en) * | 2009-11-27 | 2010-06-02 | 成都市华为赛门铁克科技有限公司 | Method for controlling number of neighbor nodes of client and device and cache system thereof |
CN101945129A (en) * | 2010-09-10 | 2011-01-12 | 北京易视腾科技有限公司 | P2P (Peer to Peer) stream media live-broadcast low-delay transmission method and system thereof |
CN103355008A (en) * | 2010-09-16 | 2013-10-16 | 电话有限公司 | Method and single radio station for fair aggregation of internet backhaul throughput using multiple access points |
US20150381675A1 (en) * | 2012-02-16 | 2015-12-31 | Telefonaktiebolaget L M Ericsson (Publ) | P2p streaming support |
CN103312824A (en) * | 2013-07-10 | 2013-09-18 | 亿览在线网络技术(北京)有限公司 | Peer-to-peer (P2P) network intelligent speed governing method, device and system |
Non-Patent Citations (2)
Title |
---|
KYOUNGSOO BOK,JONGHYEON YOON,JONGTAE LIM,JAESOO YOO: ""Load Balancing with Load Threshold Adjustment in Structured P2P"", 《2018 IEEE INTERNATIONAL CONFERENCE ON BIG DATA AND SMART COMPUTING》 * |
李雯,梁刚: "基于网络流量的P2P动态检测方法", 《四川大学学报 自然科学版》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110489484A (en) * | 2019-07-11 | 2019-11-22 | 视联动力信息技术股份有限公司 | Method of data synchronization, device, readable storage medium storing program for executing and electronic equipment |
CN111225242A (en) * | 2020-01-17 | 2020-06-02 | 广州酷狗计算机科技有限公司 | Video playing disaster tolerance method and device and computer storage medium |
CN111479170A (en) * | 2020-03-13 | 2020-07-31 | 杭州火烧云科技有限公司 | Method and system based on video interaction and screen sharing live broadcast |
CN115865941A (en) * | 2023-02-15 | 2023-03-28 | 花瓣云科技有限公司 | Packet loss retransmission method, packet determination method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109561137B (en) | 2021-08-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109474684B (en) | Method, device, terminal equipment and storage medium for acquiring live video stream | |
CN109560901B (en) | Data retransmission method, device, terminal equipment and storage medium | |
CN109561137A (en) | Establish method, apparatus, terminal device and the medium of P2P network | |
WO2017088383A1 (en) | Method, apparatus and system for playing live video | |
RU2647654C2 (en) | System and method of delivering audio-visual content to client device | |
CN108924609B (en) | Streaming media data transmission method, electronic equipment, device and storage medium | |
CN109151497B (en) | Live wheat-connecting method and device, electronic equipment and storage medium | |
WO2017088381A1 (en) | Method, apparatus and system for playing live video | |
US8176192B2 (en) | Networked transmission system and method for stream data | |
US7525965B1 (en) | Trick play for multicast streams | |
CN110300306B (en) | Live stream load balancing method based on RTMP protocol | |
US20100031300A1 (en) | Operating method of contents on demand system | |
CN108833591B (en) | method, electronic equipment, device and network architecture for data transmission in P2P network | |
CN109348257B (en) | Pull stream control method and device and live broadcast system | |
WO2023061060A1 (en) | Audio and video code stream scheduling method, system, medium and electronic apparatus | |
CN109510868B (en) | Method, device, terminal equipment and storage medium for establishing P2P network | |
CN103716681A (en) | Code stream switching method and electronic equipment | |
Kim et al. | Efficient neighbor selection through connection switching for P2P live streaming | |
WO2020135562A1 (en) | Multicast method, device, apparatus, and computer storage medium | |
KR20190015521A (en) | Methods and devices for determining popular live broadcast video | |
CN114501052A (en) | Live broadcast data processing method, cloud platform, computer equipment and storage medium | |
CN105656742A (en) | Multi-looped network stream media multicast system and method based on MOST | |
CN107645475B (en) | File resource distribution system and method in heterogeneous network | |
CN109040199A (en) | A kind of method, system and storage medium for distributing resource data | |
Ishakian et al. | AngelCast: Cloud-based peer-assisted live streaming using optimized multi-tree construction |
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 |