Media data generation method, device, computer equipment and storage medium
By obtaining the parameters of the content distribution node and the fountain code encoding node, determining the number of shards and generating media data, the problem of low media data generation efficiency in the prior art is solved, and network performance and user experience are improved.
Patent Information
- Application Number
- CN202410255318.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-06
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-03-06
AI Technical Summary
In the existing media data generation process, using only cdn large nodes or fec small nodes will lead to network congestion, increased delay, failure risk and data transmission reliability, resulting in a decrease in media data generation efficiency and affecting user experience.
By obtaining the parameters of the content distribution node and the fountain code encoding node, determine the number of shards pulled from each node, combine the scheduler to obtain the source file and the fountain code encoding file, generate and play the target media data, and make full use of the capabilities of the two nodes To improve efficiency.
It improves the efficiency of media data generation, reduces network burden and delay, and enhances the reliability and user experience of data transmission.
Smart Images

Figure CN118075560B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, apparatus, computer device and storage medium for generating media data. Background Art
[0002] The full name of PCDN is "Peer Content Delivery Network". PCDN is a network architecture that uses peer-to-peer (P2P) technology to provide efficient content distribution and transmission services. PCDN can be used in various application scenarios, such as media data generation, software updates, online games, etc.
[0003] The existing media data generation process usually generates media data based on data sent by large CDN nodes or small FEC nodes in PCDN; using only large CDN nodes will lead to network congestion, increased latency, failure risk and reduced data transmission reliability to a certain extent; using only small FEC nodes will lead to increased network burden, increased latency, limited reliability and single point failure risk to a certain extent; therefore, using only large CDN nodes or small FEC nodes for media data generation is likely to reduce the efficiency of data transmission and thus reduce the efficiency of media data generation, affecting user experience.
[0004] Therefore, how to improve the efficiency of media data generation to enhance user experience is an issue that needs to be addressed urgently. Summary of the invention
[0005] The embodiments of the present application provide a method, apparatus, computer device and storage medium for generating media data, which can improve the efficiency of generating media data and thus enhance the user experience.
[0006] In a first aspect, an embodiment of the present application provides a method for generating media data, the method comprising:
[0007] In response to a play event, obtaining a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to the target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node;
[0008] Determine the number of first shards to be pulled from the first node according to the first node parameter and the shard information of the target media data, and determine the number of second shards to be pulled by the second node according to the second node parameter and the shard information of the target media data;
[0009] Acquire the source files of the first number of shards from the first node, and acquire the fountain code encoded files of the second number of shards from the second node;
[0010] Based on the source file and the fountain code encoding file, the target media data is generated and played. In a second aspect, an embodiment of the present application provides a media data generation device including:
[0011] an acquisition unit, configured to respond to a playback event and acquire a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to the target media data to be played, wherein the large node is a content distribution node and the small node is a fountain code encoding node;
[0012] a determining unit, configured to determine the number of first fragments to be pulled from the first node according to the first node parameter and the fragment information of the target media data, and to determine the number of second fragments to be pulled by the second node according to the second node parameter and the fragment information of the target media data;
[0013] an acquisition unit, configured to acquire the source files of the first number of shards from the first node through a scheduler, and acquire the fountain code encoded files of the second number of shards from the first node;
[0014] A generating unit is used to generate and play the target media data based on the source file and the fountain code encoding file.
[0015] In a third aspect, an embodiment of the present application further provides a computer device, which is configured with a processor and a memory, and the memory stores multiple computer programs; the processor loads the computer program from the memory to execute the steps of any media data generation method provided in the embodiment of the present application.
[0016] In a fourth aspect, an embodiment of the present application further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores multiple computer programs, and the computer programs are suitable for loading by a processor to execute the steps of any media data generation method provided in the embodiment of the present application.
[0017] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program or a computer program, which, when executed by a processor, implements the steps of any one of the media data generation methods provided in the embodiments of the present application.
[0018] Adopting the scheme of the application embodiment, in response to the playback event, obtain the first node parameter of the first node and the second node parameter of the second node of the content distribution network corresponding to the target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node; according to the first node parameter and the fragmentation information of the target media data, determine the number of first fragments pulled from the first node, and according to the second node parameter and the fragmentation information of the target media data, determine the number of second fragments pulled by the second node; obtain the source files of the first number of fragments from the first node through the scheduler, and obtain the fountain code encoding files of the second number of fragments from the second node; based on the source files and the fountain code encoding files, generate and play the target media data. By generating media data through the source files sent by the first node and the fountain code encoding files sent by the second node, the capacity of each node can be maximized when the two nodes are used, and the efficiency of the node sending files can be improved, thereby improving the efficiency of media data generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 This is a schematic diagram of the flow chart of the first embodiment of the media data generation method provided by the present application;
[0021] Figure 2 It is a flowchart of a second embodiment of the media data generation method provided by the present application;
[0022] Figure 3 It is a schematic flow chart of a third embodiment of the media data generation method provided by the present application;
[0023] Figure 4 It is a flowchart of a fourth embodiment of the media data generation method provided by the present application;
[0024] Figure 5 It is a flowchart of an embodiment of the interaction between a computer device, a node and a server of the media data generation method provided by the present application;
[0025] Figure 6 is a structural schematic diagram of a media data generating device provided in an embodiment of the present application;
[0026] Figure 7 It is a structural diagram of the media data generation system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0028] Embodiments of the present application provide a method, apparatus, computer device, and storage medium for generating media data.
[0029] Specifically, the embodiments of the present application will be described from the perspective of a computer device, which may include a smart phone, a smart computer, a smart terminal and other devices, that is, the media data generation method of the embodiments of the present application can be executed by a computer device.
[0030] The following is a detailed description in conjunction with the accompanying drawings. In the embodiments of the present application, the execution subject is a computer device as an example. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.
[0031] Please refer to Figure 1 The specific process of an embodiment of the media data generation method includes the following steps:
[0032] Step 101, in response to a play event, obtaining a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node;
[0033] Step 102: determining the number of first shards to be pulled from the first node according to the first node parameter and the shard information of the target media data, and determining the number of second shards to be pulled from the second node according to the second node parameter and the shard information of the target media data;
[0034] Step 103: Acquire the source files of the first number of shards from the first node, and acquire the fountain code encoded files of the second number of shards from the second node;
[0035] Step 104: Generate and play the target media data based on the source file and the fountain code encoding file.
[0036] In this embodiment, the computer device is a device (client device) such as a smart phone and a smart computer used by a user. When the user browses media data using the computer device, the computer device responds to the user's on-demand operation of a certain media data, determines the playback event, determines the media data as the target media data to be played, and obtains the first node parameter of the first node and the second node parameter of the second node in the content distribution network corresponding to the target media data to be played, wherein the first node is a content distribution node, the first node stores the source file corresponding to the target media data to be played, and the second node is a fountain code encoding node, the second node stores the fountain code encoding file corresponding to the target media data to be played; the computer device determines the number of first fragments to be pulled from the first node according to the first node parameter and the fragment information of the target media data, and determines the number of second fragments to be pulled from the second node according to the second node parameter and the fragment information of the target media data. The computer device obtains the source files of the first number of fragments from the first node through the scheduler, and obtains the fountain code encoding files of the second number of fragments from the second node, and generates and plays the target media data based on the source files and the fountain code encoding files.
[0037] It should be noted that, in the process of deploying the media data to the first node and the second node in the content distribution network, the server corresponding to the content distribution network blocks the source file of the media data to obtain multiple data blocks, and slices each data block to obtain multiple data slices, and then pulls the data slice corresponding to each data block through the first node in the content distribution network for storage. Optionally, the data slice corresponding to each data block can be stored in multiple different first nodes respectively. Optionally, one first node can store data slices corresponding to multiple data blocks; the server corresponding to the content distribution network blocks the media data to obtain multiple data blocks, and slices each data block to obtain multiple data slices, and then performs fountain code encoding on each data slice to obtain a fountain code encoding file corresponding to the media data, and then pulls the fountain code encoding file of the data slice corresponding to each data block through the second node in the content distribution network for storage. Optionally, the fountain code encoding file of the data slice corresponding to each data block can be stored in multiple different second nodes respectively. Optionally, one second node can store fountain code encoding files of data slices corresponding to multiple data blocks.
[0038] The computer device of this embodiment responds to the play event, obtains the first node parameter of the first node and the second node parameter of the second node of the content distribution network corresponding to the target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node; determines the number of first fragments pulled from the first node according to the first node parameter and the fragment information of the target media data, and determines the number of second fragments pulled from the second node according to the second node parameter and the fragment information of the target media data; obtains the source files of the first number of fragments from the first node through the scheduler, and obtains the fountain code encoding files of the second number of fragments from the second node; generates and plays the target media data based on the source files and the fountain code encoding files. By generating media data through the source files sent by the first node and the fountain code encoding files sent by the second node, the capacity of each node can be maximized when the two nodes are used, and the efficiency of the node sending files can be improved, thereby improving the efficiency of media data generation.
[0039] Specifically, each step is described in detail below:
[0040] Step 101, in response to a play event, obtaining a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node;
[0041] In this step, when the user uses a computer device to browse media data, the computer device responds to the user's on-demand operation on a certain media data, determines the playback event, determines the media data as the target media data to be played, and obtains the first node parameter of the first node and the second node parameter of the second node in the content distribution network corresponding to the target media data to be played; wherein the media data can be pictures, videos, articles, etc.
[0042] In one embodiment, a first node storing a source file of target media data to be played in a content distribution network and a second node storing a fountain code encoded file of target media data to be played both carry data identifiers corresponding to the target media data. After determining the target media data to be played, the computer device can determine which first nodes and second nodes store the target media data based on the data identifiers carried by the first nodes and the second nodes in the content distribution network, and then obtain first node parameters of these first nodes and second node parameters of these second nodes.
[0043] In one embodiment, the computer device stores in advance the first node identifier and the second node identifier corresponding to different media data. After determining the target media data to be played, the computer device queries the first node identifier and the second node identifier corresponding to the target media data stored in itself, and then sends a parameter acquisition instruction to the corresponding first node according to the first node identifier to obtain the first node parameter, and sends a parameter acquisition instruction to the corresponding second node according to the second node identifier to obtain the second node parameter. It can be understood that the first node identifier and the second node identifier corresponding to different media data stored in advance in the computer device will be dynamically updated, and the dynamic update is realized through the real-time interaction between the computer device and the server corresponding to the content distribution network, and no user operation is required. For example: when the first node or the second node corresponding to a certain media data is increased, the computer device will increase the storage of the newly added first node identifier or the second node identifier corresponding to the media data; when new media data is stored in the first node and the second node in the content distribution network, the computer device will increase the storage of the first node identifier or the second node identifier corresponding to the new media data.
[0044] Step 102: determining the number of first fragments to be pulled from the first node according to the first node parameter and the fragment information of the target media data, and determining the number of second fragments to be pulled from the second node according to the second node parameter and the fragment information of the target media data;
[0045] In this step, the computer device determines the number of first fragments to be pulled from the first node according to the first node parameter and the fragment information of the target media data, and determines the number of second fragments to be pulled from the second node according to the second node parameter and the fragment information of the target media data. It should be noted that the first fragment number is the number of fragments in a data block in the target media data pulled from the first node by the computer device, and the second fragment number is the number of fragments in a data block in the fountain code encoding file corresponding to the target media data pulled from the first node by the computer device.
[0046] In one embodiment, the parameter types included in the first node parameter and the second node parameter are the same, including: data processing speed, network bandwidth and network delay; the fragmentation information of the target media data includes the total number of fragments of the data block of the target media data and the data volume of each fragment. The computer device includes a pre-created calculation model, and the calculation model can output the first number of fragments corresponding to the first node and the second number of fragments corresponding to the second node; after obtaining the first node parameters corresponding to each first node in the content distribution network, the computer device can determine the data processing speed, network bandwidth and network delay corresponding to each first node, and then calculate the average data processing speed based on the data processing speed corresponding to each first node, calculate the average network bandwidth based on the network bandwidth corresponding to each first node, and calculate the average network delay based on the network delay corresponding to each first node, and then input the average data processing speed, average network bandwidth and average network delay corresponding to the first node, as well as the total number of fragments of the data block of the target media data and the data volume of each fragment in the fragmentation information of the target media data into the pre-created calculation model, and the calculation model can output the first number of fragments corresponding to the first node. Similarly, the process of determining the number of second shards corresponding to the second node is the same as the process of determining the number of first shards corresponding to the first node mentioned above, and will not be repeated here.
[0047] In one embodiment, the parameter types included in the first node parameter and the second node parameter are the same, including: node capabilities and network conditions; the sharding information of the target media data includes the total number of shards of the data block of the target media data and the amount of data in each shard. The computer device allocates the first number of shards and the second number of shards to the first node and the second node according to the capabilities and network conditions of the first node and the second node, combined with the sharding information of the target media data. Among them, the method for allocating the first number of shards and the second number of shards to the first node and the second node includes: 1. Based on bandwidth and storage capacity: according to the bandwidth and storage capacity of the server node, determine the number of data slices that the server node can process and store under the current network conditions. Considering the processor performance and the number of concurrent connections of the server node, the number of data slices is dynamically adjusted in combination with the network conditions. 2. Load balancing strategy: Use a load balancing algorithm to distribute data to multiple server nodes, and dynamically adjust the number of data slices according to the load conditions of each node to achieve load balancing and improve overall performance. 3. Prediction algorithm: Based on the prediction of historical data and network conditions, the prediction algorithm is used to estimate the future load conditions and network conditions of the server node, so as to determine the appropriate number of data slices. No limitation is made here.
[0048] Step 103: Acquire the source files of the first number of shards from the first node, and acquire the fountain code encoded files of the second number of shards from the second node;
[0049] In this step, the computer device obtains the source file of the first number of shards from the first node through the scheduler, and obtains the fountain code encoded file of the second number of shards from the second node; it can be understood that the first node can be one or more, and the computer device obtains the source file of the first number of shards from each first node through the scheduler, and the second node can be one or more, and the computer device obtains the fountain code encoded file of the second number of shards from each second node through the scheduler.
[0050] In one embodiment, for each data block of the target media data, there is one corresponding first node and multiple second nodes. The computer device obtains a source file of a first number of fragments from the first node through a scheduler, and obtains a fountain code encoded file of a second number of fragments from each second node.
[0051] Step 104: Generate and play the target media data based on the source file and the fountain code encoding file.
[0052] In this step, for each data block of the target media data, the computer device obtains a source file of a first number of fragments from the first node, obtains a fountain code encoding file of a second number of fragments from the second node, decodes the obtained fountain code encoding file to obtain a decoded file, and then combines the decoded file and the source file to generate data of the corresponding data block; the computer device merges the data of all the generated data blocks to generate and play the target media data.
[0053] The computer device of this embodiment generates media data through the source file sent by the first node and the fountain code encoding file sent by the second node. The capacity of each node can be maximized when the two nodes are used, the efficiency of the node sending files can be improved, and the efficiency of media data generation can be improved.
[0054] Specifically, please refer to Figure 2 , determining the number of first fragments to be pulled from the first node according to the first node parameter and the fragment information of the target media data, comprises:
[0055] Step 1021, determining the total number of fragments of the data block of the target media data and the data volume of each fragment according to the fragment information of the target media data;
[0056] In this step, the computer device determines the total number of fragments of the data block of the target media data and the data volume of the fragments according to the fragment information of the target media data. It can be understood that the fragment information of the target media data records the number of data blocks into which the target media data is divided, the total number of fragments into which each data block is divided, and the amount of data contained in each fragment. Usually, the amount of data contained in each data block of the target media data is the same, the total number of fragments into which each data block is divided is the same, and the amount of data contained in each fragment is also the same. The computer device only needs to determine the total number of fragments and the data volume of any one data block.
[0057] Step 1022, determining the data processing time of the first node according to the data volume of each of the shards and the data processing speed in the first node parameters;
[0058] In this step, after obtaining the first node parameters, the computer device obtains the CPU utilization, memory occupancy, disk IO and other indicators in the first node parameters, determines the data processing speed of the first node according to the CPU utilization, memory occupancy, disk IO and other indicators, and then determines the data processing time of the first node according to the data volume and data processing speed of the shards; wherein, the transmission rate, bandwidth utilization and other indicators of the network interface in the first node parameters are obtained, and the network bandwidth of the first node is determined according to the transmission rate, bandwidth utilization and other indicators of the network interface; the packet loss rate, bandwidth utilization and other indicators in the first node parameters are obtained to determine the network delay of the first node.
[0059] In one embodiment, the computer device randomly selects a first node from all the first nodes, and determines the data processing speed, network bandwidth, and network delay of the first node according to the first node parameters of the first node.
[0060] In one embodiment, the computer device determines the data processing speed, network bandwidth and network delay of each first node based on the first node parameters of each first node, and then calculates the average data processing speed, average network bandwidth and average network delay accordingly, and determines the average data processing speed, average network bandwidth and average network delay as the data processing speed, network bandwidth and network delay of the first node respectively.
[0061] In one embodiment, the formula for calculating the data processing time of the first node is: T1=D / S, where T1 is the data processing time of the first node, D is the data volume of the shard, and S is the data processing speed.
[0062] Step 1023, determining the data transmission time of the first node according to the data volume of the shard, the network bandwidth in the first node parameters, and the network delay in the first node parameters;
[0063] In this step, the computer device determines the data transmission time of the first node based on the data volume of the shard, the network bandwidth in the first node parameters, and the network delay in the first node parameters. Specifically, the formula for calculating the data transmission time of the first node is: T2=D / B+L, wherein T1 is the data processing time of the first node, D is the data volume of the shard, B is the network bandwidth in the first node parameters, and L is the network delay in the first node parameters.
[0064] Step 1024: Determine the number of first shards to be pulled from the first node based on the data processing time, the data transmission time, the data processing speed, and the total number of shards of the data block.
[0065] Specifically, step 1024 includes:
[0066] Step 10241: if the data processing time is greater than the data transmission time, determining the number of first shards to be pulled from the first node according to the data processing time, the data processing speed, and the total number of shards of the data block;
[0067] In this step, after determining the data transmission time of the first node and the data processing time of the first node, the computer device compares the data transmission time of the first node and the data processing time of the first node. If the data processing time of the first node is greater than the data transmission time of the first node, the number of first shards pulled from the first node is determined according to the data processing time of the first node, the data processing speed and the total number of shards of the data block; specifically, the calculation formula for determining the number of first shards pulled from the first node according to the data processing time, the data processing speed and the total number of shards of the data block is: M=ceil(N / S*T1)=ceil(N / S*D / S)=ceil(N / D), wherein M is the number of first shards, ceil is the floor operator, D is the data volume of the shards, S is the data processing speed, and N is the total number of shards of the data block.
[0068] Step 10242: If the data transmission time is greater than the data processing time, determine the number of first shards to be pulled from the first node based on the data transmission time, the data processing speed and the total number of shards of the data block.
[0069] In this step, after determining the data transmission time of the first node and the data processing time of the first node, the computer device compares the data transmission time of the first node with the data processing time of the first node. If the data transmission time of the first node is greater than the data processing time of the first node, the number of first shards pulled from the first node is determined according to the data transmission time of the first node, the data processing speed and the total number of shards of the data block; specifically, according to the data transmission time, the data processing speed and the total number of shards of the data block, the calculation formula for determining the number of first shards pulled from the first node is: M=ceil(N / S*T2)=ceil(N / S*(D / B+L))=ceil(NB / (SD+SBL)), wherein M is the number of first shards, ceil is a floor operator, D is the data volume of the shards, S is the data processing speed, N is the total number of shards of the data block, B is the network bandwidth, and L is the network delay.
[0070] It should be noted that after comparing the data transmission time of the first node and the data processing time of the first node, if the data transmission time of the first node is the same as the data processing time of the first node, then any of the above methods can be used to determine the number of first shards pulled from the first node.
[0071] Among them, the specific steps of determining the number of second fragments pulled from the second node according to the second node parameters and the fragment information of the target media data are the same as steps 1021 to 1024, and will not be repeated here.
[0072] Specifically, please refer to Figure 3 , the step of obtaining the source file of the first number of shards from the first node, and obtaining the fountain code encoded file of the second number of shards from the second node, comprises:
[0073] Step 1031: Determine a first number of the first nodes and a second number of the second nodes according to the first node parameter, the second node parameter, the first number of shards, the second number of shards, and the total number of shards of the data block in the shard information;
[0074] In this step, after determining the first number of shards pulled from the first node and the second number of shards pulled from the second node, the computer device determines the first number of first nodes and the second number of second nodes based on the first node parameters, the second node parameters, the first number of shards, the second number of shards, and the total number of shards of the data block in the shard information.
[0075] Specifically, step 1031 includes:
[0076] Step 10311, calculating a first reference quantity and a second reference quantity according to the first node parameter and the second node parameter;
[0077] In this step, the computer device determines the first capacity value of the first node based on the first node parameter, and determines the second capacity value of the second node based on the second node parameter; and determines the first reference quantity and the second reference quantity according to the first capacity value, the second capacity value, the first shard quantity and the second shard quantity. It should be noted that the first reference quantity is the number of first nodes that may be used, and the second reference quantity is the number of second nodes that may be used; the first capacity value represents the capacity of the first node to process data, and the second capacity value represents the capacity of the second node to process data.
[0078] In one embodiment, the computer device inputs the first node parameters corresponding to each first node into a capability value evaluation model created in advance to calculate the first capability value of the first reference node, inputs the second node parameters corresponding to each second node into the created capability value evaluation model to calculate the second capability value of the second reference node, and then calculates the average capability value of the first reference node based on the first capability value of each first node and the total number of first nodes, and determines the average capability value as the first capability value of the first node, calculates the average capability value of the second reference node based on the second capability value of each second node and the total number of second nodes, and determines the average capability value as the second capability value of the second node.
[0079] Step 10312: Calculate the total number of reference slices according to the first reference number, the first number of slices, the second reference number, and the second number of slices.
[0080] In this step, the computer device calculates the total number of reference shards based on the first reference number, the first number of shards, the second reference number, and the second number of shards. Specifically, the formula for calculating the total number of reference shards is: N=n1*m1+n2*m2, where N is the total number of reference shards, n1 is the first reference number, m1 is the first number of shards, n2 is the second reference number, and m2 is the second number of shards.
[0081] Step 10313: Determine a first number of the first nodes and a second number of the second nodes based on the total number of reference shards, the number of data block shards, the first reference number, and the second reference number.
[0082] Specifically, step 10313 includes:
[0083] Step 103131: if the total number of reference shards is not less than the total number of shards of the data block in the shard information, determine the first reference number as a first number, and determine the second reference number as a second number;
[0084] In this step, after determining the total number of reference shards, the computer device compares the total number of reference shards with the total number of shards of the data blocks in the shard information. If the total number of reference shards is not less than the total number of shards of the data blocks in the shard information, the first reference quantity is determined as the first quantity, and the second reference quantity is determined as the second quantity. It can be understood that if the total number of reference shards is not less than the total number of shards of the data blocks in the shard information, the number of shards of the file subsequently obtained by the computer device from the first node and the second node will be greater than the total number of shards of the data blocks, which can ensure that the computer device can decode and restore the data blocks of the target media data based on the files obtained from the first node and the second node, and then restore the target media data.
[0085] Step 103132: if the total number of reference shards is less than the number of data block shards, then calculate the difference between the total number of reference shards and the number of data block shards;
[0086] In this step, the computer device compares the total number of reference shards with the total number of shards of the data block in the shard information. If the total number of reference shards is less than the total number of shards of the data block in the shard information, the difference between the total number of reference shards and the number of data block shards is calculated.
[0087] Step 103133: adjust the first reference number and / or the second reference number according to the difference until the total number of reference shards is not less than the total number of shards of the data block, and determine the first number of the first nodes and the second number of the second nodes.
[0088] In this step, the computer device adjusts the first reference number and / or the second reference number according to the difference until the total number of reference shards is not less than the total number of shards of the data block, and determines the first number of first nodes and the second number of second nodes.
[0089] In one embodiment, assuming that the total number of shards of a data block is 8, the total number of reference shards is 5, the first number of shards is 4, and the second number of shards is 1. At this time, the total number of reference shards is less than the total number of shards of the data block, and the difference between the total number of reference shards and the total number of shards of the data block is calculated to be 3; at this time, the computer device compares the difference with the first number of shards, and determines that the difference is less than the first number of shards, then increases the second reference number of the second node so that the total number of reference shards reaches 8; at this time, it can be determined that the first number of the first node is 1, and the second number of the second node is 4.
[0090] In one embodiment, assuming that the total number of shards of a data block is 10, the total number of reference shards is 5, the number of first shards is 4, and the number of second shards is 1. At this time, the total number of reference shards is less than the total number of shards of the data block, and the difference between the total number of reference shards and the total number of shards of the data block is calculated to be 5; at this time, the computer device compares the difference with the first number of shards and determines that the difference is greater than the first number of shards, then first increases the first reference number of the first node and adjusts the first reference number of the first node to 2. At this time, the total number of reference shards reaches 9, and then increases the second reference number of the second node and adjusts the second reference number of the second node to 2. At this time, the total number of reference shards reaches 10; at this time, it can be determined that the first number of the first node is 2 and the second number of the second node is 2.
[0091] In one embodiment, after determining the first number of the first node and the second number of the second node, the computer device adjusts the second number of the second node again according to the preset redundant number of the second node to obtain the final second number, such as: the redundant number of the second node is 4, the current second number of the second node is 3, and the final second number is 7. It should be noted that since the second node is a fountain code encoding node, its stability is usually poor, so by adding the redundant number, more second nodes can return the fountain code encoding file to avoid sudden failure of the second node, so that the number of pieces of the file obtained by the computer device from the first node and the second node will be less than the total number of pieces of the data block, resulting in the inability to restore the data block of the target media data, and then the inability to restore the target media data, thereby improving the stability of media data generation.
[0092] Step 1032: determining a first target node in the first nodes according to the device location, the first node parameter, and the first quantity, and determining a second target node in the second nodes according to the device location, the second node parameter, and the second quantity;
[0093] In this step, after determining the first quantity and the second quantity, the computer device calculates the distance between each first node and the computer device according to the device position and the first node position information in the first node parameters, and selects the first number of first nodes with the smallest distance among the first nodes to be determined as the first target nodes; similarly, according to the device position and the second node position information in the second node parameters, the distance between each second node and the computer device is calculated, and the second number of second nodes with the smallest distance among the second nodes are selected as the second target nodes.
[0094] Specifically, step 1032 includes:
[0095] Step 10321, obtaining the node position of each of the first nodes, and calculating the distance between each of the position information and the device position;
[0096] In this step, the computer device obtains the node position of each first node, and calculates the distance between each first node and the computer device according to the node position of each first node and the device position.
[0097] Step 10322, determining the first node whose distance is less than a preset distance threshold as a first candidate node;
[0098] In this step, the computer device compares the distance between each first node and the computer device with a preset distance threshold, and determines the first node whose distance is less than the preset distance threshold as the first candidate node. It can be understood that the first candidate node may include multiple nodes.
[0099] Step 10323: Determine the first target node among the first candidate nodes based on the first node parameter and the first quantity.
[0100] In this step, the computer device calculates the capability value corresponding to each first candidate node based on the first node parameter of each first candidate node, and sorts the first candidate nodes according to the capability value, and then selects the first candidate nodes with the largest capability value in the first number to be determined as the first target nodes according to the sorting result. For example, if the first number is 2, the first candidate nodes are sorted in descending order of capability value, and the first two first candidate nodes after sorting are selected to be determined as the first target nodes.
[0101] It should be noted that the process of determining the second target node is the same as the process of determining the first target node, which will not be repeated here.
[0102] Step 1033: Obtain source files of the first number of shards from each of the first target nodes, and obtain fountain code encoded files of the second number of shards from each of the second target nodes.
[0103] In this step, the computer device obtains the source file of the first number of shards from each first target node through the scheduler, and obtains the fountain code encoded file of the second number of shards from each second target node.
[0104] Specifically, before step 1033, the following steps are included:
[0105] Step a, sending a file acquisition instruction to the first node based on the first number of fragments, and receiving a source file with the first number of fragments sent by the first node, wherein the source file is a file with a length of the first number of fragments intercepted by the first node from a data block corresponding to the stored target media data;
[0106] In this step, the computer device generates a file acquisition instruction based on the first number of shards, sends the file acquisition instruction to the first target node, and receives the source file of the first number of shards issued by the first node. The source file is a file whose length is the first number of shards intercepted by the first node from the data block corresponding to the stored target media data. For example, the first number of shards is 4, and the total number of shards of the data block corresponding to the target media data stored in the first node is 6. After receiving the file acquisition instruction, the first node arbitrarily intercepts a shard of length 4 from the stored data block and sends it to the computer device as a source file. For example, the data block includes shards numbered 1, 2, 3, 4, 5, and 6, respectively. The first target node can intercept shards numbered 1, 2, 3, and 4, and can intercept shards numbered 2, 3, 4, and 5, etc., as source files.
[0107] Step b: sending a file acquisition instruction to the second node based on the second number of fragments, and receiving a fountain code encoding file of the second number of fragments issued by the second node, wherein the fountain code encoding file is an arbitrary file of the second number of fragments intercepted by the second node from the fountain code encoding data corresponding to the data block of the stored target media data.
[0108] In this step, the computer device generates a file acquisition instruction based on the second number of shards, sends the file acquisition instruction to the second node, and receives the fountain code encoding file of the second number of shards issued by the second target node. The fountain code encoding file is a file of the second number of shards intercepted by the second node from the data block corresponding to the fountain code encoding data of the stored target media data. For example, the second number of shards is 2, and the total number of shards of the data block corresponding to the fountain code encoding data of the target media data stored in the first node is 6. After receiving the file acquisition instruction, the second node arbitrarily obtains 2 shards from the stored data block and sends them to the computer device as the fountain code encoding file. For example, the data block includes shards numbered 1, 2, 3, 4, 5, and 6 respectively. The second target node can intercept shards numbered 1 and 2, and can intercept shards numbered 2 and 5, etc. as the fountain code encoding file.
[0109] The computer device of this embodiment generates each data block in the media data through the source file sent by the first node and the fountain code encoding file sent by the second node. The capacity of each node can be maximized when the two nodes are used, the efficiency of the node sending files can be improved, and the final media data generation efficiency can be improved.
[0110] Specifically, please refer to Figure 4 , the generating and playing the target media data based on the source file and the fountain code encoding file includes:
[0111] Step 1041, based on the source file, determining the missing file of the data block corresponding to the source file;
[0112] Step 1042, decoding the fountain code encoded file to obtain the missing file;
[0113] Step 1043, concatenating the source file with the missing file to generate a target data block;
[0114] Step 1044: splice all target data blocks to generate and play the target media data.
[0115] In this embodiment, each data block of the target media data will have a corresponding first node and a second node. After receiving the source file sent by the first node of a data block and the fountain code encoded file sent by the second node, the computer device determines the missing file of the data block corresponding to the source file according to the source file, decodes the fountain code encoded file to obtain the missing file, and splices the source file with the missing file to obtain the overall data file corresponding to the data block; the computer performs the above processing on the source file sent by the first node and the fountain code encoded file sent by the second node of each data block to obtain the overall data file corresponding to each data block of the target media data, and then splices the overall data files corresponding to all the data blocks to generate and play the target media data.
[0116] The computer device of this embodiment obtains the target data block based on the source file sent by the first node and the fountain code encoded file sent by the second node, and then generates and plays the target media data according to the target data block. This can maximize the capacity of each node when the two nodes are used, improve the efficiency of the nodes sending files, and thereby improve the efficiency of media data generation.
[0117] In the specific implementation, refer to Figure 5 .
[0118] For a piece of media data, the server corresponding to the content distribution network divides the media data into several data blocks (source files), each data block is divided into several data slices, and each data block is deployed to the corresponding first node. At the same time, the server performs fountain code encoding on each data block to obtain fountain code encoded data (fountain code encoded file) corresponding to each data block. Each fountain code encoded data is also divided into several data slices, and each fountain code encoded data is deployed to the corresponding second node.
[0119] After responding to the playback event of the media data, the computer device obtains the first node parameters of the first node storing the data block of the media data and the second node parameters of the second node storing the fountain code encoded data of the media data, determines the capability and network status of the first node according to the first node parameters, determines the capability and network status of the second node according to the second node parameters, allocates a first number of shards to the first node according to the capability and network status of the first node, allocates a second number of shards to the second node according to the capability and network status of the second node, and sends acquisition instructions to the first node and the second node, respectively.
[0120] The first node intercepts data slices of a first number of slices in a data block corresponding to the stored media data according to the acquisition instruction, and sends the data slices to the computer device. The second node intercepts fountain code data slices of any second number of slices in a data block corresponding to the fountain code encoded data of the stored media data according to the acquisition instruction, and sends the data slices to the computer device.
[0121] For the data fragments and fountain code encoded data fragments sent by the first node and the second node corresponding to each data block, the computer device mixes and decodes the data fragments and the fountain code encoded data fragments to obtain the data corresponding to each data block of the media data, and then restores the media data according to the data corresponding to each data block and plays it.
[0122] This embodiment generates media data through the source file sent by the first node and the fountain code encoding file sent by the second node. The capacity of each node can be maximized when the two nodes are used, the efficiency of the node sending files can be improved, and the efficiency of media data generation can be improved.
[0123] In the specific implementation, take the video playing in the Xiaohongshu application as an example:
[0124] In response to the user's on-demand operation for the target video, the Xiaohongshu application determines a first node storing data of the target video and a second node storing fountain code encoded data of the target video in the content distribution network, obtains the first node parameters and the second node parameters of the second node, determines the capability and network status of the first node according to the first node parameters, determines the capability and network status of the second node according to the second node parameters, allocates a first number of shards to the first node according to the capability and network status of the first node, allocates a second number of shards to the second node according to the capability and network status of the second node, and sends acquisition instructions to the first node and the second node, respectively.
[0125] The first node is a node storing a video data block of the target video, and the second node is a node storing the fountain code encoding corresponding to the video data block of the target video; the first node intercepts data slices with a length of the first number of slices from the stored video data block according to the acquisition instruction, and sends them to the Xiaohongshu application; the second node intercepts any second number of fountain code encoded data slices from the stored fountain code encoded data according to the acquisition instruction, and sends them to the Xiaohongshu application.
[0126] For the data fragments and fountain code encoded data fragments sent by the first node and the second node corresponding to each data block, the Xiaohongshu application mixes and decodes the data fragments and the fountain code encoded data fragments to obtain the video frames corresponding to each video data block of the target video, and then splices the video frames corresponding to each data block to restore the target video and play it.
[0127] This embodiment generates a target video by using data fragments of video data blocks sent by a first node and fountain code encoded data fragments of fountain code encoded data sent by a second node. This can maximize the capacity of each node when the two nodes are used, improve the efficiency of node file sending, and further improve the efficiency of target video generation and playback.
[0128] This embodiment also provides a media data generating device, such as Figure 6 As shown, the media data generating device may include:
[0129] The first acquisition unit 1001 is used to respond to a playback event and acquire a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to target media data to be played, wherein the large node is a content distribution node and the small node is a fountain code encoding node;
[0130] A determining unit 1002 is configured to determine the number of first fragments pulled from the first node according to the first node parameter and the fragment information of the target media data, and to determine the number of second fragments pulled by the second node according to the second node parameter and the fragment information of the target media data;
[0131] The second acquisition unit 1003 is configured to acquire the source files of the first number of shards from the first node through the scheduler, and acquire the fountain code encoded files of the second number of shards from the first node;
[0132] The generating unit 1004 is configured to generate and play the target media data based on the source file and the fountain code encoding file.
[0133] In an optional example, the determining unit is further configured to:
[0134] Determine the total number of fragments of the data block of the target media data and the data volume of each fragment according to the fragment information of the target media data;
[0135] Determining the data processing time of the first node according to the data volume of each of the shards and the data processing speed in the first node parameters;
[0136] Determine the data transmission time of the first node according to the data volume of the shard, the network bandwidth in the first node parameter, and the network delay in the first node parameter;
[0137] The number of first shards to be pulled from the first node is determined according to the data processing time, the data transmission time, the data processing speed, and the total number of shards of the data block.
[0138] In an optional example, the determining unit is further configured to:
[0139] If the data processing time is greater than the data transmission time, determining the number of first shards to be pulled from the first node according to the data processing time, the data processing speed, and the total number of shards of the data block;
[0140] If the data transmission time is greater than the data processing time, the number of first shards to be pulled from the first node is determined according to the data transmission time, the data processing speed and the total number of shards of the data block.
[0141] In an optional example, the second acquisition unit is further configured to:
[0142] Determine a first number of the first nodes and a second number of the second nodes according to the first node parameter, the second node parameter, the first number of shards, the second number of shards, and the total number of shards of the data block in the shard information;
[0143] Determine a first target node in the first node according to the device location, the first node parameter and the first quantity, and determine the second target node in the second node according to the device location, the second node parameter and the second quantity;
[0144] The source files of the first number of shards are obtained from the first target node, and the fountain code encoded files of the second number of shards are obtained from the second target node.
[0145] In an optional example, the second acquisition unit is further configured to:
[0146] Calculating a first reference quantity and a second reference quantity according to the first node parameter and the second node parameter;
[0147] Calculate the total number of reference shards according to the first reference number, the first number of shards, the second reference number, and the second number of shards;
[0148] A first number of the first nodes and a second number of the second nodes are determined according to the total number of reference shards, the number of data block shards, the first reference number, and the second reference number.
[0149] In an optional example, the second acquisition unit is further configured to:
[0150] If the total number of reference fragments is not less than the total number of fragments of the data block in the fragment information, determining the first reference number as a first number and determining the second reference number as a second number;
[0151] If the total number of reference fragments is less than the total number of fragments of the data block, then calculating the difference between the total number of reference fragments and the number of fragments of the data block;
[0152] The first reference number and / or the second reference number is adjusted according to the difference until the total number of reference shards is not less than the total number of shards of the data block, and a first number of the first nodes and a second number of the second nodes are determined.
[0153] In an optional example, the second acquisition unit is further configured to:
[0154] Obtaining location information of each of the first nodes, and calculating the distance between each of the location information and the location of the device;
[0155] Determine a first node whose distance is less than a preset distance threshold as a first candidate node;
[0156] Based on the first node parameter and the first number, the first target node is determined among the first candidate nodes.
[0157] In an optional example, the second acquisition unit is further configured to:
[0158] Sending a file acquisition instruction to the first node based on the first number of shards, and receiving a source file with the first number of shards issued by the first node, wherein the source file is a file with a length of the first number of shards intercepted by the first node from a data block corresponding to the stored target media data;
[0159] Based on the second number of shards, a file acquisition instruction is sent to the second node, and a fountain code encoding file of the second number of shards issued by the second node is received, wherein the fountain code encoding file is an arbitrary file of the second number of shards intercepted by the second node from the fountain code encoding data corresponding to the data block of the stored target media data.
[0160] In an optional example, the generation unit is further configured to:
[0161] Based on the source file, determining a missing file of a data block corresponding to the source file;
[0162] Decoding the fountain code encoded file to obtain the missing file;
[0163] Splicing the source file with the missing file to generate a target data block;
[0164] All target data blocks are spliced together to generate and play the target media data.
[0165] By adopting the solution of this embodiment, media data is generated by the source file sent by the first node and the fountain code encoded file sent by the second node. The capacity of each node can be maximized when the two nodes are used, the efficiency of the node sending files can be improved, and the efficiency of media data generation can be improved.
[0166] Accordingly, the present application also provides a computer device, such as Figure 7 As shown, Figure 7 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 1100 client and / or server includes a processor 1101 with one or more processing cores, a memory 1102 with one or more computer-readable storage media, and a computer program stored in the memory 1102 and executable on the processor. Among them, the processor 1101 is electrically connected to the memory 1102. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0167] The processor 1101 is the control center of the computer device 1100, and uses various interfaces and lines to connect various parts of the entire computer device 1100. By running or loading software programs and / or units stored in the memory 1102, and calling data stored in the memory 1102, the processor 1101 executes various functions of the computer device 1100 and processes data, thereby monitoring the computer device 1100 as a whole. The processor 1101 can be a processor CPU, a graphics processor GPU, a network processor (Network Processor, NP), etc., and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0168] In an embodiment of the present application, the processor 1101 in the computer device 1100 will load the computer program corresponding to the process of one or more applications into the memory 1102 according to the following steps, and the processor 1101 will run the application stored in the memory 1102 to implement various functions.
[0169] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0170] Optional, such as Figure 7 As shown, the computer device 1100 further includes: a touch screen 1103, a radio frequency circuit 1104, an audio circuit 1105, an input unit 1106, and a power supply 1107. The processor 1101 is electrically connected to the touch screen 1103, the radio frequency circuit 1104, the audio circuit 1105, the input unit 1106, and the power supply 1107, respectively. Those skilled in the art can understand that Figure 4 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0171] The touch display screen 1103 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1103 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, and these graphical user interfaces can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-EmittingDiode) and the like. The touch panel can be used to collect the user's touch operation on or near it (such as the user uses any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1101, and can receive the command sent by the processor 1101 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1101 to determine the type of touch event, and then the processor 1101 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 1103 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1103 can also be used as a part of the input unit 1106 to realize the input function.
[0172] The radio frequency circuit 1104 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other computer device through wireless communication, and to send and receive signals between the network device or other computer device.
[0173] The audio circuit 1105 can be used to provide an audio interface between the user and the computer device through a speaker and a microphone. The audio circuit 1105 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 1105 and converted into audio data, and then the audio data is output to the processor 1101 for processing, and then sent to another computer device through the radio frequency circuit 1104, or the audio data is output to the memory 1102 for further processing. The audio circuit 1105 may also include an earphone jack to provide communication between an external headset and the computer device.
[0174] The input unit 1106 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0175] The power supply 1107 is used to supply power to various components of the computer device 1100. Optionally, the power supply 1107 can be logically connected to the processor 1101 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1107 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0176] although Figure 7 Not shown, the computer device 1100 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0177] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0178] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0179] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute any one of the media data generation methods provided in the embodiment of the present application. The computer program can execute the steps of the media data generation method.
[0180] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0181] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0182] Since the computer program stored in the computer-readable storage medium can execute any one of the media data generation methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the media data generation methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0183] According to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations in the above embodiments.
[0184] In the above-mentioned embodiments of the media data generating device, computer-readable storage medium, media data generating system, and computer program product, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the above-mentioned media data generating device, computer-readable storage medium, computer program product, media data generating system and its corresponding units can refer to the description of the media data generating method in the above embodiment, and will not be repeated here.
[0185] The above is a detailed introduction to a media data generation method, system, device, computer equipment, computer-readable storage medium and computer program product provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating media data, characterized in that: The media data generation method comprises: In response to a play event, obtaining a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to the target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node; Determine the number of first shards to be pulled from the first node according to the first node parameter and the shard information of the target media data, and determine the number of second shards to be pulled from the second node according to the second node parameter and the shard information of the target media data; Acquire the source files of the first number of shards from the first node, and acquire the fountain code encoded files of the second number of shards from the second node; Based on the source file and the fountain code encoding file, generate and play the target media data; The step of obtaining the source files of the first number of shards from the first node and obtaining the fountain code encoded files of the second number of shards from the second node includes: Calculating a first reference quantity and a second reference quantity according to the first node parameter and the second node parameter; Calculate the total number of reference shards according to the first reference number, the first number of shards, the second reference number, and the second number of shards; If the total number of reference fragments is not less than the total number of fragments of the data block in the fragment information, determining the first reference number as a first number and determining the second reference number as a second number; If the total number of reference fragments is less than the total number of fragments of the data block, then calculating the difference between the total number of reference fragments and the number of fragments of the data block; Adjust the first reference number and / or the second reference number according to the difference until the total number of reference shards is not less than the total number of shards of the data block, and determine a first number of the first nodes and a second number of the second nodes; Determine a first target node in the first node according to a device location, the first node parameter, and the first quantity, and determine a second target node in the second node according to the device location, the second node parameter, and the second quantity; The source files of the first number of shards are obtained from each of the first target nodes, and the fountain code encoded files of the second number of shards are obtained from each of the second target nodes.
2. The media data generation method according to claim 1, characterized in that: The determining the first number of fragments according to the first node parameter and the fragment information of the target media data includes: Determine the total number of fragments of the data block of the target media data and the data volume of each fragment according to the fragment information of the target media data; Determining the data processing time of the first node according to the data volume of each of the shards and the data processing speed in the first node parameters; Determine the data transmission time of the first node according to the data volume of the shard, the network bandwidth in the first node parameter, and the network delay in the first node parameter; The number of first shards to be pulled from the first node is determined according to the data processing time, the data transmission time, the data processing speed, and the total number of shards of the data block.
3. The media data generation method according to claim 2, characterized in that: The determining, according to the data processing time, the data transmission time, the data processing speed, and the total number of shards of the data block, the number of first shards pulled from the first node includes: If the data processing time is greater than the data transmission time, determining the number of first shards to be pulled from the first node according to the data processing time, the data processing speed, and the total number of shards of the data block; If the data transmission time is greater than the data processing time, the number of first shards to be pulled from the first node is determined according to the data transmission time, the data processing speed and the total number of shards of the data block.
4. The method for generating media data according to claim 1, characterized in that: The step of obtaining the source files of the first number of shards from the first node, and obtaining the fountain code encoded files of the second number of shards from the second node includes: Determine a first number of the first nodes and a second number of the second nodes according to the first node parameters, the second node parameters, the first number of shards, the second number of shards, and the total number of shards of the data block in the shard information.
5. The media data generation method according to claim 4, characterized in that: Determining a first target node in the first node according to the device location, the first node parameter and the first quantity includes: Obtaining a node position of each of the first nodes, and calculating a distance between each of the node positions and the device position; Determine a first node whose distance is less than a preset distance threshold as a first candidate node; Based on the first node parameter and the first number, the first target node is determined among the first candidate nodes.
6. The media data generation method according to claim 2, characterized in that: Before obtaining the source files of the first number of shards from each of the first target nodes and obtaining the fountain code encoded files of the second number of shards from each of the second target nodes, the method includes: Sending a file acquisition instruction to the first node based on the first number of shards, and receiving a source file with the first number of shards issued by the first node, wherein the source file is a file with a length of the first number of shards intercepted by the first node from a data block corresponding to the stored target media data; Based on the second number of shards, a file acquisition instruction is sent to the second node, and a fountain code encoding file of the second number of shards issued by the second node is received, wherein the fountain code encoding file is an arbitrary file of the second number of shards intercepted by the second node from the fountain code encoding data corresponding to the data block of the stored target media data.
7. The method for generating media data according to any one of claims 1 to 6, characterized in that: The generating and playing the target media data based on the source file and the fountain code encoding file includes: Based on the source file, determining a missing file of a data block corresponding to the source file; Decoding the fountain code encoded file to obtain the missing file; Splicing the source file with the missing file to generate a target data block; All target data blocks are spliced together to generate and play the target media data.
8. A media data generating device, characterized in that: The device comprises: A first acquisition unit, configured to respond to a playback event and acquire a first node parameter of a first node and a second node parameter of a second node of a content distribution network corresponding to the target media data to be played, wherein the first node is a content distribution node and the second node is a fountain code encoding node; a determining unit, configured to determine the number of first fragments to be pulled from the first node according to the first node parameter and the fragment information of the target media data, and to determine the number of second fragments to be pulled by the second node according to the second node parameter and the fragment information of the target media data; A second acquisition unit is used to acquire the source files of the first number of shards from the first node, and acquire the fountain code encoded files of the second number of shards from the second node; A generating unit, configured to generate and play the target media data based on the source file and the fountain code encoding file; The second acquisition unit is further used to calculate a first reference quantity and a second reference quantity according to the first node parameter and the second node parameter; Calculate the total number of reference shards according to the first reference number, the first number of shards, the second reference number, and the second number of shards; If the total number of reference fragments is not less than the total number of fragments of the data block in the fragment information, determining the first reference number as a first number and determining the second reference number as a second number; If the total number of reference fragments is less than the total number of fragments of the data block, then calculating the difference between the total number of reference fragments and the number of fragments of the data block; Adjust the first reference number and / or the second reference number according to the difference until the total number of reference shards is not less than the total number of shards of the data block, and determine a first number of the first nodes and a second number of the second nodes; Determine a first target node in the first node according to a device location, the first node parameter, and the first quantity, and determine a second target node in the second node according to the device location, the second node parameter, and the second quantity; The source files of the first number of shards are obtained from each of the first target nodes, and the fountain code encoded files of the second number of shards are obtained from each of the second target nodes.
9. A computer device, characterized in that: The computer device is configured with a processor and a memory, wherein the memory stores a plurality of computer programs, and the processor loads the computer programs from the memory to execute the steps of the media data generating method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of computer programs, and the computer programs are suitable for being loaded by a processor to execute the steps of the media data generating method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for downloading resources
CN103888512A
Resource distribution method and system for PCDN network
CN113179328A