Media stream distribution method and device
By applying a load balancing algorithm in the CDN node and selecting the right node for media stream distribution, the problem of uneven load on the cloud node is solved, which reduces latency and improves service reliability and user experience.
Patent Information
- Application Number
- CN202510210628.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-05-27
AI Technical Summary
The prior art deals with high concurrent audio and video application scenarios, uneven loading of cloud nodes leads to increased latency and risk of service crashes, especially in long-session media streaming application scenarios.
The load balancing algorithm selects suitable nodes from each CDN node for media stream distribution, considering the user terminal location, the number of connections and health status of the CDN nodes to achieve load balancing allocation.
Selecting the appropriate CDN node through the load balancing algorithm can reduce the load uneven situation of the overall cloud node, reduce latency, and improve the reliability of video streaming services and user viewing experience.
Smart Images

Figure CN120050267A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network media stream transmission, and particularly to a media stream distribution method and device. Background Art
[0002] With the rapid development of Internet technology, audio and video application scenarios are becoming increasingly widespread, such as online live streaming, video conferencing, remote teaching, etc. In these scenarios, a large number of users simultaneously request audio and video resources. The traditional centralized server architecture is difficult to withstand the huge pressure brought by high concurrency, and it is prone to problems such as freezing, latency, and even service crashes.
[0003] Currently, the existing technology can reduce the load pressure brought by high concurrency through the cloud environment. Although the cloud environment provides powerful computing and storage resources, there are still many deficiencies in its application of media stream scheduling and distribution:
[0004] Existing methods often use a single traffic distribution method, making it impossible to evenly utilize cloud nodes effectively. For example, when selecting CDN nodes for distribution according to the user's location, and there are too many users in a certain place, the CDN nodes in that place are overused, while the cloud nodes in other regions are idle; especially when dealing with long session scenarios such as media streams, as the number of connections to the same CDN node continues to increase, the latency will gradually increase, resulting in a phenomenon of load imbalance.
[0005] Therefore, in this context, how to provide a content distribution method that can handle long session media stream application scenarios through a CDN node selection mechanism is a technical problem to be solved. Summary of the Invention
[0006] In view of the above problems in the prior art, the present application provides a content distribution method that can handle long session media stream application scenarios through a CDN node selection mechanism.
[0007] To achieve the above object, the first aspect of the present application provides a media stream distribution method, including:
[0008] Receiving a media stream request from a user terminal;
[0009] Selecting a first CDN node from each CDN node through a load balancing algorithm;
[0010] Forwarding the media stream request to the first CDN node, so that the first CDN node provides the distribution of the media stream to the user terminal.
[0011] Thus, by using a load balancing algorithm to select a suitable CDN node as the content distribution node, the load imbalance of the overall cloud nodes is reduced.
[0012] As a possible implementation of the first aspect, selecting the first CDN node from each CDN node through a load balancing algorithm includes at least one of the following:
[0013] Parsing the user terminal IP address from the media stream request, and selecting the first CDN node from the CDN nodes in the same network segment as the user terminal IP address among each CDN node;
[0014] Obtaining the connection numbers of each CDN node, and selecting the first CDN node from the CDN nodes with connection numbers lower than the set value;
[0015] Obtaining the health status of each CDN node, and selecting the first CDN node from the CDN nodes with normal health status.
[0016] Thus, by using different load balancing algorithms to select suitable nodes according to the user terminal location, the connection numbers of CDN nodes, and the health status of CDN nodes, more node selection methods can be provided to suit different usage scenarios. Among them, each load balancing algorithm can provide a load balancing distribution mechanism.
[0017] As a possible implementation of the first aspect, selecting the first CDN node from each CDN node through a load balancing algorithm includes:
[0018] Parsing the user terminal IP address from the media stream request, and selecting the CDN nodes in the same network segment as the user terminal IP address from each CDN node;
[0019] For the selected CDN nodes in the same network segment as the user terminal IP address, obtaining the connection numbers of each CDN node, and selecting the CDN nodes with connection numbers lower than the set value;
[0020] For the selected CDN nodes with connection numbers lower than the set value, obtaining the health status of each CDN node, and selecting the first CDN node from the CDN nodes with normal health status.
[0021] Thus, by selecting nodes with a shorter distance to transmit the media stream, the number of hops in the network routing can be reduced to speed up the access speed; then selecting nodes with fewer connection numbers can avoid the increase in latency caused by too many connection numbers in application scenarios with long session times, and at the same time balance the connection numbers of different nodes to more effectively utilize server resources; finally, selecting healthy nodes can ensure that traffic is only distributed to healthy CDN nodes, thereby improving the reliability of the video stream service and the viewing experience of users.
[0022] As a possible implementation of the first aspect, selecting the first CDN node from each CDN node through a load balancing algorithm includes:
[0023] Selecting the first CDN node according to at least one of the following three parameters: the distance between the CDN node and the user terminal, the health quantity calculated based on the health status of the CDN node, and the connection quantity calculated based on the number of connections of the CDN node.
[0024] Thus, by considering the calculation parameters of one or more methods, a distribution strategy based on location, network, and health can be flexibly considered alone or comprehensively. For scenarios such as systems from different regions with large traffic, it has targeted usage effects such as balancing the overall load of nodes, improving access speed, and enhancing system resilience.
[0025] As a possible implementation of the first aspect, selecting the first CDN node from each CDN node through a load balancing algorithm includes:
[0026] Obtaining the information of the media streams cached by each CDN node, and selecting the first CDN node from the CDN nodes that cache the media stream requested by the user terminal.
[0027] Thus, by caching the media stream content locally on the node, it is convenient for subsequent users to directly access, reduces the request pressure on the source server, and improves the content distribution speed.
[0028] The second aspect of this application provides a media stream distribution method, including:
[0029] The user terminal sends a media stream request;
[0030] The load balancer receives the media stream request and selects the first CDN node from each CDN node through a load balancing algorithm;
[0031] The load balancer forwards the media stream request to the first CDN node;
[0032] The first CDN node returns a media stream address to the user terminal, and the media stream address points to the media stream requested by the user terminal stored on the first CDN node; wherein, the media stream requested by the user terminal stored on the first CDN node is sent by the source server to the first CDN node and stored on the first CDN node;
[0033] The user terminal obtains the media stream from the first CDN node through the media stream address.
[0034] As described above, the load balancer uses a load balancing algorithm to select a suitable CDN node as the content distribution node, and by sending the media stream address to the user terminal, the user can access the media stream stored or cached on the CDN node, reducing the overall uneven load of the cloud nodes and relieving the request pressure on the source server.
[0035] As a possible implementation of the second aspect, during the process of the user terminal obtaining the media stream through the media stream address, it further includes:
[0036] Detect the network transmission status of the media stream;
[0037] When the transmission status is lower than a threshold, at least one of the following methods is used to optimize the network transmission of the media stream: TCP / UDP hybrid transmission, packet loss recovery, and network jitter compensation.
[0038] As described above, according to the network operation situation, optimize the real-time transmission to ensure that users obtain a high-quality audio and video experience.
[0039] The third aspect of the present application provides a media stream distribution device, including:
[0040] A receiving module, configured to receive a media stream request from a user terminal;
[0041] A scheduling module, configured to select a first CDN node from each CDN node through a load balancing algorithm;
[0042] A sending module, forwarding the media stream request to the first CDN node, so that the first CDN node provides the distribution of the media stream to the user terminal.
[0043] The fourth aspect of the present application provides a media stream distribution system, including:
[0044] A user terminal, configured to send a media stream request;
[0045] Multiple CDN nodes, each storing the media stream requested by the user terminal;
[0046] A load balancer, configured to receive the media stream request, select a first CDN node from the multiple CDN nodes through a load balancing algorithm, and forward the media stream request to the first CDN node;
[0047] The first CDN node is configured to return a media stream address to the user terminal, and the media stream address points to the media stream requested by the user terminal stored on the first CDN node;
[0048] The user terminal is further configured to obtain the media stream from the first CDN node through the media stream address.
[0049] As a possible implementation of the fourth aspect, it further includes at least one of the following:
[0050] A media stream server for sending the media stream thereon to each CDN node;
[0051] A metadata management server for storing the metadata of the media stream, where the metadata includes the identifier of the media stream;
[0052] The user terminal is further configured to obtain the identifier of a media stream by accessing the metadata management server, so as to carry the identifier of the media stream when sending the media stream request. Description of the Drawings
[0053] Figure 1 is a flowchart of the media stream distribution method provided in the first embodiment of the present application;
[0054] Figure 2a is a flowchart of the media stream distribution method provided in the second embodiment of the present application;
[0055] Figure 2b is a schematic diagram of a distribution process provided in the second embodiment of the present application;
[0056] Figure 2c is a schematic diagram of data management provided in the second embodiment of the present application;
[0057] Figure 3 is a schematic diagram of the media stream distribution device provided in the third embodiment of the present application;
[0058] Figure 4 is a schematic diagram of the media stream distribution system provided in the fourth embodiment of the present application;
[0059] Figure 5 is a schematic structural diagram of a computing device provided in the embodiments of the present application.
[0060] It should be understood that in the above structural schematic diagrams, the sizes and shapes of the respective block diagrams are for reference only and should not constitute an exclusive interpretation of the embodiments of the present invention. The relative positions and inclusion relationships among the respective block diagrams presented in the structural schematic diagrams only schematically represent the structural associations among the block diagrams, rather than limiting the physical connection manners of the embodiments of the present invention. Detailed Embodiments
[0061] The following describes the technical solutions provided by this application in conjunction with the accompanying drawings and by way of examples. It should be understood that the system architectures and service scenarios provided in the embodiments of this application are mainly used to illustrate possible implementation manners of the technical solutions of this application and should not be construed as the only limitation on the technical solutions of this application. Those of ordinary skill in the art will understand that as the system architecture evolves and new service scenarios emerge, the technical solutions provided by this application are equally applicable to similar technical problems.
[0062] It should be understood that the media stream distribution solutions provided in the embodiments of this application include media stream distribution methods, devices, and computing devices. Since the principles of these technical solutions for solving problems are the same or similar, in the following introduction of specific embodiments, some repetitions may not be elaborated again, but it should be regarded that there are mutual references between these specific embodiments and they can be combined with each other.
[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. In case of inconsistency, the meaning described in this specification or the meaning derived from the content recorded in this specification shall prevail. In addition, the terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application. In order to accurately describe the technical content in this application and to accurately understand the present invention, the following explanations or definitions are given for the terms used in this specification before describing the specific embodiments:
[0064] 1) TCP / UDP Hybrid Transmission: TCP (Transmission Control Protocol) is the Transmission Control Protocol, which is a connection-oriented, reliable, byte-stream-based transport layer protocol. UDP (User Datagram Protocol) is the User Datagram Protocol, which is a connectionless transport layer protocol. TCP / UDP hybrid transmission combines the characteristics of both and has unique advantages in practical applications.
[0065] 2) Loss Packet Recovery (LPR): Loss packet recovery refers to taking a series of technical means to recover lost data packets when data packets are lost during network communication to ensure the integrity and reliability of data transmission. Common loss packet recovery technologies include retransmission mechanisms, forward error correction, selective acknowledgment, etc.
[0066] 3) Network Jitter Compensation: Network jitter refers to the tiny random variations in the arrival time of data packets during network transmission, that is, the inconsistency in the delays between data packets. Such variations in delay can affect the performance of real-time applications such as video conferencing and online gaming, resulting in frame freezes or audio distortion. Network jitter compensation uses techniques to reduce the impact of jitter on applications. Common network jitter compensation methods include jitter buffers, dynamic jitter buffer algorithms, traffic shaping, etc.
[0067] In the media stream distribution solution provided by the embodiments of this application, after receiving a media stream request from a user terminal through a load balancer, a node is selected according to a load balancing algorithm. The load balancing algorithm is selected through a nearest allocation mechanism, a least connection mechanism, and a health check mechanism; after the load balancer forwards the request to the content distribution server of the node; the source server transmits the media stream content to the content distribution server, and the content distribution server transmits the media stream content to the user terminal in real time. This method provides a balanced node allocation mechanism for media stream distribution based on the location of the user terminal, the number of connections to the content distribution server, and the health status of the content distribution server. The embodiments of this application can be applied to the real-time media stream data transmission in the field of online audio and video services, such as online live streaming, video conferencing, remote teaching, etc. The following will introduce each embodiment of this application in detail with reference to the accompanying drawings.
[0068] The first embodiment of this application provides a media stream distribution method, which is implemented through a load balancer. In some embodiments, the load balancer can be independently deployed or deployed at positions such as a CDN node, a terminal device, or a cloud server.
[0069] The following will combine Figure 1 , and specifically illustrate the implementation manners of each step of this method, including steps S10 - S30.
[0070] S10: Receive a media stream request from a user terminal.
[0071] In some embodiments, it can be that the load balancer directly receives the media stream request sent by the user terminal. At this time, the load balancer can be deployed at positions such as a CDN node, a terminal device, or a cloud server.
[0072] In some embodiments, it may be that a load balancer receives a media stream request from a user terminal forwarded by a CDN node. At this time, the load balancer may be deployed on the CDN node. In this case, the media stream request of the user terminal will be sent to the CDN node adjacent to it, and the CDN node will forward the request to the load balancer. In some embodiments, the CDN node may first determine whether to process the media stream request according to its own load condition. When the load is lower than the load threshold, the CDN node may directly respond to the media stream request and return the address of the corresponding media stream stored by it to the user terminal. When the load is higher than its load threshold, it will forward the media stream request to the load balancer.
[0073] In some embodiments, the media stream request may include online live broadcast, video conferencing, remote teaching, etc. Among them, the online live broadcast is mainly one-way on-demand. Video conferencing and remote teaching can be two-way or multi-party on-demand. Each terminal in the two-way and multi-party on-demand is both a receiver and a source media stream provider. Each media stream on-demand can be the same as the process of one-way on-demand, and a CDN node can be reselected. It is also possible that after a certain terminal is assigned a CDN node, other terminals select the same CDN node for on-demand requests and media stream push.
[0074] S20: Select a first CDN node from each CDN node through a load balancing algorithm.
[0075] In some embodiments, the selecting a first CDN node from each CDN node through a load balancing algorithm includes at least one of the following: parsing the user terminal IP address from the media stream request, and selecting the first CDN node from the CDN nodes in the same network segment as the user terminal IP address among each CDN node; obtaining the connection numbers of each CDN node, and selecting the first CDN node from the CDN nodes with connection numbers lower than the set value; obtaining the health status of each CDN node, and selecting the first CDN node from the CDN nodes with normal health status. Among them, the health status refers to the health status of the content distribution server of the node, and can be measured by at least one of the following parameters: throughput, latency, packet loss rate, bandwidth utilization rate, response time, security, etc. The selecting the first CDN node from the CDN nodes with normal health status may randomly select a healthy node, or select the node with the best parameter value status for allocation, or set a certain selection rule such as a security rule to select a healthy node.
[0076] In some embodiments, selecting the first CDN node from each CDN node through a load balancing algorithm includes: parsing the user terminal IP address from the media stream request, and selecting CDN nodes in the same network segment as the user terminal IP address from each CDN node; for the selected CDN nodes in the same network segment as the user terminal IP address, obtaining the connection count of each CDN node, and selecting CDN nodes with a connection count lower than a set value; for the selected CDN nodes with a connection count lower than the set value, obtaining the health status of each CDN node, and selecting the first CDN node from the CDN nodes with normal health status.
[0077] In some embodiments, selecting the first CDN node from each CDN node through a load balancing algorithm includes: selecting the first CDN node according to at least one of the following three parameters: the distance between the CDN node and the user terminal, the health amount calculated based on the health status of the CDN node, and the connection amount calculated based on the connection count of the CDN node. Among them, the score of each CDN node can be calculated according to the following formula:
[0078] N = a 1 M 1 + a 2 M 2 + a 3 M 3
[0079] Wherein, N is the score of the CDN node, a 1 , a 2 , a 3 are weight parameters respectively, M 1 is the distance amount parameter between the CDN node and the user terminal calculated according to the IP address, M 2 is the connection amount parameter calculated according to the connection count of the CDN node, M 3 is the health amount parameter calculated according to the health status of the CDN node;
[0080] Select the CDN node with the highest score as the first CDN node.
[0081] In some embodiments, the distance amount parameter checks all nodes. If a node is in the same network segment as the network segment where the user terminal is located, the distance amount parameter M 1 corresponding to the node is recorded as 1; if the node is in a different network segment from the network segment, the distance amount parameter M 1 corresponding to the node is recorded as 0. The connection amount parameter is obtained by obtaining the connection count of all nodes, including the maximum connection count C 1 ; checking all nodes and obtaining the minimum connection quantization parameter M 2 corresponding to each node, and the M 2 = 1 - C2 / C 1 , where C 2 is the number of connections of each node. The health parameter is obtained by checking the throughput, latency, packet loss rate, bandwidth utilization, response time, security, etc. of each node, scoring according to a set threshold, and linearly weighting the scores to obtain the health parameter.
[0082] In some embodiments, selecting the first CDN node from each CDN node through a load balancing algorithm includes: obtaining information on the media streams cached by each CDN node, and selecting the first CDN node from the CDN nodes that cache the media stream requested by the user terminal.
[0083] In some embodiments, the user terminal sends a media stream request; the load balancer receives the media stream request and selects the first CDN node from each CDN node through a load balancing algorithm; the load balancer forwards the media stream request to the first CDN node; the first CDN node returns a media stream address to the user terminal, and the media stream address points to the media stream requested by the user terminal stored on the first CDN node; wherein, the media stream requested by the user terminal stored on the first CDN node is sent by the source server to the first CDN node and stored on the first CDN node; the user terminal obtains the media stream from the first CDN node through the media stream address.
[0084] In some embodiments, during the process of the user terminal obtaining the media stream through the media stream address, it further includes: detecting the network transmission status of the media stream; when the transmission status is lower than a threshold, optimizing the network transmission of the media stream using at least one of the following methods: TCP / UDP hybrid transmission, packet loss recovery, network jitter compensation. Among them, network detection can be performed by the user terminal or the CDN node.
[0085] In some embodiments, it further includes: selecting a second CDN node from each CDN node, and also forwarding the media stream request to the second CDN node, so that the second CDN node serves as a backup CDN node. When an abnormality occurs during the distribution process of the first CDN node providing the media stream to the user terminal, the second CDN node is switched to continue providing the distribution of the media stream to the user terminal. For example, both the first CDN node and the second CDN node send the pointing addresses corresponding to the media stream to the user terminal. When an abnormality occurs in obtaining the media stream (such as network delay, congestion, disconnection, etc. during the media stream transmission with the first CDN) during the process of the user terminal obtaining the media stream using the address provided by the first CDN node, the user terminal can switch to the media stream address provided by the second CDN to continue obtaining the media stream.
[0086] In some embodiments, the second CDN node may be selected synchronously when selecting the first CDN node. The second CDN node may be a node inferior to the first CDN node. For example, the first CDN node is the optimal node calculated based on the above load balancing algorithm strategy, and the second CDN node is the sub-optimal node.
[0087] S30: Forward the media stream request to the first CDN node so that the first CDN node provides the distribution of the media stream to the user terminal.
[0088] In some embodiments, before determining the content distribution server, preprocess the media stream content provided by the source server. The preprocessing includes at least one of the following: transcoding, compression, encryption. The preprocessing may also include format conversion, adding an index, denoising, color correction, noise reduction echo cancellation, etc.
[0089] In some embodiments, use the title, description, identification identifier, cover image, duration, etc. of the media stream as metadata and store it in a database or metadata management system in the cloud; the user's terminal device obtains the metadata through the database or metadata management system in the cloud. Among them, the metadata can be queried and retrieved in subsequent request sessions, and can also be used for processing such as annotating the media stream content during the distribution process.
[0090] In some embodiments, after determining the CDN node where the content distribution server is located, the media stream content is transmitted from the source server and cached in the local server of the node where the content distribution server is located.
[0091] In some embodiments, in subsequent requests, preferentially access the cached content and monitor the cache hit rate or user access frequency; according to the cache hit rate or user access frequency, remove the least frequently used cached content. Among them, cache optimization strategies such as the FIFO (First In First Out) strategy and the TTL (Time To Live) strategy can also be selected according to other parameters such as data consistency and cache space.
[0092] In some embodiments, when performing real-time transmission, it includes: using the Real-Time Transport Protocol for the real-time transmission. The Real-Time Transport Protocol may include at least one of protocols such as RTMP, SIP, RTSP, etc.; obtain the current delay, packet loss rate, or jitter parameter. If the parameter exceeds the threshold, use optimization techniques for the real-time transmission. The optimization techniques include at least one of optimization techniques such as TCP / UDP hybrid transmission, intelligent packet loss recovery, and network jitter compensation; during the real-time transmission process, monitor parameters such as delay, packet loss rate, and jitter parameter. If the parameter exceeds the threshold, use optimization techniques for real-time transmission.
[0093] The second embodiment of the present application provides a media stream distribution method. The following will be described with reference to Figure 2a the flowchart shown. The method provided by this second embodiment includes the following steps S200 - S240.
[0094] S200: Preprocess the media source content.
[0095] In the embodiment of the present application, the media source takes the user terminal registered on the cloud platform and its webcam as an example. For example, in a network live broadcast request, the audio - video source provided by the webcam will first be preprocessed such as transcoding, compression, and encryption.
[0096] Meanwhile, the metadata of the media stream to be transmitted to the CDN node, such as title, description, identification mark, cover image, duration, etc., is stored in the cloud database or metadata management system for subsequent content retrieval and distribution.
[0097] S210: The user initiates a media stream request, and the load balancer selects a suitable CDN node according to the load - balancing algorithm to forward the request.
[0098] The user initiates a media stream request to the load balancer deployed on the cloud server through the terminal.
[0099] The load balancer selects a suitable CDN node according to factors such as the current overall node load and network latency to forward the request. As Figure 2b shown, the load - balancing algorithm provides three allocation mechanisms: namely, the nearest - neighbor allocation mechanism, the least - connection mechanism, and the health - check mechanism.
[0100] In specific implementation, first, according to the nearest - neighbor allocation mechanism, the load balancer obtains the IP network segment of the user terminal, and then takes several CDN nodes in the same network segment as candidate nodes.
[0101] Then, according to the least - connection mechanism, the load balancer selects candidate CDN nodes with the current connection number lower than a threshold for further screening.
[0102] Finally, through the health - check mechanism, the health status of the content distribution server on the candidate CDN node, such as the network connection status, is checked, and the node where the healthy content distribution server is located among the candidate CDN nodes is selected and assigned to the user terminal.
[0103] After selecting a suitable CDN node, the load balancer forwards the media stream request of the user terminal to its content distribution server, where information such as the user's IP address can be included for subsequent streaming.
[0104] S220: The content distribution server on the CDN node detects the network environment and decides whether to enable transmission optimization.
[0105] After receiving the request, the content distribution server starts to detect whether the network environment is smooth, as Figure 2b shown. If the network environment is good, such as low network latency, transmission optimization is not enabled; if the network environment is poor, such as high network latency, transmission optimization needs to be enabled.
[0106] The so-called transmission optimization means that during the real-time transmission process, optimization technologies such as TCP / UDP hybrid transmission, intelligent packet loss recovery, and network jitter compensation can be adopted to improve the transmission efficiency and quality.
[0107] S230: The source server sends the media stream content to the CDN node and caches it on the CDN node.
[0108] At this time, the source server can send the media stream content to the CDN node. After reaching the CDN node, through a certain caching strategy, the media stream content is synchronously stored in the local server to reduce the request pressure on the source server and improve the content distribution speed.
[0109] Among them, the caching strategy mainly refers to the caching optimization strategy, that is, by monitoring and analyzing data such as the cache hit rate and user access behavior on the CDN node, the cached content is optimized.
[0110] In the specific implementation process, for example, when the source server sends the media stream content to the CDN node for the first time, the media stream content is cached in the local server of the CDN node (as Figure 2c shown). When a second user terminal requests to obtain the media stream content of the source server, this part of the content can be directly obtained from the local server of the CDN node. When multiple users make requests subsequently, the CDN node will record the number of times each cached content is requested. When the cache is about to reach the upper limit, the least frequently used cached content is removed to improve the cache utilization rate and distribution efficiency.
[0111] S240: The content distribution server transmits the media stream content to the user terminal in real time.
[0112] Finally, during the process of the content distribution server transmitting the media stream content to the user terminal in real time, real-time transport protocols such as RTMP, SIP, and RTSP are used for media stream transmission, and these real-time transport protocols can ensure the real-time nature and integrity of audio and video data.
[0113] According to the result of whether to enable transmission optimization in step S220, corresponding transmission optimization methods are adopted for transmission.
[0114] In addition, during the transmission process, it is also necessary to monitor the transmission quality, such as monitoring parameters like latency, packet loss rate, and jitter, in order to promptly detect and handle potential problems. For example, when the latency is too high, there may be a problem with the content distribution server of a node. After the monitoring reports an error, the node can be replaced in a timely manner to ensure that users obtain a high-quality audio and video experience.
[0115] The third embodiment of the present application provides a media stream distribution device, which can be used to implement the media stream distribution method in the above embodiment, such as Figure 3 As shown, the media stream distribution device includes:
[0116] A receiving module, configured to receive a media stream request from a user terminal; specifically, the receiving module can be used to implement step S10 and its optional embodiments in the first embodiment.
[0117] A scheduling module, configured to select a first CDN node from each CDN node through a load balancing algorithm; specifically, the scheduling module can be used to implement step S20 and its optional embodiments in the first embodiment.
[0118] A sending module, which forwards the media stream request to the first CDN node, so that the first CDN node provides the distribution of the media stream to the user terminal. Specifically, the sending module can be used to implement step S30 and its optional embodiments in the first embodiment.
[0119] The fourth embodiment of the present application provides a media stream distribution system, which can be used to implement the media stream distribution method in the above embodiment, such as Figure 4 As shown, the media stream distribution system includes:
[0120] A user terminal, configured to send a media stream request;
[0121] Multiple CDN nodes, each storing the media stream requested by the user terminal;
[0122] A load balancer, configured to receive the media stream request, select a first CDN node from the multiple CDN nodes through a load balancing algorithm, and forward the media stream request to the first CDN node;
[0123] The first CDN node is configured to return a media stream address to the user terminal, and the media stream address points to the media stream requested by the user terminal stored on the first CDN node;
[0124] The user terminal is further configured to obtain the media stream from the first CDN node through the media stream address.
[0125] Figure 5FIG. 0 is a structural schematic diagram of a computing device 900 provided by an embodiment of the present application. The computing device may execute various optional embodiments of the above method. The computing device may be a terminal, or a chip or a chip system inside the terminal. As Figure 5 shown, the computing device 900 includes: a processor 910, a memory 920, and a communication interface 930.
[0126] It should be understood that Figure 5 the communication interface 930 in the computing device 900 shown in FIG. may be used for communication with other devices, and may specifically include one or more transceiver circuits or interface circuits.
[0127] Among them, the processor 910 may be connected to the memory 920. The memory 920 may be used to store the program code and data. Therefore, the memory 920 may be an internal storage unit of the processor 910, or an external storage unit independent of the processor 910, or a component including an internal storage unit of the processor 910 and an external storage unit independent of the processor 910.
[0128] Optionally, the computing device 900 may further include a bus. Among them, the memory 920 and the communication interface 930 may be connected to the processor 910 through the bus. The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 5 a line without an arrow is used in FIG., but it does not mean that there is only one bus or one type of bus.
[0129] It should be understood that in the embodiment of the present application, the processor 910 may adopt a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Or the processor 910 adopts one or more integrated circuits to execute related programs to implement the technical solutions provided by the embodiments of the present application.
[0130] The memory 920 may include a read-only memory and a random access memory, and provide instructions and data to the processor 910. A part of the processor 910 may also include a non-volatile random access memory. For example, the processor 910 may also store information about the device type.
[0131] When the computing device 900 is running, the processor 910 executes the computer-executable instructions in the memory 920 to perform any of the operation steps of the above method and any optional embodiments thereof.
[0132] It should be understood that the computing device 900 according to the embodiments of the present application may correspond to the corresponding subject executing the methods according to the embodiments of the present application, and the above and other operations and / or functions of each module in the computing device 900 are respectively for implementing the corresponding processes of the methods of the present embodiments. For the sake of brevity, they will not be described in detail here.
[0133] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0134] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be described in detail here.
[0135] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0136] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0137] In addition, in each embodiment of the present application, each functional unit can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0138] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, and other various media that can store program codes.
[0139] The embodiments of the present application also provide a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it is used to execute the above method, and the method includes at least one of the solutions described in the above various embodiments.
[0140] The computer storage medium of the embodiments of the present application can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or combined with an instruction execution system, apparatus, or device.
[0141] A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0142] The program code contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0143] The computer program code for performing the operations of this application may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0144] In addition, the terms "first," "second," "third," etc. or terms such as module A, module B, module C, etc. in the specification and claims are only used to distinguish similar objects and do not represent a specific order for the objects. Understandably, the specific order or sequence may be interchanged under allowed circumstances so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0145] In the above description, the reference numerals representing steps, such as S110, S120, etc., do not necessarily indicate that the steps will be executed in this order. Under allowed circumstances, the order of the steps before and after may be interchanged, or the steps may be executed simultaneously.
[0146] The term "comprising" as used in the specification and claims should not be construed as limited to the content listed thereafter; it does not exclude other elements or steps. Thus, it should be interpreted as specifying the presence of the stated features, integers, steps or components but not excluding the presence or addition of one or more other features, integers, steps or components and groups thereof. Thus, the expression "a device comprising devices A and B" should not be limited to a device consisting only of components A and B.
[0147] As used herein, the phrase "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrase "in one embodiment" or "in an embodiment" in various places in this specification are not necessarily all referring to the same embodiment, but may. Furthermore, in one or more embodiments, the various particular features, structures, or characteristics may be combined in any suitable manner, as will be apparent to those of ordinary skill in the art from the present disclosure.
[0148] Note that the above are only the preferred embodiments of the present application and the technical principles applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments, and without departing from the concept of the present application, more other equivalent embodiments may be included, all of which fall within the protection scope of the present application.
Claims
1. A media stream distribution method, characterized in that: include: Receiving a media stream request from a user terminal; Selecting a first CDN node from each CDN node through a load balancing algorithm; The media stream request is forwarded to the first CDN node, so that the first CDN node provides distribution of the media stream to the user terminal.
2. The method according to claim 1, characterized in that The selecting the first CDN node from the CDN nodes by using a load balancing algorithm includes at least one of the following: Parsing the user terminal IP address from the media stream request, and selecting the first CDN node from CDN nodes in the same network segment as the user terminal IP address among the CDN nodes; Obtaining the number of connections of each CDN node, and selecting the first CDN node from CDN nodes whose number of connections is lower than a set value; The health status of each CDN node is obtained, and the first CDN node is selected from the CDN nodes with normal health status.
3. The method according to claim 1 or 2, characterized in that: The selecting the first CDN node from each CDN node by using a load balancing algorithm includes: Parsing the user terminal IP address from the media stream request, and selecting a CDN node in the same network segment as the user terminal IP address from each CDN node; For the selected CDN nodes in the same network segment as the IP address of the user terminal, obtain the number of connections of each CDN node, and select the CDN node whose number of connections is lower than the set value; For the selected CDN nodes whose number of connections is lower than a set value, the health status of each CDN node is obtained, and the first CDN node is selected from the CDN nodes with normal health status.
4. The method according to claim 1 or 2, characterized in that: The selecting the first CDN node from each CDN node by using a load balancing algorithm includes: The first CDN node is selected according to at least one of the following three parameters: a distance between the CDN node and the user terminal, a health value calculated by a health status of the CDN node, and a connection value calculated by a number of CDN node connections.
5. The method according to claim 1, characterized in that The selecting the first CDN node from each CDN node by using a load balancing algorithm includes: Information about media streams cached by each CDN node is obtained, and the first CDN node is selected from CDN nodes that cache the media stream requested by the user terminal.
6. A media stream distribution method, characterized in that: include: The user terminal sends a media stream request; The load balancer receives the media stream request and selects a first CDN node from each CDN node through a load balancing algorithm; The load balancer forwards the media stream request to the first CDN node; The first CDN node returns a media stream address to the user terminal, where the media stream address points to the media stream requested by the user terminal stored on the first CDN node; wherein the media stream requested by the user terminal stored on the first CDN node is sent by the source server to the first CDN node and stored on the first CDN node; The user terminal obtains the media stream from the first CDN node through the media stream address.
7. The method according to claim 6, characterized in that The process in which the user terminal obtains the media stream through the media stream address also includes: Detecting a network transmission status of the media stream; When the transmission state is lower than a threshold, the network transmission of the media stream is optimized using at least one of the following methods: TCP / UDP mixed transmission, packet loss recovery, and network jitter compensation.
8. A media stream distribution device, characterized in that: include: A receiving module, used for receiving a media stream request from a user terminal; A scheduling module, used to select a first CDN node from each CDN node through a load balancing algorithm; The sending module forwards the media stream request to the first CDN node, so that the first CDN node provides distribution of the media stream to the user terminal.
9. A media stream distribution system, characterized in that: include: A user terminal is used to send a media stream request; Multiple CDN nodes, each storing a media stream requested by a user terminal; A load balancer, configured to receive the media stream request, select a first CDN node from the multiple CDN nodes through a load balancing algorithm, and forward the media stream request to the first CDN node; The first CDN node is used to return a media stream address to the user terminal, where the media stream address points to the media stream requested by the user terminal and stored on the first CDN node; The user terminal is further configured to obtain the media stream from the first CDN node through the media stream address.
10. The system according to claim 9, characterized in that Also includes at least one of the following: The media stream server is used to send the media streams on it to each CDN node; A metadata management server, configured to store metadata of the media stream, wherein the metadata includes an identifier of the media stream; The user terminal is further configured to obtain an identifier of a media stream by accessing the metadata management server, so as to carry the identifier of the media stream when sending the media stream request.