Streaming media playback system, method, device, equipment and readable storage medium
By adopting distributed networking in the streaming media playback system, each P2P server manages part of the streaming media resources, which solves the problems of poor P2P network stability and weak anti-interference capabilities, and achieves high reliability and improved anti-interference capabilities. and support rapid expansion.
Patent Information
- Application Number
- CN202111388937.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-22
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-11-22
AI Technical Summary
The streaming media playback system based on P2P networking has poor stability and weak anti-interference ability. When the main and backup P2P servers are abnormal at the same time, it will lead to collective failure and service performance degradation.
Adopting a distributed networking method, each P2P server only manages part of the streaming media resources. The player determines the target server from multiple P2P servers and establishes a network connection with it to obtain the streaming media resources to avoid collective problems caused by the abnormality of the main and backup clusters. faults, improving reliability and anti-interference capabilities.
It improves the reliability and anti-interference ability of the streaming media playback system, avoids collective failures, reduces the load pressure on P2P servers, and supports rapid expansion and thermal expansion.
Smart Images

Figure CN114338626B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of streaming media playback, and in particular to a streaming media playback system, method, device, equipment and readable storage medium. Background Art
[0002] With the rapid development of Internet technology, more and more users watch streaming media through the Internet. Streaming media is a type of media data that can be played while being downloaded. At the same time, peer-to-peer networking (P2P), as a popular networking technology, is also widely used in streaming media playback.
[0003] During the P2P-based streaming media playback process, the player requests the P2P server to assign a P2P node, i.e., a neighbor node, to it. After the player establishes a network connection with the neighbor node, it obtains the streaming media and plays it. In order to prevent the P2P server from being unable to provide services due to abnormalities, a primary and backup P2P server is usually set up. When the primary P2P server is abnormal, the backup P2P server provides services. Among them, abnormalities include network jitter, power outage in the computer room, etc.
[0004] In the above P2P networking, all data is concentrated on the main P2P server, and the backup P2P server has the same data. When both the main and backup P2P servers are abnormal, all players cannot watch streaming media. Obviously, the streaming media playback system based on this P2P networking method has poor stability and weak anti-interference ability. Summary of the invention
[0005] The embodiments of the present application provide a streaming media playback system, method, apparatus, device and readable storage medium. Each of the multiple P2P servers only manages part of the streaming media resources, rather than the primary and backup P2P servers centrally managing all the streaming media resources. Even if some P2P servers are abnormal, only some players will be affected, collective failures are not likely to occur, and the system has high reliability and strong anti-interference ability.
[0006] In a first aspect, an embodiment of the present application provides a streaming media playback system, including:
[0007] At least two P2P servers, at least two P2P nodes and a player, wherein:
[0008] Different P2P servers among the at least two P2P servers are used to manage different streaming media resources;
[0009] Each of the at least two P2P nodes establishes a network connection with some of the at least two P2P servers;
[0010] The player is used to determine a target P2P server from the at least two P2P servers, send a node acquisition request to the target P2P server to request a neighboring node, establish a network connection with the neighboring node, obtain the target streaming media resource from the neighboring node and play it.
[0011] In a second aspect, an embodiment of the present application provides a streaming media playback method, including:
[0012] The first P2P server receives a node acquisition request from a player, wherein the node acquisition request carries a target identifier of a target streaming media resource, wherein the first P2P server is determined by the player from at least two P2P servers included in the streaming media playback system, and different P2P servers among the at least two P2P servers manage different streaming media resources;
[0013] The first P2P server queries a correspondence table according to the target identifier to determine a neighbor node from the P2P nodes managed by the first P2P server, the neighbor node storing the target streaming media resource, and the correspondence table storing a correspondence between the node identifier of the P2P node managed by the first P2P server and the resource identifier of the streaming media resource;
[0014] The first P2P server sends a node acquisition response to the player, where the node acquisition response is used to indicate the neighbor node.
[0015] In a third aspect, an embodiment of the present application provides a streaming media playback method, including:
[0016] A first P2P node receives a connection establishment request from a player, wherein the first P2P node is a neighbor node selected by a first P2P server for the player, and the first P2P server is determined by the player from at least two P2P servers included in a streaming media playback system, and different P2P servers in the at least two P2P servers manage different streaming media resources;
[0017] The first P2P node establishes a network connection with the player;
[0018] The first P2P node sends a target streaming media resource to the player based on the network connection.
[0019] In a fourth aspect, an embodiment of the present application provides a streaming media playback device, which is integrated on a first P2P server and includes:
[0020] a receiving module, configured to receive a node acquisition request from a player, wherein the node acquisition request carries a target identifier of a target streaming media resource, wherein the first P2P server is determined by the player from at least two P2P servers included in a streaming media playback system, and different P2P servers among the at least two P2P servers manage different streaming media resources;
[0021] a processing module, configured to query a correspondence table according to the target identifier to determine a neighbor node from the P2P nodes managed by the first P2P server, the neighbor node storing the target streaming media resource, the correspondence table storing a correspondence between the node identifier of the P2P node managed by the first P2P server and the resource identifier of the streaming media resource;
[0022] The sending module is used to send a node acquisition response to the player, and the node acquisition response is used to indicate the neighbor node.
[0023] In a fifth aspect, an embodiment of the present application provides a streaming media playback device, which is integrated on a first P2P node and includes:
[0024] a receiving module, configured to receive a connection establishment request from a player, wherein the first P2P node is a neighbor node selected by a first P2P server for the player, and the first P2P server is determined by the player from at least two P2P servers included in a streaming media playback system, and different P2P servers among the at least two P2P servers manage different streaming media resources;
[0025] A processing module, used for establishing a network connection with the player;
[0026] A sending module is used to send target streaming media resources to the player based on the network connection.
[0027] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method described in the second aspect or various possible implementation methods of the second aspect.
[0028] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method described in the third aspect or various possible implementation methods of the third aspect.
[0029] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method described in the second aspect or various possible implementation methods of the second aspect.
[0030] In a ninth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method described in the third aspect or various possible implementation methods of the third aspect.
[0031] In the tenth aspect, an embodiment of the present application provides a computer program product comprising a computing program, and when the computer program is executed by a processor, the method described in the second aspect or various possible implementation methods of the second aspect is implemented.
[0032] In the eleventh aspect, an embodiment of the present application provides a computer program product comprising a computing program, and when the computer program is executed by a processor, the method described in the third aspect or various possible implementation methods of the third aspect is implemented.
[0033] The streaming media playback system, method, device, equipment and readable storage medium provided by the embodiment of the present application, the streaming media playback system includes at least two P2P servers and at least two P2P nodes and a player. Among them, each P2P server is deployed in different regions or different computer rooms to manage different streaming media resources, and a P2P node establishes a network connection with some P2P servers. During the streaming media playback process, the player determines the target P2P server from at least two P2P servers and requests a neighbor node from the target P2P server. After that, a network connection is established with the neighbor node, and the target streaming media resource is obtained from the neighbor node and played. With this solution, each P2P server only manages part of the streaming media resources and part of the P2P nodes, and only serves some players. Even if some P2P servers are abnormal, it will only affect some players, and it is not easy to have collective failures. It has high reliability and strong anti-interference ability, and avoids the drawbacks of unsuccessful hole punching connection caused by the simultaneous abnormality of the main and standby clusters, and a significant decrease in service performance. Moreover, since each P2P server only manages part of the streaming media resources, the load pressure of each P2P server is smaller. In addition, when the number of players increases significantly, it can be expanded by adding new P2P servers without specifying the location of the new P2P servers. The expansion speed is fast and hot expansion can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0035] Figure 1 It is a structural diagram of an existing streaming media playback system;
[0036] Figure 2 It is a schematic diagram of the architecture of the streaming media playback system provided in the embodiment of the present application;
[0037] Figure 3 is a flow chart of a streaming media playback method provided in an embodiment of the present application;
[0038] Figure 4 A schematic diagram of a streaming media playback device provided in an embodiment of the present application;
[0039] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0041] Existing streaming media playback systems usually include P2P servers, P2P nodes, etc. The P2P server is responsible for recommending neighbor nodes to the player, managing the streaming media resources owned by each P2P node, and helping to exchange information through hole punching. Among them, hole punching means that after the P2P server receives the node acquisition request from the player, it indicates the neighbor node to the player, and the player and the neighbor node establish a network connection. After the hole punching is successful, the P2P node is responsible for providing streaming media resources to the player.
[0042] The above-mentioned streaming media playing system includes a main P2P server and a backup P2P server. The main and backup P2P servers have a large amount of identical data, and the main and backup P2P servers manage a large amount of streaming media resources simultaneously. Figure 1 It is a structural diagram of an existing streaming media playback system.
[0043] Please refer to Figure 1 The main P2P server includes one or more servers, which is also called a main cluster. The backup P2P server includes one or more servers, which is also called a backup cluster.
[0044] P2P nodes are registered with the primary and backup P2P servers. When a user watches streaming media through a player, a node acquisition request is initiated to the primary P2P server to request neighbor nodes. When an abnormality occurs on the primary P2P server, the player requests neighbor nodes through the backup P2P server. The figure only shows that each P2P node establishes a network connection with the primary P2P server.
[0045] Figure 1 In the architecture shown, streaming media resources are stored on each P2P node, and the primary and backup P2P servers manage all streaming media resources. In addition, in order to prevent abnormal jitters in the primary cluster, multiple backup clusters may be set. Since the number of clusters (including primary and backup clusters) is always limited, it is possible that both the primary and backup clusters are abnormal at the same time. At this time, almost all players cannot watch streaming media normally. Obviously, the streaming media playback system stored in the data set has weak anti-interference ability and poor stability.
[0046] When the number of players increases significantly, the server capacity needs to be increased, and P2P servers must be added to both the primary and backup clusters. Moreover, the newly added P2P servers must be P2P servers near the primary and backup clusters, for example, the newly added P2P servers are servers in the computer room near the primary cluster. This shows that the scalability of the streaming media playback system stored in the data center is poor.
[0047] Based on this, the embodiments of the present application provide a streaming media playback system, method, apparatus, device and readable storage medium. Each P2P server in the streaming media playback system only manages part of the streaming media resources, rather than the primary and backup P2P servers centrally managing all streaming media resources. Even if some P2P servers are abnormal, it will only affect some players, and collective failures are not likely to occur. It has high reliability and strong anti-interference ability.
[0048] Figure 2 This is a schematic diagram of the architecture of the streaming media playback system provided in the embodiment of the present application. Figure 2 The streaming media playback system provided in the embodiment of the present application includes: at least two P2P servers 21, at least two P2P nodes 22 and a player 23.
[0049] Typically, streaming media playback scenarios include on-demand, live broadcast, and download, and the streaming media playback system provided in the embodiments of the present application can be applied to live broadcast, on-demand, or download scenarios.
[0050] The networking method provided in the embodiment of the present application can be called distributed networking. In the distributed networking, the P2P servers 21 are deployed in a dispersed manner and can be deployed in different regions, different computer rooms, etc. Each P2P server manages part of the streaming media resources. For example, the streaming media playback system has a total of 8 streaming media resources, and the resource identifier is, for example, a uniform resource locator (URL) or a hash value calculated based on the URL. There are a total of 4 P2P servers 21, and each P2P server 21 manages 2 streaming media resources. Since each P2P server 21 only manages part of the streaming media resources, there is no need to manage all the streaming media resources like the active-standby cluster in the active-standby architecture, thereby reducing the pressure on the P2P server 21.
[0051] The P2P node 22 can be a set-top box, a router, an optical modem, etc., and can also be called a box, which is a device that actually stores streaming media resources. A P2P node 22 establishes a network connection with some P2P servers 21 in the streaming media playback system. For example, each P2P node 22 establishes a network connection with a P2P server 21, and a P2P server 21 manages two P2P nodes 22; for another example, a P2P node 22 establishes a network connection with two P2P servers 21. At this time, one P2P node 22 can serve these two P2P servers 21. Since each P2P node 22 is only connected to some P2P servers 21, the number of P2P nodes 22 managed by the P2P server 21 is relatively small, which further reduces the pressure on the P2P server 21.
[0052] After the streaming media playback system is built, initially, the P2P node 22 randomly selects one or two P2P servers 21 from multiple P2P servers 21 and establishes a network connection. Alternatively, the P2P node 22 selects the P2P server 21 according to a certain rule to ensure that there are not too many P2P nodes under each P2P server 21. After a P2P node 22 establishes a network connection with a P2P server 21, the information of the P2P server 21 will be recorded. When the P2P node 22 is powered off, after power is restored, the original P2P server is selected according to the recorded information to establish a network connection.
[0053] The player 23 determines the target P2P server from at least two P2P servers 21 according to a preset rule, and sends a node acquisition request to the target P2P server to request neighbor nodes. After the target P2P server indicates the neighbor nodes to the player, the player 23 establishes a network connection with the neighbor nodes, obtains the target streaming media resources from the neighbor nodes, and plays them. For example, Figure 2In the illustrated architecture, the IP addresses of the P2P servers from left to right are IP1, IP2, IP3 and IP4, and the identifiers of the P2P nodes from left to right are node 1 to node 8. Player 23 requests to play the streaming media resource whose resource identifier is URL1. According to URL1, it is determined that the IP address of the target P2P server is IP1, and a neighbor node acquisition request is sent to the P2P server with IP address IP1. The P2P server with IP address IP1 determines that the neighbor node is node 1, and indicates node 1 to player 23. After player 23 establishes a network connection with node 1, it obtains the streaming media resource indicated by URL1 from node 1 and plays it.
[0054] For another example, player 23 requests to play a streaming media resource with resource identification URL3. Based on URL3, it is determined that the IP address of the target P2P server is IP3, and a neighbor node acquisition request is sent to the P2P server with IP address IP3. The P2P server with IP address IP3 determines that the neighbor node is node 3, and indicates node 3 to player 23. After player 23 establishes a network connection with node 3, it obtains the streaming media resource corresponding to URL3 from node 3 and plays it.
[0055] In the above embodiment, after the streaming media playback system is built, initially, all P2P nodes are empty and do not store streaming media resources. When the player 23 requests to play a streaming media resource indicated by a certain URL, such as the streaming media resource indicated by URL1, URL1 is calculated according to the preset rules, and the IP address of the target P2P server is determined to be IP1 according to the calculation result, and then the neighbor node is requested from the P2P server 21 with the IP address of IP1. The P2P server 21 finds that no P2P node stores the streaming media resource corresponding to URL1, so the P2P server 21 selects a P2P node 22, such as node 1, to obtain the streaming media resource indicated by URL1 from the source station and store it. At the same time, the P2P server 21 with the IP address of IP1 stores the corresponding relationship between URL1 and node 1. In this way, when there is a player 23 requesting to watch the streaming media resource corresponding to URL1 later, the P2P server 21 with the IP address of IP1 can indicate node 1 to it. In this solution, the same rules are preset on all players, and the same preset rules are used to access the P2P server 21, which can ensure that node acquisition requests for the same streaming media resource are sent to the same P2P server 21, that is, node acquisition requests initiated to the same P2P server are all for the same streaming media resource request neighbor node, thereby ensuring that the service quality of the P2P server will not be reduced in the distributed networking mode.
[0056] In the above embodiment, a set of rules is preset on all players 23, which is used to determine the target P2P server from at least two P2P servers 21 according to the resource identifier. For example, the preset rule is: the resource identifier is a URL, the last character of the URL is divided by 5 to obtain a remainder, and a remainder of 1 indicates that the streaming media resource corresponding to the URL is managed by the P2P server 21 with an IP address of IP1, and a remainder of 2 indicates that the streaming media resource corresponding to the URL is managed by the P2P server 21 with an IP address of IP2.
[0057] In the streaming media playing system described in the above embodiment, when some P2P servers 21 fail, only the failed P2P servers need to be replaced.
[0058] The streaming media playback system provided by the embodiment of the present application includes at least two P2P servers and at least two P2P nodes and a player. Among them, each P2P server is deployed in different regions or different computer rooms to manage different streaming media resources, and a P2P node establishes a network connection with some P2P servers. During the streaming media playback process, the player determines the target P2P server from at least two P2P servers and requests a neighbor node from the target P2P server. After that, a network connection is established with the neighbor node, and the target streaming media resources are obtained from the neighbor node and played. With this solution, each P2P server only manages part of the streaming media resources and part of the P2P nodes, and only serves some players. Even if some P2P servers are abnormal, it will only affect some players, and it is not easy to have collective failures. It has high reliability and strong anti-interference ability, and avoids the drawbacks of unsuccessful hole punching connection caused by the simultaneous abnormality of the main and standby clusters, and a significant decrease in service performance. Moreover, since each P2P server only manages part of the streaming media resources, the load pressure of each P2P server is smaller. In addition, when the number of players increases significantly, it can be expanded by adding new P2P servers without specifying the location of the new P2P servers. The expansion speed is fast and hot expansion can be achieved.
[0059] In the above embodiment, the player knows the IP address of each P2P server 21 in the streaming media playback system. For example, the corresponding relationship between the P2P server and the IP address is preset. Figure 2The above-mentioned streaming media playback system further includes a Domain Name System (DNS) server 24, and the DNS server 24 establishes a network connection with each P2P server 21 in the at least two P2P servers 21, each P2P node 22 in the at least two P2P nodes 22, and the player 23. The DNS server 24 regularly generates an IP list and sends it to the player 23, each P2P node 22 in the at least two P2P nodes 22, and each P2P server 21 in the at least two P2P servers 21, and the IP list stores the IP address of each P2P server 21 in the at least two P2P servers 21. Figure 2 Only the connection relationship between the DNS server 24 and the P2P server 21 and the player 23 is illustrated, and the connection relationship between the DNS server 24 and the P2P node 22 is not illustrated.
[0060] For the sake of clarity, the IP list at the first moment is referred to as the first IP list, and the IP list at the second moment is referred to as the second IP list. The first moment and the second moment are two adjacent moments, and the first moment is earlier than the second moment. When the first IP list and the second IP list are different, it means that the streaming media playback system has moved out or added a P2P server 21, which also indicates that the storage location of the streaming media resources in the streaming media playback system has changed. For example, initially, there are 4 P2P servers 21 in the streaming media playback system, and the IP addresses are IP1, IP2, IP3 and IP4, respectively. Each of the 4 P2P servers 21 manages 2 streaming media resources, which are URL1 and URL2, URL3 and URL4, URL5 and URL6, URL7 and URL8, respectively. Subsequently, a P2P server 21 with an IP address of IP5 is added, and URL3 originally managed by the P2P server 21 with an IP address of IP2 and URL8 originally managed by the P2P server 21 with an IP address of IP4 are migrated to the newly added P2P server 21.
[0061] From the perspective of the P2P server 21, when the storage location of the streaming media resources in the streaming media playback system changes, each time after receiving a node acquisition request from a player, if the neighboring node cannot be determined, a query request is sent to the P2P server in the second IP list to instruct the P2P server in the second IP list to determine the neighboring node. In addition, the P2P server 21 also monitors the number of its own P2P nodes, the number of currently online players, the number of P2P nodes of the entire streaming media player, and the number of currently online players, and determines whether to dispatch P2P nodes from other P2P servers 21 based on these monitoring data.
[0062] From the perspective of the P2P node 22 , when the storage location of the streaming media resources in the streaming media playback system changes, if the previously connected P2P server 21 is removed or fails, it is necessary to switch to another P2P server 21 .
[0063] With this solution, the DNS server periodically sends IP lists to P2P servers, P2P nodes, and players, so that the P2P server can find neighboring nodes, the P2P node can determine whether to switch P2P servers, and the player can determine the target server. By building a low-cost distributed P2P server cluster, the streaming media playback system can be flexibly operated and maintained and expanded while ensuring service quality.
[0064] Figure 3 Flowchart of the streaming media playback method provided by the embodiment of the present application. This embodiment is also described from the perspective of the interaction between the player, the P2P server, and the P2P node. This embodiment includes:
[0065] 301. The first P2P server receives a node acquisition request from a player.
[0066] The node acquisition request carries a target identifier of a target streaming media resource, the first P2P server is determined by the player from at least two P2P servers included in the streaming media playback system, and different P2P servers among the at least two P2P servers manage different streaming media resources.
[0067] In the embodiment of the present application, the resource identifier of the streaming media resource can be a URL, a hash value calculated based on the URL, etc. When a user requests to watch a target streaming media resource, a target P2P server is determined from the P2P servers included in the streaming media playback system, hereinafter referred to as the first P2P server. Then, a node acquisition request carrying the target identifier of the target streaming media resource is sent to the first P2P server to request neighbor nodes. For example, please refer to Figure 2 When the target streaming resource is the streaming resource indicated by URL1, the first P2P server is the P2P server with IP address IP1, and the target identifier is URL1; when the target streaming resource is the streaming resource indicated by URL3, the first P2P server is the P2P server with IP address IP3, and the target identifier is URL3.
[0068] 302. The first P2P server queries a correspondence table according to the target identifier to determine a neighbor node from the P2P nodes managed by the first P2P server.
[0069] The target streaming media resource is stored on the neighbor node, and the corresponding relationship table stores the corresponding relationship between the node identifier of the P2P node managed by the first P2P server and the resource identifier of the streaming media resource.
[0070] Exemplarily, the first P2P server maintains a correspondence table, which stores correspondences between node identifiers and resource identifiers, for example, a correspondence between node 1 and URL 1 , where the correspondence indicates that the streaming media resource corresponding to URL 1 is stored on node 1 .
[0071] After receiving the node acquisition request carrying the target identifier, the first P2P server uses the target identifier to query the corresponding relationship, and can determine the neighbor node, that is, the P2P node storing the streaming media resource indicated by the target identifier.
[0072] 303. The first P2P server sends a node acquisition response to the player, where the node acquisition response is used to indicate the neighbor node.
[0073] Accordingly, the player receives the node and obtains the response.
[0074] 304. The player sends a connection establishment request to the first P2P node.
[0075] Correspondingly, the first P2P node receives a connection establishment request from the player.
[0076] Exemplarily, after receiving the node acquisition response, the player determines a neighboring node, which is also referred to as a first P2P node. Afterwards, the player sends a connection establishment request to the first P2P node.
[0077] 305. The first P2P node establishes a network connection with the player.
[0078] 306. The first P2P node sends the target streaming media resource to the player based on the network connection.
[0079] 307. The player plays the target streaming media resource.
[0080] The streaming media playback method provided in the embodiment of the present application is applicable to at least two P2P servers, at least two P2P nodes and a player. Each P2P server is used to manage different streaming media resources, and a P2P node establishes a network connection with some P2P servers. During the streaming media playback process, the player determines a target P2P server from at least two P2P servers and requests a neighbor node from the target P2P server. After that, a network connection is established with the neighbor node, and the target streaming media resource is obtained from the neighbor node and played.
[0081] With this solution, each P2P server only manages some streaming media resources and some P2P nodes, and only serves some players. Even if some P2P servers are abnormal, it will only affect some players. It is not easy to have collective failures. It has high reliability and strong anti-interference ability, and avoids the disadvantages of unsuccessful hole punching connection caused by simultaneous abnormalities of the main and standby clusters, which greatly reduces service performance.
[0082] Optionally, in the above embodiment, the first P2P node is a P2P node that establishes a network connection with the first P2P server and can provide streaming media resources indicated by the target identifier. Before the first P2P node receives the connection establishment request from the player, it also receives a first IP list from the DNS server, where the first IP list is used to indicate the IP address of each P2P server in at least two P2P servers. Afterwards, the first P2P node selects the first P2P server from the first IP list and establishes a network connection.
[0083] For example, when the network is initially established, the first P2P node randomly selects a P2P server from multiple P2P servers and establishes a network connection, and then records the relevant information of the first P2P server. The first P2P server records the correspondence between the node identifier of the first P2P node and the resource identifier of the streaming media resource. For another example, after the first P2P node establishes a network connection with the first P2P server, the connection with the first P2P server is disconnected due to a power outage or other reasons. When the first P2P is powered on, the first P2P server is determined based on the recorded information and a network connection is established with it.
[0084] With this solution, the first P2P node selects the first P2P server from the first IP list and establishes a network connection, so that the first P2P node becomes a P2P node managed by the first P2P server, making it easier for the first P2P server to manage the streaming media resources of the first P2P node.
[0085] Optional, based on the above Figure 2 The network configuration of the streaming media playback system shown in FIG. Figure 3 The streaming media playback method shown, the embodiment of the present application also considers the scenarios of replacing a faulty P2P server in the streaming media playback system, expanding the streaming media playback system, or reducing the P2P server due to cost issues. The following describes these scenarios respectively.
[0086] When a faulty P2P server appears in the streaming media playback system, the faulty P2P server is removed. At this time, the P2P nodes under the faulty P2P server need to switch to other P2P servers, that is, establish network connections with other P2P servers. DNS periodically sends an IP list to each P2P node, and each P2P node determines whether to switch to other P2P servers based on the IP list.
[0087] Taking the first P2P node as an example, the first P2P node receives the first IP list from the DNS server at the first moment, establishes a network connection with the first P2P server in the first IP list, and then receives the second IP list from the DNS server at the second moment. The first IP list and the second IP list are IP lists sent by the DNS server twice in a row. The first P2P node determines whether the first P2P server exists in the second IP list. If the second IP list, like the first IP list, also contains the IP address of the first P2P server, it means that the first P2P server has not been removed, and the first P2P node does not need to switch to other P2P servers. If the first P2P server does not exist in the second list, it means that the first P2P server has been removed from the streaming media playback system. At this time, the first P2P node selects the target P2P server from the second IP list and establishes a connection with it.
[0088] For example, the first P2P node randomly selects an IP address from the second IP list, and establishes a network connection with the P2P server corresponding to the IP address.
[0089] For another example, the first P2P node selects the P2P server with the lightest load from the second IP list, and establishes a network connection with the P2P server.
[0090] With this solution, when a P2P server fails, the P2P node of the failed P2P server switches to another P2P server to ensure the service quality of the streaming media playback system.
[0091] Optionally, in the above embodiment, when the first P2P node determines a failed P2P server in the streaming media playback system according to the first IP list and the second IP list and a new P2P server is added, the first P2P node uses the new P2P server as a target P2P server and establishes a network connection with it.
[0092] For example, the first P2P node is a P2P node that establishes a network connection with the first P2P server. After the first P2P server fails, the IP address of the first P2P server does not exist in the second IP list and a new P2P server is added. Assume that the first IP list is represented by IP list1, the second IP list is represented by IP list2, IP list1 contains IP1-IP4, IP list2 contains IP2-IP5, the first P2P node establishes a network connection with the P2P server corresponding to IP1, and the P2P server fails. The first P2P node determines the intersection of IP list1 and IPlist2, and the intersection contains IP2-IP4. Afterwards, the first P2P node determines the complement of the intersection from IP list2, and the complement contains IP5, then the first P2P node establishes a network connection with the P2P server corresponding to IP5.
[0093] With this solution, if a P2P server of a P2P node fails, a newly added P2P server in the streaming media playback system is connected, thereby ensuring that the load on other P2P servers is not too large, thereby achieving the purpose of improving the service quality of the streaming media playback system.
[0094] Optionally, in the above embodiment, after the first P2P node establishes a network connection with the target P2P server, it also sends indication information to the target P2P server to instruct the target P2P server to establish a corresponding relationship, which is a corresponding relationship between the node identifier of the first P2P node and the resource identifier of the streaming media resource carried by the first P2P node.
[0095] Continuing with the above example, the first P2P node determines that the P2P server corresponding to IP5 is the target P2P server, and actively reports the resource identifier of its own streaming media resources to the P2P server corresponding to IP5, and the P2P server corresponding to IP5 establishes a corresponding relationship between the first P2P node and the resource identifier. After that, the P2P server corresponding to IP5 has the information owned by the faulty first P2P server, thereby replacing the faulty first P2P server. Assuming that the first P2P node carries the streaming media resources corresponding to URL1, when the player requests to play the streaming media resources corresponding to URL1, it sends a node acquisition request to the P2P server corresponding to IP5, and the P2P server with IP address IP5 performs a hole punching, that is, determines the neighbor node that has the streaming media resources indicated by URL1, and indicates the neighbor node to the player. The neighbor node is the first P2P node that switches to the P2P server corresponding to IP5.
[0096] By adopting this solution, the target P2P server is used to replace the faulty P2P server, ensuring that the player can obtain and play streaming media resources when the P2P server fails, thereby improving the service quality of the streaming media playback system.
[0097] In the scenario of expanding the streaming media playback system, the DNS server adds the IP address of the newly added P2P server to the IP list and sends the IP list to the P2P server, P2P node and player. When reducing the P2P server in the streaming media playback system due to cost issues, the DNS server deletes the IP address of the P2P server to be removed from the IP list.
[0098] In the above two scenarios, a new P2P node may appear or a P2P node may be switched from one P2P server to another P2P server. At this time, the network architecture of the streaming media playback system changes. The change in network architecture is also called the change in the storage location of streaming media resources. For example, the streaming media resource corresponding to URL1 was originally stored on node 1 and managed by the P2P server corresponding to IP1. After node 1 is switched to the P2P server corresponding to IP3, that is, after the network architecture changes, the streaming media resource corresponding to URL1 is managed by the P2P server corresponding to IP3.
[0099] By comparing the first IP list and the second IP list, the P2P node can determine whether there is a change in the network architecture and switch the P2P server. For example, IP1 exists in the first IP list, and node 1 originally establishes a network connection with the P2P server corresponding to IP1. When IP1 does not exist in the second IP list, the P2P node determines the intersection of the first IP list and the second IP list, and determines the complement of the intersection from the second IP list. If the complement is empty, an IP address is randomly selected from the second IP list and a network connection is established with the P2P server corresponding to the IP address. If the complement is not empty, an IP address is selected from the complement and a network connection is established with the P2P server corresponding to the IP address.
[0100] For P2P servers, information can be exchanged between P2P servers in the streaming media playback system. The first P2P server determines its own first total amount and second total amount. The first total amount is used to indicate the total amount of P2P nodes that have established a network connection with the first P2P server, and the second total amount is used to indicate the total amount of players that are served by the first P2P server and are online. Afterwards, the first P2P server sends the first total amount and the second total amount to other P2P servers in the streaming media playback system. In this way, the first P2P server can know the total amount of P2P nodes under each P2P server and the number of online players under each P2P server.
[0101] For example, after a player establishes a network connection with the first P2P node managed by the first P2P server, while obtaining streaming media resources from the first P2P node and playing them, the player will report the online status to the first P2P server. In this way, the first P2P server can determine how many players are currently playing the streaming media resources, and the streaming media resources are resources carried by the P2P node managed by the first P2P server.
[0102] With this solution, each P2P server can communicate the number of nodes and the number of online players through information exchange, which makes it easier for the P2P server to master the status of other P2P servers, helps with the scheduling and load balancing of P2P nodes, and improves the service quality of the streaming media playback system.
[0103] Optionally, in the above embodiment, each P2P server also determines whether to schedule a P2P node based on its own first total amount and second total amount, as well as the first total amount and second total amount of other P2P servers. During the determination process, taking the first P2P server as an example, the first P2P server determines a first parameter and a second parameter, and determines whether to schedule a P2P node based on the first parameter and the second parameter. The first parameter is used to indicate the number of players corresponding to each P2P node of the streaming media playback system on average, and the second parameter is used to indicate the number of players corresponding to each P2P node of the first P2P server on average.
[0104] For example, the streaming media playback system includes 4 P2P servers, which are represented as IP1 server, IP2 server, IP3 server and IP4 server respectively. The number of P2P nodes of each P2P server is node_num1, node_num2, node_num3, node_num4 respectively. The number of players currently served and online by each P2P server is player_num1, player_num2, player_num3, player_num4 respectively. Taking the first P2P server as IP1 server as an example, the first parameter is ∑player_num / ∑node_num. Among them, player_num=player_num1+player_num2+player_num3+player_num4, node_num=node_num1+node_num2+node_num3+node_num4. The second parameter is player_num1 / node_num1.
[0105] After the first P2P server determines the first parameter and the second parameter, it determines whether to schedule the P2P node based on the first parameter and the second parameter. For example, when the ratio of the second parameter to the first parameter exceeds the preset ratio, it means that the number of players served by the first P2P server is relatively large, but the number of P2P nodes under the first P2P server is relatively small. At this time, the first P2P server determines to schedule the P2P node, that is, determines the target P2P node from the P2P nodes of other P2P servers, and establishes a network connection with the target P2P node. By scheduling the P2P node, the number of players served by the first P2P server is proportional to the number of P2P nodes, which can ensure the quality of streaming media playback. When the ratio of the second parameter to the first parameter does not exceed the preset ratio, there is no need to schedule the P2P node. Among them, the preset ratio is configurable.
[0106] For another example, when the second parameter is greater than the first parameter, and the difference is greater than the preset difference, it means that the number of players served by the first P2P server is relatively large, but the number of P2P nodes under the first P2P server is relatively small. In this case, the P2P nodes need to be scheduled. When the second parameter is less than the first parameter, or even if the second parameter is greater than the first parameter, but the difference is less than or equal to the preset difference, there is no need to schedule the P2P nodes. The preset difference is configurable.
[0107] By adopting this solution, the purpose of improving the streaming media playback quality is achieved by ensuring that the number of players served by the first P2P server is proportional to the number of P2P nodes.
[0108] Optionally, in the above embodiment, when the first P2P server determines that a P2P node needs to be scheduled, a second P2P server is determined from the at least two P2P servers other than the first P2P server, and a third parameter of the second P2P server is smaller than the first parameter, and the third parameter is used to indicate the average number of players corresponding to each P2P node of the second P2P server.
[0109] Continuing with the above-mentioned streaming media playback system including 4 P2P servers as an example, it is assumed that the second parameter of the first P2P server (IP address is IP1) is player_num1 / node_num1, and the third parameter of the P2P server with IP address is player_num3 / node_num3. Assuming the difference between the second parameter and the first parameter, that is, player_num1 / node_num1-∑player_num / ∑node_num>delta1, the difference between the first parameter and the third parameter is ∑player_num / ∑node_num-player_num3 / node_num3>delat2, delta1 and delta2 are preset differences, and these two preset differences can be the same or different. In this case, the first P2P server determines that the P2P server with IP address IP3 is the second P2P server.
[0110] Afterwards, the first P2P server sends a scheduling request to the second P2P server. After receiving the scheduling request, the second P2P server determines a P2P node from the P2P nodes connected to itself and uses the P2P node as the target P2P node. The second P2P server sends a scheduling response to the first P2P server to indicate the target P2P node.
[0111] In the process of determining the target P2P node, the second P2P server can randomly determine a P2P node from the P2P nodes connected to itself. Alternatively, the second P2P server sorts the P2P nodes connected to itself according to the order of access, and uses the P2P node that is accessed last as the target P2P node. For example, the second P2P server manages three P2P nodes, namely node1, node2 and node3. Node1 is accessed first, followed by node2, and node3 is accessed last. Then the second P2P server disconnects from node3 and sends the identifier of node3 to the first P2P server in the scheduling response, so that the first P2P server and node3 establish a network connection, and finally the first P2P server manages node3 and the streaming media resources carried by node3.
[0112] With this solution, the first P2P server interacts with other P2P servers to determine the target P2P node, thereby achieving the purpose of accurately scheduling the P2P nodes.
[0113] Optionally, in the above embodiment, when the first P2P server queries the correspondence table according to the target identifier to determine the neighbor node from the P2P nodes managed by the first P2P server, it first determines whether the network architecture of the streaming media playback system has changed according to the first IP list and the second IP list. When the first IP address list and the second IP address list are different, it means that the network architecture of the streaming media playback system has changed. At this time, the first P2P server queries the correspondence table according to the target identifier to determine the neighbor node from the P2P nodes connected to the first P2P server. Among them, the change in the network architecture of the streaming media playback system means that due to the addition of a new P2P server or the removal of a P2P server, the P2P node switches to other P2P servers, thereby causing the streaming media resources managed by each P2P server to change.
[0114] With this solution, the first P2P server monitors whether the network architecture of the streaming media playback system has changed. When the network architecture has changed, it first searches for the first P2P node among the P2P nodes connected to the first P2P server, thereby quickly determining the first P2P node.
[0115] Optionally, in the above embodiment, when the network architecture of the streaming media playback system changes, it may cause the first P2P server to be unable to determine the neighbor node after receiving a node acquisition request, that is, the neighbor node does not exist in the P2P node connected to the first P2P server. At this time, the first P2P server sends a query request carrying the target identifier to the third P2P server to request the third P2P server to determine the neighbor node from the P2P node connected to the third P2P server, and the third P2P server is the P2P server corresponding to any IP address in the second IP list. After receiving the query request, the third P2P server determines whether there is a neighbor node in the P2P node connected to itself, and sends the query response to the first P2P server. Correspondingly, the first P2P server receives the query response from the third P2P server, and the query response is used to indicate whether the third P2P server has determined the neighbor node.
[0116] By adopting this solution, when the network architecture of the streaming media playback system changes and there is no neighbor node in the P2P node connected to the first P2P server, the first P2P server determines the neighbor node through other P2P servers in the second IP list, thereby avoiding the phenomenon of being unable to play during the streaming media playback process, thereby achieving the purpose of improving the streaming media playback quality.
[0117] Optionally, in the above embodiment, after the first P2P server receives the query response from the third P2P server, if the query response indicates that the third P2P server has not determined the neighbor node, the first P2P server sends a query request carrying the target identifier to other P2P servers in the second IP list.
[0118] Exemplarily, the second IP list may contain multiple IP addresses, and different IP addresses correspond to different P2P servers. If the third P2P server also fails to determine the neighbor node, the first P2P server continues to send a query request carrying a target identifier to another P2P server in the second list to determine the neighbor node.
[0119] By adopting this solution, query requests are sent to the P2P servers corresponding to the IP addresses in the second IP address list in turn, so as to achieve the purpose of determining neighbor nodes as much as possible.
[0120] Optionally, in the above embodiment, when the number of times the first P2P server sends the query request is greater than or equal to a preset number, the first P2P server sends a prompt message to the player to prompt the player that there is no neighbor node.
[0121] For example, assuming that the preset number of times is 4, after the first P2P server sends the query request for the 4th time, if the query response still indicates that the third P2P server has not determined the neighbor node, that is, none of the 4 P2P servers in the second IP list manages the streaming media resources indicated by the target identifier. In order to avoid not responding to the player for a long time and to avoid the player being in a waiting state for a long time, the first P2P server sends a prompt message to the player to prompt the player that there is no neighbor node and the streaming media resources cannot be obtained.
[0122] This solution can improve the user experience by prompting the player in a timely manner.
[0123] Optionally, in the above embodiment, after the first P2P server receives the query response from the third P2P server, if the query response indicates that the third P2P server has determined a neighbor node, the first P2P server caches the node identifier of the neighbor node determined by the third P2P server.
[0124] Exemplarily, if there is a third P2P server in the second IP list, the P2P server manages the streaming media resources indicated by the target identifier, that is, among the P2P nodes connected to the third P2P server, there is a P2P node that stores the streaming media resources indicated by the target identifier. In this case, the first P2P server records the information of the third P2P server and the relevant P2P nodes. For example, the IP address of the third P2P server is IP3, and there are 3 P2P nodes under the P2P server, namely node1, node2 and node3, and the streaming media resources corresponding to the target identifier are stored on node3. Then, after receiving the query response, the first P2P server caches the corresponding relationship between IP3, node3 and the target identifier in another list. When a player sends a node acquisition request carrying the target identifier later, the first P2P server queries the locally cached information and determines that the streaming media resources indicated by the target identifier are stored on node3, and node3 is a P2P node managed by the P2P server with an IP address of IP3. Afterwards, the first P2P server directly indicates IP3, node3, etc. to the player, so that the player establishes a network connection with node3 managed by the P2P server with IP address IP3.
[0125] By adopting this solution, the relationship between the target identifier and the P2P nodes of other P2P servers is cached locally, so as to achieve the purpose of quickly determining the neighbor nodes.
[0126] Optionally, in the above embodiment, after the first P2P server receives the query response from the third P2P server, if the query response indicates that the third P2P server has determined a neighboring node, the first P2P server determines a storage P2P node from among the P2P nodes connected to the first P2P server. Afterwards, the first P2P server instructs the storage P2P node to store the streaming media resource indicated by the target identifier.
[0127] Exemplarily, after the first P2P server determines the storage neighbor node, the storage neighbor node obtains and stores the streaming media resources from the above-mentioned node3, or obtains and stores the streaming media resources from the source station. When a player subsequently sends a node acquisition request carrying a target identifier, the first P2P server determines that the storage P2P node is the neighbor node and indicates the storage P2P node to the player. After that, the player establishes a network connection with the storage P2P node, obtains and plays the streaming media resources from the storage P2P node.
[0128] Based on the above, when the first P2P server receives a node acquisition request from the player, it can determine the neighbor node in the following order: first search for the local correspondence, then search for the cached list of other P2P servers, and finally, send a query request carrying the target identifier to the third P2P server.
[0129] That is to say, after receiving the node acquisition request from the player, the first P2P server first queries the corresponding relationship according to the target identifier. If the neighbor node is found, it returns it to the player; if the neighbor node is not found, it queries the list of other P2P servers cached locally. If the neighbor node is found, it returns it to the player. If the neighbor node is still not determined, it sends a query request carrying the target identifier to the third P2P server in the second IP list.
[0130] With this solution, when the streaming media playback system adds a P2P server again, the previous P2P services are not affected.
[0131] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0132] Figure 4 The schematic diagram of a streaming media playback device provided in an embodiment of the present application is as follows: The streaming media playback device 400 comprises: a receiving module 41 , a processing module 42 and a sending module 43 .
[0133] When the streaming media playback device 400 is integrated on a first P2P server, the receiving module 41 is used to receive a node acquisition request from the player, the node acquisition request carries a target identifier of a target streaming media resource, the first P2P server is determined by the player from at least two P2P servers included in the streaming media playback system, and different P2P servers in the at least two P2P servers manage different streaming media resources.
[0134] A processing module 42 is used to query a correspondence table according to the target identifier to determine a neighbor node from the P2P nodes managed by the first P2P server, the neighbor node storing the target streaming media resource, and the correspondence table storing a correspondence between the node identifier of the P2P node managed by the first P2P server and the resource identifier of the streaming media resource;
[0135] The sending module 43 is used to send a node acquisition response to the player, where the node acquisition response is used to indicate the neighbor node.
[0136] In a feasible implementation, the processing module 42 is further used to determine a first total amount and a second total amount, wherein the first total amount is used to indicate the total amount of P2P nodes that have established a network connection with the first P2P server, and the second total amount is used to indicate the total amount of players that are served by the first P2P server and are online;
[0137] The sending module 43 is further configured to send the first total amount and the second total amount to other P2P servers among the at least two P2P servers.
[0138] In a feasible implementation, after the processing module 42 determines the first total amount and the second total amount, it is also used to determine a first parameter and a second parameter, and determines whether to schedule the P2P node based on the first parameter and the second parameter, the first parameter is used to indicate the average number of players corresponding to each P2P node of the streaming media playback system, and the second parameter is used to indicate the average number of players corresponding to each P2P node of the first P2P server.
[0139] In a feasible implementation, after the processing module 42 determines whether to schedule a P2P node according to the first parameter and the second parameter, it is further used to determine a second P2P server from the P2P servers other than the first P2P server among the at least two P2P servers when determining to schedule a P2P node, a third parameter of the second P2P server is less than the first parameter, and the third parameter is used to indicate the number of players corresponding to each P2P node of the second P2P server on average;
[0140] The sending module 43 is further configured to send a scheduling request to the second P2P server;
[0141] The receiving module 41 is further configured to receive a scheduling response from the second P2P server, where the scheduling response is used to indicate a target P2P node that has been disconnected from the second P2P server;
[0142] The processing module 42 is further configured to establish a network connection with the target P2P node.
[0143] In a feasible implementation, the processing module 42 is used to determine whether the network architecture of the streaming media playback system has changed based on the first IP list and the second IP list, the first IP list and the second IP list are used to indicate the IP address of each P2P server in the at least two P2P servers at different times, and when the network architecture of the streaming media playback system changes, the correspondence table is queried according to the target identifier to determine the neighbor node from the P2P nodes connected to the first P2P server.
[0144] In a feasible implementation, the sending module 43 is further configured to send a query request carrying the target identifier to a third P2P server to request the third P2P server to determine a neighbor node from the P2P nodes connected to the third P2P server when the processing module 42 determines that the neighbor node does not exist in the P2P nodes connected to the first P2P server, wherein the third P2P server is a P2P server corresponding to any one of the IP addresses in the second IP list;
[0145] The receiving module 41 is further configured to receive a query response from the third P2P server, wherein the query response is used to indicate whether the third P2P server has determined a neighbor node.
[0146] In a feasible implementation, the sending module 43, after the receiving module 41 receives the query response from the third P2P server, is also used to send the query request to other P2P servers in the second IP list except the third P2P server when the query response indicates that the third P2P server has not determined the neighboring node.
[0147] In a feasible implementation, the sending module 43 is further configured to send a prompt message to the player to prompt the player that there is no neighbor node when the number of times the first P2P server sends the query request is greater than or equal to a preset number of times.
[0148] In a feasible implementation, after the receiving module 41 receives the query response from the third P2P server, the processing module 42 is further configured to cache the node identifier of the neighbor node determined by the third P2P server when the query response indicates that the third P2P server has determined the neighbor node.
[0149] In a feasible implementation, the processing module 42 is further used to determine a storage P2P node from the P2P nodes connected to the first P2P server after the receiving module 41 receives the query response from the third P2P server; and instruct the storage P2P node to store the streaming media resources indicated by the target identifier.
[0150] The streaming media playback device provided in the embodiment of the present application can execute the actions of the first P2P server in the above embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0151] When the streaming media playback device 400 is integrated on a first P2P node, the receiving module 41 is used to receive a connection establishment request from a player, the first P2P node is a neighbor node selected by a first P2P server for the player, the first P2P server is determined by the player from at least two P2P servers included in the streaming media playback system, and different P2P servers in the at least two P2P servers manage different streaming media resources;
[0152] A processing module 42, used to establish a network connection with the player;
[0153] The sending module 43 is used to send the target streaming media resource to the player based on the network connection.
[0154] In a feasible implementation, before the receiving module 41 receives the connection establishment request from the player, it is further used to receive a first IP list from a domain name server, where the first IP list is used to indicate the IP address of each P2P server in the at least two P2P servers at the first moment;
[0155] The processing module 42 is further configured to select the first P2P server from the first IP list and establish a network connection with the first P2P server.
[0156] In a feasible implementation, after the processing module 42 establishes a network connection with the first P2P server, the receiving module 41 is further used to receive a second IP list from the domain name server, the second IP list being used to indicate an IP address of each of the at least two P2P servers at a second moment, the first moment being earlier than the second moment;
[0157] The processing module 42 is further configured to select a target P2P server from the second IP list and establish a network connection with the target P2P server when the IP address of the first P2P server does not exist in the second IP list.
[0158] In a feasible implementation, the target P2P server is a P2P server newly added in the streaming media playback system.
[0159] In a feasible implementation, after the processing module 42 establishes a network connection with the target P2P server, the sending module 43 is further used to send indication information to the target P2P server to instruct the target P2P server to establish a correspondence between the node identifier of the first P2P node and the resource identifier of the streaming media resource carried by the first P2P node.
[0160] The streaming media playback device provided in the embodiment of the present application can execute the actions of the first P2P node in the above embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0161] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 500 is, for example, the first P2P server or the first P2P node mentioned above, and the electronic device 500 includes:
[0162] Processor 51 and memory 52;
[0163] The memory 52 stores computer instructions;
[0164] The processor 51 executes the computer instructions stored in the memory 52, so that the processor 51 executes the streaming media playing method implemented by the first P2P server as above; or, the processor 51 executes the streaming media playing method implemented by the first P2P node as above.
[0165] The specific implementation process of the processor 51 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0166] Optionally, the electronic device 50 further includes a communication component 53 , wherein the processor 51 , the memory 52 and the communication component 53 may be connected via a bus 54 .
[0167] The embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the computer instructions are used to implement the streaming media playback method implemented by the first P2P server or the first P2P node as described above.
[0168] The embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the streaming media playback method implemented by the first P2P server or the first P2P node as described above is implemented.
[0169] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0170] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A streaming media playback system, characterized in that: include: At least two P2P servers, at least two P2P nodes and a player, wherein: Each of the at least two P2P servers is used to manage part of the streaming media resources and part of the P2P nodes of the at least two P2P nodes, the part of the streaming media resources managed by the P2P server is stored on part of the P2P nodes managed by the P2P server, and the streaming media resources stored on each P2P node managed by the same P2P server are different, and each of the at least two P2P servers serves part of the players; Each of the at least two P2P nodes establishes a network connection with some of the at least two P2P servers; The player is used to determine a target P2P server from the at least two P2P servers, and send a node acquisition request to the target P2P server to request a neighbor node, wherein the node acquisition request carries a target identifier of a target streaming media resource, and when there are multiple players, when each player requests the same target streaming media, the node acquisition request of each player is sent to the same target P2P server to request the same neighbor node; The target P2P server is used to determine the neighbor node from the managed P2P nodes and indicate it to the player; The player is further configured to obtain and play target streaming media resources from the neighboring node after establishing a network connection with the neighboring node.
2. The system according to claim 1, characterized in that Also includes: A domain name system server establishes a network connection with each P2P server among the at least two P2P servers, each P2P node among the at least two P2P nodes, and the player, and is used to send an IP list to the player, each P2P node among the at least two P2P nodes, and each P2P server among the at least two P2P servers, wherein the IP list stores the IP addresses of each P2P server among the at least two P2P servers.
3. A streaming media playback method, characterized in that: include: The first P2P server receives a node acquisition request from a player, the node acquisition request carries a target identifier of a target streaming media resource, the first P2P server is determined by the player from at least two P2P servers included in the streaming media playback system, each of the at least two P2P servers is used to manage part of the streaming media resources and part of the P2P nodes of the at least two P2P nodes, the part of the streaming media resources managed by the P2P server is stored on part of the P2P nodes managed by the P2P server, and the streaming media resources stored on each P2P node managed by the same P2P server are different, and each of the at least two P2P servers serves part of the players; The first P2P server queries the correspondence table according to the target identifier to determine a neighbor node from the P2P nodes managed by the first P2P server, the neighbor node stores the target streaming media resource, and the correspondence table stores the correspondence between the node identifier of the P2P node managed by the first P2P server and the resource identifier of the streaming media resource. When there are multiple players, when each player requests the same target streaming media, the node acquisition request of each player is sent to the same P2P server to request the same neighbor node; The first P2P server sends a node acquisition response to the player, where the node acquisition response is used to indicate the neighbor node.
4. The method according to claim 3, characterized in that Also includes: The first P2P server determines a first total amount and a second total amount, wherein the first total amount is used to indicate the total amount of P2P nodes that have established a network connection with the first P2P server, and the second total amount is used to indicate the total amount of online players that are served by the first P2P server; The first P2P server sends the first total amount and the second total amount to other P2P servers of the at least two P2P servers.
5. The method according to claim 4, characterized in that After the first P2P server determines the first total amount and the second total amount, the method further includes: The first P2P server determines a first parameter, where the first parameter is used to indicate the number of players corresponding to each P2P node in the streaming media playback system on average; The first P2P server determines a second parameter, where the second parameter is used to indicate the number of players corresponding to each P2P node of the first P2P server on average; The first P2P server determines whether to schedule a P2P node according to the first parameter and the second parameter.
6. The method according to claim 5, characterized in that After the first P2P server determines whether to schedule the P2P node according to the first parameter and the second parameter, the method further includes: When determining to schedule a P2P node, the first P2P server determines a second P2P server from the P2P servers other than the first P2P server among the at least two P2P servers, a third parameter of the second P2P server is less than the first parameter, and the third parameter is used to indicate the number of players corresponding to each P2P node of the second P2P server on average; The first P2P server sends a scheduling request to the second P2P server; The first P2P server receives a scheduling response from the second P2P server, where the scheduling response is used to indicate a target P2P node that has been disconnected from the second P2P server; The first P2P server establishes a network connection with the target P2P node.
7. The method according to any one of claims 3 to 6, characterized in that: The first P2P server queries the corresponding relationship table according to the target identifier to determine the neighbor node from the P2P nodes managed by the first P2P server, including: The first P2P server determines whether the network architecture of the streaming media playback system has changed according to the first IP list and the second IP list, wherein the first IP list and the second IP list are used to indicate the IP address of each P2P server in the at least two P2P servers at different times; When the network architecture of the streaming media playback system changes, the first P2P server queries the corresponding relationship table according to the target identifier to determine a neighboring node from the P2P nodes connected to the first P2P server.
8. The method according to claim 7, characterized in that Also includes: When the neighbor node does not exist in the P2P nodes connected to the first P2P server, the first P2P server sends a query request carrying the target identifier to a third P2P server to request the third P2P server to determine a neighbor node from the P2P nodes connected to the third P2P server, where the third P2P server is a P2P server corresponding to any one of the IP addresses in the second IP list; The first P2P server receives a query response from the third P2P server, where the query response is used to indicate whether the third P2P server has determined a neighbor node.
9. The method according to claim 8, characterized in that After the first P2P server receives the query response from the third P2P server, the method further includes: When the query response indicates that the third P2P server has not determined a neighbor node, the first P2P server sends the query request to other P2P servers in the second IP list except the third P2P server.
10. The method according to claim 9, characterized in that Also includes: When the number of times the first P2P server sends the query request is greater than or equal to a preset number, the first P2P server sends a prompt message to the player to prompt the player that there is no neighbor node.
11. The method according to claim 8, characterized in that After the first P2P server receives the query response from the third P2P server, the method further includes: When the query response indicates that the third P2P server has determined a neighbor node, the first P2P server caches the node identifier of the neighbor node determined by the third P2P server.
12. The method according to claim 8 or 11, characterized in that: After the first P2P server receives the query response from the third P2P server, the method further includes: The first P2P server determines a storage P2P node from P2P nodes connected to the first P2P server; The first P2P server instructs the storage P2P node to store the streaming media resource indicated by the target identifier.
13. A streaming media playback method, characterized in that: include: A first P2P node receives a connection establishment request from a player, the first P2P node is a neighbor node selected by a first P2P server for the player, the first P2P server is determined by the player from at least two P2P servers included in a streaming media playback system, each of the at least two P2P servers is used to manage part of the streaming media resources and part of the P2P nodes in the at least two P2P nodes, the part of the streaming media resources managed by the P2P server is stored on part of the P2P nodes managed by the P2P server, and the streaming media resources stored on each P2P node managed by the same P2P server are different, and each of the at least two P2P servers serves part of the players; The first P2P node establishes a network connection with the player; The first P2P node sends a target streaming media resource to the player based on the network connection.
14. The method according to claim 13, characterized in that Before the first P2P node receives the connection establishment request from the player, the method further includes: The first P2P node receives a first IP list from a domain name server, where the first IP list is used to indicate an IP address of each of the at least two P2P servers at a first moment; The first P2P node selects the first P2P server from the first IP list; The first P2P node establishes a network connection with the first P2P server.
15. The method according to claim 14, characterized in that After the first P2P node establishes a network connection with the first P2P server, the method further includes: The first P2P node receives a second IP list from the domain name server, where the second IP list is used to indicate an IP address of each of the at least two P2P servers at a second moment, where the first moment is earlier than the second moment; When the IP address of the first P2P server does not exist in the second IP list, selecting a target P2P server from the second IP list; The first P2P node establishes a network connection with the target P2P server.
16. The method according to claim 15, characterized in that The target P2P server is a P2P server newly added in the streaming media playing system.
17. The method according to claim 15 or 16, characterized in that After the first P2P node establishes a network connection with the target P2P server, the method further includes: The first P2P node sends instruction information to the target P2P server to instruct the target P2P server to establish a corresponding relationship between the node identifier of the first P2P node and the resource identifier of the streaming media resource carried by the first P2P node.
18. A streaming media playback device, characterized in that: The device is integrated on a first P2P server, and comprises: A receiving module, configured to receive a node acquisition request from a player, wherein the node acquisition request carries a target identifier of a target streaming media resource, wherein the first P2P server is determined by the player from at least two P2P servers included in a streaming media playback system, wherein each of the at least two P2P servers is configured to manage part of the streaming media resources and part of the P2P nodes of the at least two P2P nodes, wherein the part of the streaming media resources managed by the P2P server is stored on part of the P2P nodes managed by the P2P server, and the streaming media resources stored on each P2P node managed by the same P2P server are different, and wherein each of the at least two P2P servers serves part of the players; a processing module, configured to query a correspondence table according to the target identifier to determine a neighbor node from the P2P nodes managed by the first P2P server, the neighbor node storing the target streaming media resource, the correspondence table storing a correspondence between the node identifier of the P2P node managed by the first P2P server and the resource identifier of the streaming media resource, and when there are multiple players and each player requests the same target streaming media, the node acquisition request of each player is sent to the same P2P server to request the same neighbor node; The sending module is used to send a node acquisition response to the player, and the node acquisition response is used to indicate the neighbor node.
19. A streaming media playback device, characterized in that: The device is integrated on a first P2P node, and comprises: A receiving module, configured to receive a connection establishment request from a player, wherein the first P2P node is a neighbor node selected by a first P2P server for the player, the first P2P server is determined by the player from at least two P2P servers included in a streaming media playback system, each of the at least two P2P servers is configured to manage part of the streaming media resources and part of the at least two P2P nodes, the part of the streaming media resources managed by the P2P server is stored on part of the P2P nodes managed by the P2P server, and the streaming media resources stored on each P2P node managed by the same P2P server are different, and each of the at least two P2P servers serves part of the players; A processing module, used for establishing a network connection with the player; A sending module is used to send target streaming media resources to the player based on the network connection.
20. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the electronic device implements the method according to any one of claims 3 to 17.
21. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 3 to 17 is implemented.
