Cache management method and device for multiple download tasks

By allocating independent cache space for each download task according to its bit rate or file size, the problem of unbalanced memory usage in multi-task cache management is solved, and the cache hit rate and playback experience is improved.

CN114817089BActive Publication Date: 2024-11-12BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210446692.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-26
Publication Date
2024-11-12
Estimated Expiration
2042-04-26

AI Technical Summary

Technical Problem

The prior art is prone to unbalanced memory usage in the cache management of multiple download tasks, resulting in the problem of playback stuttering.

Method used

By determining the total cache space of the current playback device and allocating independent cache space to each download task according to the code rate or file size, high-bit rate tasks occupy more cache, while low-bit rate tasks occupy less cache, avoiding cache Uneven usage, improve cache hit rate and reduce playback lag.

Benefits of technology

It effectively avoids the problem of unbalanced cache usage, improves the cache hit rate when dragging the progress bar, reduces playback lag, and optimizes the user's playback experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114817089B_ABST
    Figure CN114817089B_ABST
Patent Text Reader

Abstract

The present invention relates to a cache management method and device for multiple download tasks. The method comprises: determining the total cache space of the current playback device; allocating an independent cache space matching the attribute information of the download task to each download task from the total cache space, so that each download task saves the downloaded file in its own independent cache space; the attribute information comprises: bit rate and / or file size. This scheme can make the memory occupied by each download task match its own bit rate or file size, that is, a download task with a high bit rate occupies more cache, and a download task with a low bit rate occupies less cache, thus avoiding the problem of uneven cache occupancy, thereby improving the cache hit rate when dragging the progress bar and reducing playback freezes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cache management, and in particular to a cache management method and device for multiple download tasks. Background Art

[0002] In order to optimize the user's viewing experience, most videos currently support independent audio. When playing a video with independent audio, two download tasks will be created, one for the audio and the other for the picture. If there are ads in the video, another download task for the ads will be created. In addition, some video playback platforms can provide multi-view viewing. In multi-view viewing mode, at least two download tasks will be created.

[0003] During video playback, videos are generally cached to avoid playback freezes. In the prior art, when cache management is performed for multiple download tasks that are being performed simultaneously, the problem of uneven memory usage of multiple download tasks may occur, that is, it is possible that a download task with a high bit rate may occupy less cache, while a download task with a low bit rate may occupy more cache. When the user drags the progress bar, it is very likely that the cache will not be hit, resulting in playback freezes.

[0004] Therefore, when performing cache management for multiple download tasks that are being performed simultaneously, how to avoid playback jams caused by uneven memory usage is a technical problem that needs to be urgently solved by those skilled in the art. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a cache management method for multiple download tasks and related equipment to overcome the problem of playback jams caused by uneven memory usage when performing cache management on multiple download tasks that are currently being performed simultaneously.

[0006] To achieve the above objectives, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a cache management method for multiple download tasks, the method being applicable to a playback device for multimedia content, comprising:

[0008] Determine the total cache space of the current playback device;

[0009] Allocating an independent cache space matching the attribute information of the download task to each download task from the total cache space, so that each download task stores the downloaded file in its own independent cache space;

[0010] The attribute information includes: bit rate and / or file size.

[0011] Further, the determining of the total cache space of the current playback device includes:

[0012] Determine the basic cache space according to the memory space of the playback device where the current download task is located;

[0013] The total cache space of the current playback device is determined according to the number of the download tasks and the basic cache space.

[0014] Further, determining the total cache space of the current playback device according to the number of the download tasks and the basic cache space includes:

[0015] If the number of the download tasks is 1, the basic cache space is determined as the total cache space;

[0016] If the number of the download tasks is greater than 1, a cache space of a preset size is expanded on the basis of the basic cache space, and the expanded cache space is determined as the total cache space.

[0017] Furthermore, the method further comprises:

[0018] If the total cache space is larger than a preset maximum available cache space, the preset maximum available cache space is determined as the total cache space.

[0019] Furthermore, allocating an independent cache space matching the attribute information of the download task to each download task includes:

[0020] Get the bitrate of each download task, and allocate initial cache space for each download task according to the ratio between the bitrates;

[0021] The initial cache space is determined as an independent cache space; or, when the initial cache space is less than a preset value, the preset value is determined as an independent cache space; or, when the initial cache space is less than the file size of the download task, the file size of the download task is determined as an independent cache space.

[0022] Furthermore, allocating initial cache space for each download task according to the ratio between the bit rates includes:

[0023] For any download task, obtain the bit rate of the download task, and calculate the bit rate ratio of the download task in the total bit rate of all download tasks;

[0024] The bit rate ratio is used as the space ratio of the download task in the total cache space;

[0025] According to the space ratio, an initial cache space is allocated to the download task from the total cache space.

[0026] Further, determining the preset value as an independent cache space includes:

[0027] For any download task, if the initial cache space is smaller than a preset value, the size of the independent cache space allocated to the download task is updated to be equal to the preset value;

[0028] After reserving independent cache space for the download task in the total cache space, the remaining cache space is reallocated according to the bit rate ratios of other download tasks.

[0029] Further, determining the file size of the download task as an independent cache space includes:

[0030] For any download task, if the initial cache space is smaller than the file size of the download task, the size of the independent cache space allocated to the download task is updated to be equal to the file size of the download task;

[0031] After reserving independent cache space for the download task from the total cache space, the remaining cache space is reallocated according to the bit rate ratios of other download tasks.

[0032] Furthermore, the method further comprises:

[0033] If a download task is added or reduced, the total cache space is re-determined, and based on the remaining download tasks, a respective independent cache space is allocated to each download task.

[0034] Furthermore, the method further comprises:

[0035] For any download task, detecting the size of cache space actually occupied by the download task;

[0036] If the actual occupied space is larger than the cache space size allocated to the download task, the downloaded data is deleted according to the preset deletion rules and the download task is suspended.

[0037] Furthermore, deleting the downloaded data according to a preset deletion rule includes:

[0038] Deleting the downloaded data that has been played; and / or,

[0039] Delete the data in the downloaded data that has not been played but whose distance from the current playing time is greater than the preset time threshold.

[0040] In a second aspect, the present application provides a cache management device for multiple download tasks, including:

[0041] A determination module, used to determine the total cache space of the current playback device;

[0042] An allocation module, configured to allocate, from the total cache space, an independent cache space matching the attribute information of the download task to each download task, so that each download task stores the downloaded file in its own independent cache space;

[0043] The attribute information includes: bit rate and / or file size.

[0044] In a third aspect, the present application provides an electronic device, including a processor and a memory, wherein the processor is connected to the memory:

[0045] Wherein, the processor is used to call and execute the program stored in the memory;

[0046] The memory is used to store the program, and the program is at least used to execute any one of the methods described above.

[0047] In a fourth aspect, the present application provides a storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0048] This application adopts the above technical solution, which has at least the following beneficial effects:

[0049] The solution of the present application first determines the total cache space of the current playback device, and then allocates independent cache space to each download task from the total cache space according to the bit rate or file size of each download task, so that each download task saves the downloaded file in its own independent cache space. By adopting the above solution, the memory occupied by each download task can be matched with its own bit rate or file size, that is, download tasks with high bit rates occupy more cache, and download tasks with low bit rates occupy less cache, thus avoiding the problem of uneven cache occupancy, thereby improving the cache hit rate when dragging the progress bar and reducing playback freezes.

[0050] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 It is a flow chart provided by an embodiment of a cache management method for multiple download tasks of the present invention;

[0053] Figure 2 It is a flow chart provided by another embodiment of the cache management method for multiple download tasks of the present invention;

[0054] Figure 3 It is a flow chart provided by another embodiment of the cache management method for multiple download tasks of the present invention;

[0055] Figure 4 It is a flow chart provided by another embodiment of the cache management method for multiple download tasks of the present invention;

[0056] Figure 5 It is a flow chart provided by another embodiment of the cache management method for multiple download tasks of the present invention;

[0057] Figure 6 It is a flow chart provided by another embodiment of the cache management method for multiple download tasks of the present invention;

[0058] Figure 7 It is a flow chart provided by another embodiment of the cache management method for multiple download tasks of the present invention;

[0059] Figure 8 It is a structural diagram provided by an embodiment of a cache management device for multiple download tasks of the present invention;

[0060] Fig. 9 It is a structural schematic diagram provided by an embodiment of the electronic device of the present invention. DETAILED DESCRIPTION

[0061] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0062] See also Figure 1 , Figure 1 This is a flowchart provided by an embodiment of the cache management method for multiple download tasks of the present invention. The cache management method for multiple download tasks can be applied to any multimedia content playback device, and the playback device may include but is not limited to at least one of the following: a smart phone, a computer, a server, etc. The cache management method for multiple download tasks includes the following steps:

[0063] Step S11: determine the total cache space of the current playback device.

[0064] When the user opens the player on the playback device to play the corresponding content, one or more download tasks are created synchronously to cache the content played by the user based on the above download tasks to avoid playback jams. The player will be equipped with a multi-task management component, such as an HCDN component, which can cache one or more download tasks at the same time. The playback device may include but is not limited to at least one of the following: video download tasks, independent audio download tasks, independent picture download tasks, and advertising download tasks, which are not limited in the embodiments of this application.

[0065] In one embodiment of the present application, a cache management method for multiple download tasks is performed based on the HCDN component architecture. When a user opens a video player on a playback device, the HCDN component is started. When a user chooses to play video content, one or more download tasks are synchronously created based on the HCDN component. It should be noted that most videos currently support independent audio. When playing a video with independent audio, two download tasks will be created, one of which is an independent audio download task and the other is an independent picture download task. If there are advertisements inserted in the video, another advertisement download task will be created. In addition, some video playback platforms can provide multi-perspective viewing. In the multi-perspective viewing mode, at least two video download tasks will be created.

[0066] In this application, the total cache space is determined based on all current download tasks. Figure 2 For step S11, in one embodiment of the present application, the specific processing process of step S11 may include the following steps:

[0067] Step S111: determine the basic cache space according to the memory space of the playback device where the current download task is located.

[0068] In some embodiments of the present application, if the player on the playback device is equipped with an HCDN component, when the user opens the player, the HCDN component is started and the basic cache space is determined according to the memory space of the playback device. In this embodiment, the size of the basic cache space is related to the memory space of the playback device. The larger the memory space of the playback device, the larger the basic cache space.

[0069] As shown in Table 1, in one embodiment of the present application, different mobile device memories correspond to different memory levels. The number of basic cache blocks can be determined according to the mobile device memory and the memory level, and then the size of the basic cache space can be determined according to the number of basic cache blocks.

[0070] Mobile device memory Memory level Number of basic cache blocks Base cache size 256MB or less 1 9 18MB 256MB~512MB 2 11 22MB 512MB~1GB 3 13 26MB 1GB~2GB 4 15 30MB 2GB~3GB 5 17 34MB 3GB~4GB 6 20 40MB 4GB~5GB 7 22 44MB 5GB~6GB 8 24 48MB 6GB~7GB 9 25 50MB 7GB~8GB 10 25 50MB 8GB~9GB 11 30 60MB 9GB~10GB 12 30 60MB 10GB or more 13 40 80MB

[0071] Table 1

[0072] Step S112: determining the total cache space of the current playback device according to the number of the download tasks and the basic cache space.

[0073] In the present application, after determining the basic cache space, the cache space of a preset size is expanded according to the number of download tasks to facilitate further expansion of the cache space, and the expanded cache space is determined as the total cache space of all download tasks.

[0074] In some embodiments, step S112 may include the following steps: if the number of the download tasks is 1, the basic cache space is determined as the total cache space; if the number of the download tasks is greater than 1, the cache space of a preset size is expanded on the basis of the basic cache space, and the expanded cache space is determined as the total cache space.

[0075] In one embodiment of the present application, if the number of download tasks is one, the basic cache space can be directly used as the total cache space. If the number of download tasks is greater than one, the cache space of a preset size can be expanded for each additional download task on the basis of one download task. The cache space of the preset size can be set to a specific capacity, for example, to 10M. It can also be set according to the ratio of the basic cache space, for example, the expanded cache space of the preset size is one-half, one-third, or other ratio of the basic cache space.

[0076] In one embodiment of the present application, the expanded cache space is half of the basic cache space. Based on this, the calculation formula for the total cache space is:

[0077] TotalCapacity=BaseCapacity+BaseCapacity÷2×(n-1);

[0078] In the above formula, TotalCapacity is the total cache space, BaseCapacity is the base cache space, n is the number of download tasks, and n is a positive integer.

[0079] Through the above steps S111 and S112, the total cache space required for the download task can be determined, so that space can be allocated to each download task from the total cache space.

[0080] In one embodiment of the present application, if the total cache space is greater than the preset maximum available cache space, the preset maximum available cache space is determined as the total cache space. Specifically, the maximum available cache space can be set according to the parameters of the player. If the player on the playback device is equipped with an HCDN component, it can also be controlled according to the cloud configuration parameters of the HCDN component. The embodiment of the present application does not specifically limit this. For example, the maximum available cache space can be set to 100M. In this embodiment, by limiting the upper limit of the total cache space, it is possible to effectively avoid occupying too much memory of the playback device when there are too many download tasks, thereby ensuring that the playback device can operate normally. If other software is installed on the playback device, it is also possible to avoid affecting the operation of other software.

[0081] Step S12: Allocate an independent cache space matching the attribute information of the download task to each download task from the total cache space, so that each download task stores the downloaded file in its own independent cache space.

[0082] The attribute information of the download task includes bit rate and / or file size. The bit rate of the download task is related to the file size and duration; generally speaking, the bit rate is equal to the ratio of the file size to the file duration. In this application, independent cache space can be allocated to each download task from the total cache space according to the bit rate and file size of the download task.

[0083] In step S12, allocating an independent cache space matching the attribute information of the download task to each download task may include the following steps:

[0084] Step S121: Obtain the bitrate of each download task, and allocate initial cache space to each download task according to the ratio between the bitrates.

[0085] See also Figure 3 In this embodiment, step S121 may include the following steps: Step S1211, for any download task, obtain the bitrate of the download task, and calculate the bitrate ratio of the download task in the total bitrate of all download tasks. Specifically, assuming that the bitrate of the nth download task is bitrateN, the total bitrate of all download tasks is:

[0086] TotalBitrate=bitrate1+bitrate2+…+bitrateN;

[0087] In the above formula, TotalBitrate is the total bitrate of all download tasks, and n is a positive integer.

[0088] Step S1212: After the bit rate ratio is calculated, the bit rate ratio is used as the space ratio of the download task in the total cache space.

[0089] Step S1213: Allocate initial cache space for the download task from the total cache space according to the bitrate ratio determined in the above steps. Specifically, the initial cache space calculated for the nth download task according to the bitrate bitrateN is:

[0090] calculatedTaskCapacityN=TotalCapacity×bitrateN / TotalBitrate;

[0091] In the above formula, bitrateN is the bitrate of the nth download task, TotalBitrate is the total bitrate of all download tasks, and TotalCapacity is the total cache space.

[0092] In some embodiments, after step S121, step S122 is performed: determining the initial cache space as an independent cache space.

[0093] Based on the steps in S121 and S122 above, cache space can be allocated to the corresponding download task according to the bit rate ratio of the download task, so that all tasks can execute cache tasks under their respective allocated cache spaces. It will not happen that tasks with high bit rates occupy less cache and tasks with low bit rates occupy more cache, which increases the probability of hitting the cache when the user drags the progress bar.

[0094] In some embodiments of the present application, after step S121, step S123 may be further executed: when the initial cache space is smaller than a preset value, the preset value is determined as an independent cache space.

[0095] Reference Figure 4 In some embodiments, step S123 may include the following steps:

[0096] Step S1231: For any download task, if the initial cache space is smaller than a preset value, the size of the independent cache space allocated to the download task is updated to be equal to the preset value.

[0097] That is to say, for any download task, if the size of the cache space allocated from the total cache space according to the bit rate ratio is smaller than a preset value, the size of the cache space allocated to the download task is updated to be equal to the preset value.

[0098] Specifically, if there is such a download task, the size of the cache space allocated from the total cache space according to the bit rate ratio of the download task is less than the preset value, the cache space can be corrected, and the size of the cache space allocated to the download task is updated to be equal to the preset value. The above preset value can be set according to actual conditions, and this embodiment does not limit it.

[0099] In a specific embodiment of the present application, the player on the playback device is equipped with an HCDN component. Since the unit of internal data management in the architecture of the HCDN component is block, and a block is 2M in size, in order to ensure the normal execution of the download task, each download task can be set with at least 2 blocks of available space, that is, the preset value can be set to 4M.

[0100] Step S1232: After reserving independent cache space for the download task in the total cache space, the remaining cache space is reallocated according to the bit rate ratios of other download tasks.

[0101] After reserving a preset value of cache space for the download task, other download tasks need to reallocate cache space according to the bitrate ratio. Specifically, the bitrate ratio of any download task in the total bitrate of all remaining download tasks can be recalculated, and the bitrate ratio can be used as the space ratio of the download task in the remaining cache space. Based on the aforementioned space ratio, cache space is allocated from the remaining cache space for the remaining other download tasks.

[0102] Based on the steps in S123 above, it is possible to avoid the situation where the cache block calculated may be 0 due to large differences in the bit rates of multiple tasks, that is, the task has no block to cache data, thereby ensuring that the download task can be executed normally and improving the user experience.

[0103] In some embodiments of the present application, after step S121, step S124 may also be executed: when the initial cache space is smaller than the file size of the download task, the file size of the download task is determined as an independent cache space.

[0104] Reference Figure 5 In some embodiments, step S124 may include the following steps:

[0105] Step S1241: For any download task, if the initial cache space is smaller than the file size of the download task, the size of the independent cache space allocated to the download task is updated to be equal to the file size of the download task.

[0106] That is to say, for any download task, if the cache space allocated from the total cache space according to the bit rate ratio is smaller than the file of the download task, the cache space size allocated to the download task will be updated to be equal to the file size of the download task.

[0107] When the bitrate of the downloaded file is high but the file is small, the cache space allocated from the total cache space based on the bitrate ratio may be smaller than the file of the download task. For example, a short-duration advertisement with a high bitrate is inserted in a long video with a low bitrate. The cache space calculated based on the bitrate of the advertisement file may be larger than the cache space calculated for the video file. If the cache space allocated from the total cache space based on the bitrate ratio is smaller than the file of the download task, the cache space allocated to the download task will be updated to be equal to the file size of the download task.

[0108] Step S1242: After reserving independent cache space for the download task from the total cache space, the remaining cache space is reallocated according to the bit rate ratios of other download tasks.

[0109] After reserving a preset value of cache space for the download task, other download tasks need to reallocate cache space according to the bitrate ratio. Specifically, the bitrate ratio of any download task in the total bitrate of all remaining download tasks can be recalculated, and the bitrate ratio can be used as the space ratio of the download task in the remaining cache space. Based on the aforementioned space ratio, cache space is allocated from the remaining cache space for the remaining other download tasks.

[0110] Based on the steps in S124 above, it is possible to avoid the situation where the size of the allocated cache space is smaller than the file size, resulting in a download failure.

[0111] The cache management method for multiple download tasks of this embodiment determines the total cache space required by all current download tasks, and allocates respective cache spaces to respective download tasks from the total cache space according to the attribute information of the respective download tasks. The attribute information of the download tasks includes at least the bit rate and file size of the download tasks. Each download task can execute the corresponding download task in its own cache space. The storage space is allocated to each download task, the cache hit rate is improved when the user drags the progress bar, and the user's playback experience is optimized.

[0112] like Figure 6 As shown, in one embodiment of the present application, the following steps may also be included:

[0113] S21. If a download task is added or reduced, the total cache space is re-determined, and the independent cache space is reallocated to each download task.

[0114] When a new task is created or destroyed, it is necessary to reallocate new download task cache space so that the download space corresponding to each download task can be dynamically updated as the download task is updated, to avoid the situation where a high-bitrate task occupies less cache and a low-bitrate task occupies more cache. When reallocating the cache space of a new download task, it can be allocated according to the description of step S11 and step S12 in the above embodiment.

[0115] It should be noted that the method further includes step S22: when the playback device where the current download task is located exits playback, all download tasks are deleted to release the occupied cache space and avoid occupying too much memory and affecting the running speed of the playback device.

[0116] like Figure 7 As shown, in one embodiment of the present application, the following steps may also be included:

[0117] Step S31: for any download task, detect the size of the cache space actually occupied by the download task.

[0118] In the present application, during the execution of a download task, the actual space occupied by the download task can be detected.

[0119] Step S32: If the actual occupied space is larger than the cache space size allocated to the download task, the downloaded data is deleted according to a preset deletion rule, and the download task is suspended.

[0120] If, during the execution of a download task, it is detected that the space actually occupied by the download task exceeds the cache space size allocated to the download task, the redundant download data may be deleted and the download task may be suspended.

[0121] In one embodiment of the present application, step S32 specifically includes: deleting the data in the downloaded data that has been played; and / or deleting the data in the downloaded data that has not been played but the distance between it and the current playing time is greater than a preset time threshold.

[0122] Specifically, the data that has been played in the downloaded data can be deleted as redundant downloaded data. The data that has not been played in the downloaded data but is far from the current playback position can also be deleted as redundant downloaded data. The data that has been played in the downloaded data and the data that has not been played in the downloaded data but is far from the current playback position can also be deleted as redundant data.

[0123] In one embodiment of the present application, the size of the redundant download data is the difference between the size of the space actually occupied by the download task and the size of the allocated cache space.

[0124] In one embodiment of the present application, the data in the downloaded data that has been played is deleted first. When the amount of the data in the downloaded data that has been played is insufficient, the data in the downloaded data that has not been played but is far from the current playing position is deleted.

[0125] Step S33: If the actually occupied space is less than or equal to the cache space size allocated to the download task, continue the download task until the cache space allocated to the download task is fully occupied.

[0126] After deleting the redundant data, when the space actually occupied by the download task is less than or equal to the cache space size allocated to the download task, the download task can be started. If the cache space allocated to the download task is fully occupied, the redundant data can be determined again and deleted and the download task can be suspended. When the actually occupied space is less than or equal to the cache space size allocated to the download task, the download task can be continued.

[0127] Based on the above steps S31-S33, through this download-while-deleting method, the download task can be executed without occupying too much cache space and affecting the task playback. It can also avoid the situation where the download task cannot be executed due to insufficient memory, thereby improving the user's viewing experience.

[0128] Based on a general inventive concept, the present application also provides a cache management device for multiple download tasks, which is used to implement the above method embodiment. Figure 8 As shown, the cache management device for multiple download tasks of this embodiment includes:

[0129] A determination module 41 is used to determine the total cache space of the current playback device;

[0130] The allocation module 42 is used to allocate an independent cache space matching the attribute information of the download task to each download task from the total cache space, so that each download task stores the downloaded file in its own independent cache space;

[0131] The attribute information includes: bit rate and / or file size.

[0132] In some embodiments, the determination module 41 includes:

[0133] A first determining unit, configured to determine a basic cache space according to a memory space of a playback device where a current download task is located;

[0134] The expansion unit is used to determine the total cache space of the current playback device according to the number of download tasks and the basic cache space.

[0135] In some embodiments, the expansion unit is specifically used to: if the number of the download tasks is 1, determine the basic cache space as the total cache space; if the number of the download tasks is greater than 1, expand the cache space of a preset size based on the basic cache space, and determine the expanded cache space as the total cache space.

[0136] Furthermore, the determination module 41 further includes:

[0137] The second determining unit is configured to determine the preset maximum available cache space as the total cache space when the total cache space is greater than the preset maximum available cache space.

[0138] Furthermore, the allocation module 42 includes:

[0139] A calculation unit, used to obtain the bit rate of each download task and allocate an initial cache space for each download task according to the ratio between the bit rates;

[0140] An allocation unit is used to determine the initial cache space as an independent cache space; or, when the initial cache space is smaller than a preset value, determine the preset value as an independent cache space; or, when the initial cache space is smaller than the file size of the download task, determine the file size of the download task as an independent cache space.

[0141] In some embodiments, the calculation unit is specifically used to: for any download task, obtain the bit rate of the download task, calculate the bit rate ratio of the download task in the total bit rate of all download tasks; use the bit rate ratio as the space ratio of the download task in the total cache space; and allocate initial cache space for the download task from the total cache space based on the space ratio.

[0142] Furthermore, the allocation unit is specifically configured to: for any download task, if the initial cache space is smaller than a preset value, update the size of the independent cache space allocated to the download task to be equal to the preset value.

[0143] The calculation unit is further used for: after reserving independent cache space for the download task in the total cache space, reallocating the remaining cache space according to the bit rate ratios of other download tasks.

[0144] Furthermore, the allocation unit is specifically configured to: for any download task, if the initial cache space is smaller than the file size of the download task, update the size of the independent cache space allocated to the download task to be equal to the file size of the download task.

[0145] The calculation unit is further used for: after reserving independent cache space for the download task from the total cache space, reallocating the remaining cache space according to the bit rate proportions of other download tasks.

[0146] Furthermore, the cache management device for multiple download tasks also includes:

[0147] A redetermining module is used to redetermine the total cache space if a download task is added or reduced, and to reallocate the independent cache space for each download task;

[0148] The deletion module is used to delete all download tasks to release the occupied cache space if the playback device where the current download task is located exits playback.

[0149] Furthermore, the cache management device for multiple download tasks also includes:

[0150] A detection module is used to detect the size of cache space actually occupied by any download task;

[0151] A pause module is used to delete the downloaded data according to a preset deletion rule and pause the download task if the actual occupied space is larger than the cache space allocated to the download task;

[0152] The download module is used to continue the download task if the actual occupied space is less than or equal to the cache space size allocated to the download task until the cache space allocated to the download task is fully occupied.

[0153] Furthermore, the pause module includes:

[0154] The deleting unit is used to delete the data in the downloaded data that has been played; and / or delete the data in the downloaded data that has not been played but the distance between the downloaded data and the current playing time is greater than a preset time threshold.

[0155] Regarding the cache management device for multiple download tasks in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0156] Based on a general inventive concept, this embodiment further provides a playback device. The playback device of this embodiment includes the cache management device for multiple download tasks of the above embodiment.

[0157] Based on a general inventive concept, this embodiment also provides an electronic device for implementing the above method embodiment. Fig. 9 As shown, the electronic device of this embodiment includes a processor 51 and a memory 52, and the processor 51 is connected to the memory 52. ​​The processor 51 is used to call and execute the program stored in the memory 52; the memory 52 is used to store the program, and the program is at least used to execute the cache management method of multiple download tasks in the above embodiment.

[0158] Regarding the electronic device 11 in the above embodiment, the specific manner in which its processor 32 executes the program in the memory 31 has been described in detail in the embodiment of the method, and will not be elaborated here.

[0159] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0160] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.

[0161] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" refers to at least two.

[0162] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0163] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0164] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0165] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0166] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0167] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0168] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A cache management method for multiple download tasks, characterized in that: The method is applicable to a multimedia content playback device, and includes: Determine the total cache space of the current playback device; Allocate an independent cache space matching the attribute information of the download task to each download task from the total cache space, so that each download task stores the downloaded file in its own independent cache space; the allocating an independent cache space matching the attribute information of the download task to each download task includes: obtaining the bit rate of each download task, and allocating an initial cache space to each download task according to the ratio between the bit rates; determining the initial cache space as an independent cache space; or, when the initial cache space is less than a preset value, determining the preset value as an independent cache space; or, when the initial cache space is less than the file size of the download task, determining the file size of the download task as an independent cache space; The attribute information includes: bit rate and / or file size.

2. The method according to claim 1, characterized in that Determining the total cache space of the current playback device includes: Determine the basic cache space according to the memory space of the playback device where the current download task is located; The total cache space of the current playback device is determined according to the number of the download tasks and the basic cache space.

3. The method according to claim 2, characterized in that The determining the total cache space of the current playback device according to the number of the download tasks and the basic cache space includes: If the number of the download tasks is 1, the basic cache space is determined as the total cache space; If the number of the download tasks is greater than 1, a cache space of a preset size is expanded on the basis of the basic cache space, and the expanded cache space is determined as the total cache space.

4. The method according to claim 2, characterized in that: Also includes: If the total cache space is larger than a preset maximum available cache space, the preset maximum available cache space is determined as the total cache space.

5. The method according to any one of claims 1 to 4, characterized in that: The allocating initial cache space for each download task according to the ratio between the bit rates includes: For any download task, obtain the bit rate of the download task, and calculate the bit rate ratio of the download task in the total bit rate of all download tasks; The bit rate ratio is used as the space ratio of the download task in the total cache space; According to the space ratio, an initial cache space is allocated to the download task from the total cache space.

6. The method according to any one of claims 1 to 4, characterized in that: The step of determining the preset value as an independent cache space includes: For any download task, if the initial cache space is smaller than a preset value, the size of the independent cache space allocated to the download task is updated to be equal to the preset value; After reserving independent cache space for the download task in the total cache space, the remaining cache space is reallocated according to the bit rate ratios of other download tasks.

7. The method according to any one of claims 1 to 4, characterized in that: The step of determining the file size of the download task as an independent cache space includes: For any download task, if the initial cache space is smaller than the file size of the download task, the size of the independent cache space allocated to the download task is updated to be equal to the file size of the download task; After reserving independent cache space for the download task from the total cache space, the remaining cache space is reallocated according to the bit rate ratios of other download tasks.

8. The method according to any one of claims 1 to 4, characterized in that: Also includes: If a download task is added or reduced, the total cache space is re-determined, and based on the remaining download tasks, a respective independent cache space is allocated to each download task.

9. The method according to any one of claims 1 to 4, characterized in that: Also includes: For any download task, detecting the size of cache space actually occupied by the download task; If the actual occupied space is larger than the cache space size allocated to the download task, the downloaded data is deleted according to the preset deletion rules and the download task is suspended.

10. The method according to claim 9, characterized in that Deleting the downloaded data according to the preset deletion rule includes: Deleting the downloaded data that has been played; and / or, Delete the data in the downloaded data that has not been played but whose distance from the current playing time is greater than the preset time threshold.

11. A cache management device for multiple download tasks, characterized in that: include: A determination module, used to determine the total cache space of the current playback device; An allocation module, configured to allocate, from the total cache space, an independent cache space matching the attribute information of the download task to each download task, so that each download task stores the downloaded file in its own independent cache space; The method of allocating an independent cache space matching the attribute information of the download task to each download task includes: obtaining the bit rate of each download task, and allocating an initial cache space to each download task according to the ratio between the bit rates; determining the initial cache space as the independent cache space; or, when the initial cache space is less than a preset value, determining the preset value as the independent cache space; or, when the initial cache space is less than the file size of the download task, determining the file size of the download task as the independent cache space; The attribute information includes: bit rate and / or file size.

12. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the processor is connected to the memory: Wherein, the processor is used to call and execute the program stored in the memory; The memory is used to store the program, and the program is at least used to execute the method described in any one of claims 1-10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.