Video segment management method and apparatus, computer device, readable storage medium, and program product

By introducing a shared-memory channel-shared index structure into the live streaming server system, and using red-black trees and linked lists to query index nodes, the problem of insufficient concurrent response capability of the live streaming server system was solved, achieving more efficient video slice management and improving system performance.

WO2026118856A1PCT designated stage Publication Date: 2026-06-11CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2025-11-19
Publication Date
2026-06-11

AI Technical Summary

Technical Problem

The live streaming server system suffers from poor concurrent response capabilities when pushing streams to clients, mainly due to the large amount of system disk I/O consumption and slow parsing speed, resulting in large response latency.

Method used

A channel shared index structure based on shared memory is adopted, including a channel index red-black tree and a channel index linked list. By querying and traversing index nodes, disk read and parsing operations are reduced, thereby improving the system's concurrent response capability.

Benefits of technology

By reducing system storage consumption and disk write I/O consumption, the concurrent response capability of the live streaming server system was improved, and the system response latency was reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025135986_11062026_PF_FP_ABST
    Figure CN2025135986_11062026_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to a video segment management method, comprising: receiving a video playback request sent by a client, the video playback request being used for requesting video content from a target video content source channel within a time range from first time to second time; querying a target channel index red-black tree of a channel shared index structure for a first index node matching the first time and a second index node matching the second time, each index node in the target channel index red-black tree being inserted into the target channel index red-black tree by using timestamp information of a corresponding video segment file as a keyword; and traversing a target channel index linked list of the channel shared index structure to obtain video segment files corresponding to index nodes between the first index node and the second index node, and returning the video segment files to the client.
Need to check novelty before this filing date? Find Prior Art

Description

Video slicing management methods, devices, computer equipment, readable storage media, and software products

[0001] Related applications

[0002] This application claims priority to Chinese patent application filed on December 2, 2024, application number 202411753672X, entitled "Video Slicing Management Method, Apparatus, Computer Equipment, Readable Storage Medium and Program Product", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of video live streaming technology, and in particular to a video slice management method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology

[0004] With the continuous development of the Internet, live streaming is becoming increasingly popular. As an essential technology for realizing live streaming, HLS (HTTP Live Streaming) is used for audio and video services on PCs and mobile terminals.

[0005] Live streaming server systems are widely used in many application scenarios such as mobile TV and live video streaming. They provide decoding, caching, and slicing storage services for the source streams provided by content providers, while also providing clients with live streaming, time-shifting, playback, and speed-up control services based on protocols such as HLS and RTSP (Real Time Streaming Protocol).

[0006] Live streaming server systems not only need to handle the real-time streaming of hundreds of video source streams from various content providers, but also need to handle the streaming to clients, that is, to send the cached or stored video slices to the clients using protocols such as HLS and RTSP. With the increasing prevalence of ultra-high definition, 4K, and 8K video bitrates, high-performance slice management has gradually become a crucial factor affecting the performance of live streaming server systems.

[0007] However, the inventors realized that in order to ensure time-shift and replay playback services for any time period, the live streaming server system in the related technology needs to read the corresponding playlist file for each time period and re-parse the content of the slice file of the requested time period during the process of pushing the stream to the client. This results in a large amount of system disk I / O consumption, and at the same time, the parsing speed is slow, the response latency is large, and the system's concurrent response capability is greatly reduced.

[0008] Therefore, the related technologies suffer from poor concurrent response capabilities of live streaming server systems. Summary of the Invention

[0009] According to various embodiments disclosed in this application, a video slice management method, apparatus, computer device, computer-readable storage medium, and computer program product are provided that can improve the concurrent response capability of a live streaming server system.

[0010] A video slice management method includes:

[0011] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0012] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0013] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0014] A video slice management device, comprising:

[0015] The receiving module is used to receive video playback requests sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0016] The query module is used to query, in the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as a key; and

[0017] The traversal module is used to traverse the target channel index list corresponding to the target video content source channel in the channel shared index structure to obtain the video slice files corresponding to each index node between the first index node and the second index node, and return them to the client; the target channel index list is used to indicate the time order of each index node in the target channel index red-black tree.

[0018] A computer device includes a memory and one or more processors, the memory storing computer-readable instructions that, when executed by the processors, cause the one or more processors to perform the following steps:

[0019] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0020] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0021] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0022] One or more computer-readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the following steps:

[0023] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0024] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0025] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0026] A computer program product includes a computer program that, when executed by one or more processors, causes the one or more processors to perform the following steps:

[0027] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0028] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0029] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree. The aforementioned video slice management method, apparatus, computer equipment, computer-readable storage medium, and computer program product receive a video playback request sent by a client. The video playback request requests video content from a target video content source channel within a time range from a first time to a second time. In the target channel index red-black tree corresponding to the target video content source channel in the channel-shared index structure, a first index node matching the first time and a second index node matching the second time are queried. The target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel. Each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as a key. In the target channel index linked list corresponding to the target video content source channel in the channel-shared index structure, the video slice files corresponding to each index node between the first and second index nodes are traversed and returned to the client. The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0030] Thus, a channel shared index structure based on shared memory was designed. This structure includes a channel index red-black tree and a channel index linked list. Upon receiving a video playback request for video content within a time range from the first time to the second time, which requests the target video content source channel, the system queries and locates the first index node matching the first time and the second index node matching the second time, based on the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure. Then, based on the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the system traverses to obtain the video slice files corresponding to each index node between the first and second index nodes and returns them to the client. The live streaming server only needs to store the base speed video slice files and does not need to store forward and reverse slice files at various speeds or m3u8 playlist files. It also does not need to read and parse the corresponding time period m3u8 files twice, reducing system storage consumption and disk write I / O consumption, and improving the concurrent response capability of the live streaming server system.

[0031] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description

[0032] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.

[0033] Figure 1 is an architecture diagram of a live streaming server system according to one or more embodiments;

[0034] Figure 2 is an architecture flowchart of a shared memory-based live streaming server system according to one or more embodiments;

[0035] Figure 3 is a schematic diagram of a channel-sharing index structure according to one or more embodiments;

[0036] Figure 4 is a schematic diagram of an index node update process according to one or more embodiments;

[0037] Figure 5 is a flowchart illustrating a video slice management method according to one or more embodiments;

[0038] Figure 6 is a flowchart illustrating a process for handling HLS m3u8 requests based on a shared index structure according to one or more embodiments;

[0039] Figure 7 is a schematic diagram of the deletion process of an index node according to one or more embodiments;

[0040] Figure 8 is a flowchart illustrating a video slice management method in another embodiment;

[0041] Figure 9 is a block diagram of a video slice management device according to one or more embodiments;

[0042] Figure 10 is a block diagram of a computer device according to one or more embodiments. Detailed Implementation

[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0044] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0045] This application provides a video slice management method, and this embodiment illustrates the application of this method to a live streaming server system.

[0046] Live streaming server systems are widely used in various application scenarios such as IPTV (Interactive Personality TV), mobile TV, and live video streaming. They provide decoding, caching, and segmentation storage services for source streams provided by content providers, while also offering broadcast control services such as live streaming, time-shifting, playback, and speed adjustment to clients based on protocols like HLS and RTSP. Figure 1 illustrates an architecture diagram of a live streaming server system. This system not only needs to handle the real-time pulling of hundreds of video source streams from content providers but also needs to handle the pushing of streams to clients, that is, responding to clients with cached or stored video segments using protocols like HLS and RTSP. With the increasing prevalence of ultra-high-definition, 4K, and 8K video bitrates, high-performance segment management has gradually become a crucial factor affecting the performance of live streaming server systems. Traditional live streaming servers, while capable of meeting the above requirements, also have the following problems:

[0047] 1) High concurrent disk I / O consumption and high storage consumption: Under the multi-process architecture, the real-time processing of hundreds of live streams and the storage of slices for forward and reverse playback control at speeds of 2, 4, 8, 16, and 32 times for each live stream, as well as the storage of m3u8 playlist files, often results in storage time of more than 7 days. This leads to high storage consumption and high concurrent disk I / O, which significantly reduces the overall system performance.

[0048] 2) High concurrent disk I / O consumption and slow parsing of playback content: During the push of the stream to the client, in order to ensure the time-shift and playback service of any time period, it is necessary to read the corresponding m3u8 playlist file according to the time period and re-parse the slice file content of the requested time period, which causes a large amount of system disk I / O consumption. At the same time, the parsing speed is slow, the response delay is large, and the system's concurrent response capability is greatly reduced.

[0049] This application proposes a video slice management method for a live streaming server system based on shared memory. By using shared memory, a high-performance index structure and indexing method are designed to maintain video slice information for the entire playback duration without the need for a database. Efficient update, search, and deletion methods are provided to effectively reduce the system response time when pushing streams to clients. At the same time, during the slice generation stage, a thread pool is introduced to reduce process blocking caused by disk I / O, thereby improving system performance and concurrent response capabilities.

[0050] Shared memory refers to a large amount of memory in a multiprocessor computer system that can be accessed by different central processing units (CPUs). Shared memory is a communication method between multiple processes in the Unix operating system. This method is typically used for communication between multiple processes within a single program, but multiple programs can also exchange information through shared memory.

[0051] Specifically, while ensuring a multi-process architecture for the live streaming server system, a slice index structure is implemented in shared memory at the granularity of video content source channels. Efficient index update, lookup, and deletion methods are provided. Without introducing a database, a single fixed business process maintains the index information for the entire playback duration, which is shared by all business processes. This enables an efficient method for generating m3u8 file lists, requiring only the storage of base-speed video slice files, eliminating the need to store multi-speed video slice files and m3u8 playlist files, effectively reducing storage resource consumption and streaming response latency. Furthermore, to address the issue of process blocking caused by disk I / O during the slice recording of hundreds of content source channel video streams, thus affecting system responsiveness, a thread pool is introduced during the slice generation stage to reduce process blocking caused by disk I / O. This overall improves system performance and concurrent response capabilities.

[0052] Furthermore, as shown in Figure 2, an architecture flowchart for video slice management in a live streaming server system based on shared memory is provided.

[0053] While maintaining the multi-process implementation architecture of the live streaming server system, for video streams accessed by content providers (i.e., video content source channels), the index information of the full time-shift and playback slices of the channel is maintained within a single business process, using the video content source channel as the granularity. This is achieved by establishing a shared index structure on shared memory, and ensuring that the business process updates the index and writes data to the channel. Only the base-speed video slice file needs to be stored; there is no need to store forward and reverse video slice files at various speeds or a list of m3u8 files.

[0054] When writing video slice files to storage, a thread pool is introduced. When the parsed video stream data of a channel meets the slicing conditions (such as meeting the slice duration), a thread is used to asynchronously process index updates and write video slice files to storage blocks, avoiding disk I / O blocking the process. At the same time, a timed processing mechanism is started in the process to periodically clear the shared index information and slice data of the channels managed by the process.

[0055] All business processes can handle client requests for live, time-shifted, and video content. Based on the requested content, each business process queries the shared index structure, retrieves the requested content, and returns video slice files, m3u8 playlist files, etc., to the client.

[0056] In this application, a shared index structure for channels is implemented based on red-black trees and linked lists, resulting in a shared index structure based on shared memory. The shared index structure includes a channel index red-black tree and a corresponding channel index linked list for each video content source channel. The channel index red-black tree includes multiple index nodes corresponding to video slice files originating from the corresponding video content source channel; the channel index linked list is used to indicate the temporal order of each index node in the corresponding channel index red-black tree.

[0057] Each video content source channel's corresponding channel index red-black tree can be built by a single business process. This process maintains the index information for the full time-shift and playback slices of that channel, and ensures that the business process updates the index and writes data to that channel. All other business processes can read the channel index red-black tree built by this business process. In other words, each business process can access the channel index red-black tree corresponding to each video content source channel in the shared channel index structure.

[0058] Figure 3 illustrates a channel shared index structure. The channel shared index structure corresponds to the ch_index_struct member of the "Channel Structure" section in the figure.

[0059] 1) Channel shared index structure (shared index structure):

[0060] Required elements:

[0061] rbtree: A channel index red-black tree used for querying and maintaining index information for full time-shift and slide replay.

[0062] lock: Read-write lock, used to protect the shared data in the rbtree. When updating or deleting an index node in the rbtree, a write lock is acquired; when searching for an index node in the rbtree, a read lock is acquired.

[0063] Node*start_node: Maintains a linked list of channel indexes; this member is the starting node of the linked list.

[0064] Node*end_node: Maintains a linked list of channel indexes; this member is the last node in the linked list.

[0065] path: The directory where the recorded slices are located.

[0066] 2) Channel index red-black tree (rbtree):

[0067] The index nodes in the channel index red-black tree use the Unix absolute timestamp as the key for insertion, querying, and deletion of index nodes.

[0068] Required elements:

[0069] The insert method provides an insertion method using a Unix absolute timestamp as the key.

[0070] The find method provides a way to query data using a Unix absolute timestamp as the key.

[0071] The delete method provides a way to remove an index node from the channel index red-black tree, but does not release the index node's resources.

[0072] root node: The root node of the channel index red-black tree, a necessary parameter for the red-black tree.

[0073] 3) Node index structure:

[0074] Required elements:

[0075] 1. key: Red-black tree node, using Unix absolute timestamp as key.

[0076] 2. index_struct: Stores the index information of the TS fragment files (including timestamp, seg_size, seg_duration, seg_sequence, gop_num, gop_group, bandwidth, and file_name).

[0077] 2.1. timestamp: The start time of the video slice, an absolute timestamp in Unix.

[0078] 2.2 seg_size: Video slice size.

[0079] 2.3, seg_duration: Duration of video slice.

[0080] 2.4 seg_sequence: Video slice sequence number, incrementing from 0 to 1.

[0081] 2.5, gop_num: The number of GOPs (Group of Pictures) in the contained video. A GOP is a set of pictures in a sequence used to assist random access. The first image of a GOP must be an I-frame (keyframe) to ensure that the GOP does not need to refer to other images and can be decoded independently.

[0082] 2.6. gop_group[]: GOP group, containing index information of all GOPs within the slice (including gop_size, i_frame_size, duration, data_off).

[0083] 2.6.1, gop_size: GOP size.

[0084] 2.6.2 i_frame_size: The size of the keyframes (I-frames) of a GOP.

[0085] 2.6.3, duration: GOP duration.

[0086] 2.6.4, data_off: The offset position of the GOP starting point in the video slice.

[0087] 2.7 Bandwidth: The average video bitrate of a video slice.

[0088] 2.8. file_name: The filename of the video slice.

[0089] 3. Node*left: Points to the left child node.

[0090] 4. Node*right: Points to the right child node.

[0091] 5. Node*prev: A linked list of nodes that points to the index node of the next timestamp.

[0092] 6. Node*next: A linked list of nodes that points to the index node of the previous timestamp.

[0093] For updating shared index structures:

[0094] Live streams are time-series, so an insertion method using Unix absolute timestamps as keys is employed. When a video slice meets the conditions for slice formation, a new index node is inserted into the channel index red-black tree and channel index linked list, which share the index structure, using the Unix absolute timestamp of the slice's start time as the key.

[0095] The update process for an index node is shown in Figure 4:

[0096] Update steps:

[0097] 1) Receive the source stream from the content provider (video content source channel) and parse it.

[0098] 2) The keyframe (I-frame) is parsed, which is the starting position of the next GOP.

[0099] 3) Has the current video slice duration reached the preset value (preset slice duration)?

[0100] 4) If yes, create a thread task, start the thread, enter the video slice storage and index node creation and update process, and return to 1); if no, return directly to 1).

[0101] 5) In the child thread:

[0102] a) Perform the writing of video slice content to storage.

[0103] b) Create an index node and populate the node with video slice information.

[0104] c) Add a write lock to the lock of the shared index structure.

[0105] d) The index node is inserted into the channel index red-black tree of the shared index structure using the Unix absolute timestamp of the slice start time as the key and the method of "small value as left node, large value as right node"; the index node is inserted at the end of the channel index linked list and becomes the new tail node.

[0106] e) Unlock the lock on the shared index structure.

[0107] f) End the thread task and return the thread to the thread pool.

[0108] Among them, video slice information can refer to the information contained in the index_struct, a necessary element of the node index structure.

[0109] In one embodiment, as shown in Figure 5, a video slice management method is provided. This embodiment illustrates the application of this method to a live streaming server system. The live streaming server in the live streaming server system can be implemented using a standalone server or a server cluster composed of multiple servers. The method includes the following steps:

[0110] Step S510: Receive a video playback request sent by the client.

[0111] Video playback requests may include, but are not limited to, requests for live streaming, time-shifted, or replay content.

[0112] Among them, the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0113] The first time and the second time can refer to a specific point in time.

[0114] The target video content source channel is the video content source channel requested by the video playback request.

[0115] In practice, the live streaming server system can receive video playback requests sent by clients.

[0116] Step S520: In the target channel index red-black tree corresponding to the target video content source channel of the channel shared index structure, query the first index node that matches the first time and the second index node that matches the second time.

[0117] Among them, the target channel index red-black tree is the channel index red-black tree corresponding to the source channel of the target video content in the channel shared index structure.

[0118] The target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel.

[0119] In this process, each index node in the target channel index red-black tree is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key.

[0120] In practice, the live streaming server system can query the target channel's index red-black tree using the first time as the key, and use the index node that matches the first time as the first index node. Similarly, it can query the target channel's index red-black tree using the second time as the key, and use the index node that matches the second time as the second index node.

[0121] Among them, the timestamp information corresponding to the first index node matches the first time; the timestamp information corresponding to the second index node matches the second time.

[0122] Step S530: In the target channel index list corresponding to the target video content source channel of the channel shared index structure, traverse and obtain the video slice files corresponding to each index node between the first index node and the second index node, and return them to the client.

[0123] Among them, the target channel index list is the channel index list corresponding to the source channel of the target video content.

[0124] The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0125] In a specific implementation, the live streaming server system can traverse each index node between the first index node and the second index node in the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, so as to return the video slice files corresponding to each index node between the first index node and the second index node to the client.

[0126] For example, a video playback request is used to request video content from the target video content source channel N, with a start time of Unix time X (first time) and a start time of Unix time Y (second time).

[0127] In the slice management module, based on the first time X of the video playback request, the target channel index red-black tree is queried using X as the key to find the first index node node_X. Based on the second time Y of the video playback request, the target channel index red-black tree is queried using Y as the key to find the second index node node_Y. Based on the target channel index linked list, node_X to node_Y are traversed to obtain the video slice files corresponding to each index node between node_X and node_Y.

[0128] In the aforementioned video slice management method, a video playback request is received from the client. This request requests video content from the target video content source channel within a time range from a first time to a second time. In the target channel index red-black tree corresponding to the target video content source channel in the channel-shared index structure, a first index node matching the first time and a second index node matching the second time are queried. The target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel. Each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key. In the target channel index linked list corresponding to the target video content source channel in the channel-shared index structure, the video slice files corresponding to each index node between the first and second index nodes are traversed and returned to the client. The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0129] Thus, a channel shared index structure based on shared memory was designed. This structure includes a channel index red-black tree and a channel index linked list. Upon receiving a video playback request for video content within a time range from the first time to the second time, which requests the target video content source channel, the system queries and locates the first index node matching the first time and the second index node matching the second time, based on the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure. Then, based on the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the system traverses to obtain the video slice files corresponding to each index node between the first and second index nodes and returns them to the client. The live streaming server only needs to store the base speed video slice files and does not need to store forward and reverse slice files at various speeds or m3u8 playlist files. It also does not need to read and parse the corresponding time period m3u8 files twice, reducing system storage consumption and disk write I / O consumption, and improving the concurrent response capability of the live streaming server system.

[0130] In one embodiment, in conjunction with the shared index structure update method described in the above embodiments, for the update of the index node corresponding to the target video content source channel, the live streaming server system can receive and parse the video source stream of the target video content source channel; determine whether the duration of the current slice of the video source stream meets the preset threshold; if it does, use the absolute timestamp of the slice start time corresponding to the current slice as the key and insert it into the target channel index red-black tree and the target channel index linked list.

[0131] The specific update process can be referred to the update steps shown in Figure 4, and will not be repeated here. It is understood that the update method for the index node corresponding to each video content source channel is the same. In this embodiment, the target video content source channel is used as an example, and the index node update method is not limited to the target video content source channel.

[0132] In one embodiment, when the video playback request is an HLS request, traversing and retrieving the video slice files corresponding to each index node between the first index node and the second index node, and returning them to the client, includes: traversing and retrieving the video slice information stored in each index node between the first index node and the second index node; generating an m3u8 playlist file based on the video slice information; the m3u8 playlist file including the slice download addresses of the video slice files corresponding to each index node between the first index node and the second index node; sending the m3u8 playlist file to the client; the client is used to send a slice download request to the live streaming server based on the slice download addresses in the m3u8 playlist file; in response to the slice download request, sending the video slice files corresponding to each index node between the first index node and the second index node to the client.

[0133] The video slice information can refer to the information contained in the necessary element index_struct of the node index structure, including the slice start time, slice size, slice duration, slice sequence number, and other information.

[0134] In specific implementation, when the video playback request is an HLS request, the live streaming server system, while traversing and retrieving the video slice files corresponding to each index node between the first and second index nodes and returning them to the client, can also traverse and retrieve the video slice information stored in each index node between the first and second index nodes. Based on the video slice information, it generates an m3u8 playlist file. This m3u8 playlist file includes the slice download addresses of the video slice files corresponding to each index node between the first and second index nodes. The live streaming server system sends the m3u8 playlist file to the client. The client sends a slice download request to the live streaming server system based on the slice download addresses in the m3u8 playlist file. In response to the slice download request, the live streaming server system sends the video slice files corresponding to each index node between the first and second index nodes to the client.

[0135] Taking an HLS request as an example, this involves requesting playback content from target video content source channel N between Unix time X (first time) and Unix time Y (second time). Generally, an HLS request needs to first request an m3u8 playlist file. Multi-level m3u8 scenarios are not considered here; only a general explanation is provided. Figure 6 illustrates a flowchart of HLS m3u8 request processing based on a shared index structure.

[0136] In the segment management module, based on the first time X of the video playback request, the target channel index red-black tree is queried using X as the key to find the first index node node_X. Based on the second time Y of the video playback request, the target channel index red-black tree is queried using Y as the key to find the second index node node_Y. Based on the target channel index linked list, node_X to node_Y are traversed to obtain the video segment information corresponding to each index node between node_X and node_Y, and an m3u8 playlist file is generated in memory in real time. Then, the real-time generated m3u8 playlist file is returned to the user. Based on the received segment download requests from the m3u8 playlist file, the user sends segment download requests to the live streaming server system one by one according to the HLS protocol. The live streaming server system responds to the segment download requests by sending the corresponding video segment files to the client.

[0137] Thus, based on the shared index structure, for video playback requests from client groups for live, time-shifted, and replay content, the shared index structure is queried according to the requested time range to generate base speed and various speed-based m3u8 playlist files in real time, and return the corresponding video segment files to the client. This eliminates the need for a second reading and parsing of the corresponding time-segment m3u8 files, improving the system's concurrent response capabilities.

[0138] In one embodiment, when the video playback request is an RTSP request, traversing and obtaining the video slice files corresponding to each index node between the first index node and the second index node, and returning them to the client, includes: traversing and obtaining the video slice files corresponding to each index node between the first index node and the second index node; and returning the traversed video slice files to the client in chronological order.

[0139] In the specific implementation, when the video playback request is an RTSP request, the live streaming server system does not generate an m3u8 playlist file during the process of traversing and retrieving the video slice files corresponding to each index node between the first index node and the second index node and returning them to the client. Instead, it directly traverses from the first index node to the second index node and returns the video slice files obtained by indexing to the client one by one in chronological order.

[0140] Thus, in both RTSP and HLS video playback requests, the system uses a shared index structure to find the index node that matches the target time period (i.e., the time range from the first time to the second time) carried in the request, employing a target channel index red-black tree. The system then traverses the linked list of the shared index structure's target channel index, a lock-free process. Compared to related technologies that re-read the m3u8 playlist file of the target time period from disk for secondary parsing, this avoids disk I / O overhead, reduces overall process overhead, and results in faster response times, improving the system's overall concurrent response capability.

[0141] In one embodiment, the timestamp information includes the absolute timestamp of the slice start time corresponding to the video slice file; in the target channel index red-black tree corresponding to the target video content source channel of the channel shared index structure, querying the first index node matching the first time and the second index node matching the second time includes: creating a first node pointer and a second node pointer; the first node pointer points to the root node of the target channel index red-black tree; the second node pointer is used to store the query result, which is initially set to null; the target channel index red-black tree is traversed cyclically through the first node pointer, and for any time in the first time and the second time, it is determined whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any time; according to the determination result, the query result currently stored in the second node pointer is updated; the currently stored query result is used to determine the index node matching any time.

[0142] In the specific implementation, during the process of querying the first index node that matches the first time and the second index node that matches the second time in the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, the live streaming server system can create a first node pointer and a second node pointer; the first node pointer points to the root node of the target channel index red-black tree; the second node pointer is used to store the query result, which is initially set to null.

[0143] The search methods for the first index node matching the first time and the second index node matching the second time are the same. The following example uses either the first or second time. The target channel index red-black tree is traversed iteratively using the first node pointer. It is determined whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any given time. Based on the determination result, the query result currently stored in the second node pointer is updated. The currently stored query result is used to determine the index node matching any given time.

[0144] Specifically, if the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any given time, then the index node currently pointed to by the first node pointer is used as the query result currently stored by the second node pointer, and the loop ends. Thus, the index node in the query result currently stored by the second node pointer is the index node that matches any given time.

[0145] For example, if any time is the first time, then if the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to the first time, the index node currently pointed to by the first node pointer is used as the query result currently stored by the second node pointer, and the query result currently stored by the second node pointer is output. The index node in the query result currently stored by the second node pointer is the first index node that matches the first time.

[0146] If any of these times is the second time, then if the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to the second time, the index node currently pointed to by the first node pointer is used as the query result currently stored by the second node pointer, and the query result currently stored by the second node pointer is output. The index node in the query result currently stored by the second node pointer is the second index node that matches the second time.

[0147] Thus, after finding an index node whose absolute timestamp of the corresponding slice start time is equal to the time to be searched, the loop ends and the queried index node is used as the index node corresponding to the time to be searched. This ensures that the video slice information indexed by this index node is the best match for the time to be searched, so that the video slice file indexed by this index node is the video content closest to the target time period requested by the video playback request.

[0148] In one embodiment, if the determination result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is less than any of the times, the index node currently pointed to by the first node pointer is used as the query result currently stored by the second node pointer, and the first node pointer is set to point to the right child node of the currently pointed-to index node; if the determination result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is greater than any of the times, the first node pointer is set to point to the left child node of the currently pointed-to index node; the process returns to the step of determining whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the times, until they are equal or the next index node pointed to by the first node pointer is empty, and the loop ends.

[0149] Understandably, if the judgment result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is less than any of those times, then the next index node pointed to by the first node pointer is the right child node of the currently pointed-to index node; if the judgment result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is greater than any of those times, then the next index node pointed to by the first node pointer is the left child node of the currently pointed-to index node.

[0150] In practical applications, this method of searching index nodes can be named the "exact and lvalue matching" search method. The specific search steps are as follows:

[0151] 1) Assume the timestamp of the search is find_timestamp (i.e., if any of the above times is find_timestamp).

[0152] 2) Add a read lock to the lock in the shared index structure.

[0153] 3) Create node pointers (first node pointer) and ret (second node pointer), make node point to the root node of the target channel index red-black tree, and make ret equal to null.

[0154] 4) Enter the while loop, and the loop ends when node is empty.

[0155] 5) Compare the node's member key (the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer) with find_timestamp:

[0156] a) If find_timestamp equals node->key, set ret equal to node, i.e., ret = node (use the index node currently pointed to by the first node pointer as the query result currently stored by the second node pointer), break out of the loop, and proceed to step 6).

[0157] b) If find_timestamp is less than node->key, set node to the left child of node, i.e., node = node->left (make the first node pointer point to the left child of the currently pointed-to index node). Return to step 4).

[0158] c) If find_timestamp is greater than node->key, set ret to node, and set node to the right child of node, i.e., ret = node, node = node->right (use the index node currently pointed to by the first node pointer as the query result currently stored by the second node pointer, and set the first node pointer to the right child of the currently pointed-to index node). Return to step 4).

[0159] 6) Unlocking the lock using the shared index structure.

[0160] 7) ret is the query result. If ret is not empty, the query is successful (the index node corresponding to any of the nodes is found). If ret is empty, the queried find_timestamp is not within the valid time range (that is, there is no index node corresponding to any of the times).

[0161] The above method ensures that queries are performed based on the principle of "exact matching and lvalue matching," meaning that the first index node whose key value is equal to or less than the query's `find_timestamp` is found. This guarantees that the indexed video slice information is the video slice information at the time point less than and closest to the query's `find_timestamp`, thus ensuring that when users search for video content at a specific time point, they can quickly locate the video slice file closest to that time point, ensuring that users receive the most relevant content, reducing user waiting time, and improving the accuracy of the returned video slice files. Through exact matching, the system can avoid transmitting irrelevant or future slice data, reducing bandwidth consumption and improving resource utilization efficiency. Matching the returned video slice information with the user's query time point avoids data inconsistency issues caused by timestamp mismatches, improving system reliability. By ensuring that the indexed video slice information is the slice information at the time point less than and closest to the query time point, not only is the user experience and content relevance improved, but system performance and resource utilization are also optimized. This query method can effectively meet users' needs for video content in application scenarios such as video-on-demand and live replay, and enhance the system's intelligent and personalized service capabilities.

[0162] Furthermore, this application also provides a method for deleting shared index structures. For deleting index nodes in the channel shared index structure, a timed mechanism is adopted. Every fixed time interval, the business process scans all video content source channels managed by the business process. The absolute timestamp of the slice start time corresponding to the index node is compared with the current time. For index nodes whose duration exceeds the replay duration, they are removed from the channel index red-black tree. Timely cleanup of unnecessary index nodes reduces the number of nodes in the red-black tree, thereby improving the performance of retrieval and insertion operations. For index nodes whose duration exceeds "replay duration plus protection duration", the memory resources of the index node are released, the memory is returned to shared memory, and the corresponding video slice file is deleted. Timely cleanup avoids excessive memory consumption by invalid information.

[0163] The protection duration is the length of time that an index node retains its resources after it has been removed from the channel index red-black tree. This prevents situations where the index node has reached its maximum playback duration but is still being used by clients.

[0164] The following explanation uses a target video content source channel as an example. In one embodiment, the live streaming server system can perform a timed cleanup task on the target video content source channel at preset intervals. The timed cleanup task is used to obtain a first difference between a first timestamp and a second timestamp, where the first timestamp is the absolute timestamp of the slice start time corresponding to the first node in the target channel index red-black tree; the second timestamp is the absolute timestamp of the slice start time corresponding to the start node (start_node) in the target channel index linked list. The timed cleanup task is also used to delete the video slice file corresponding to the start node and release the memory resources of the video slice information maintained by the start node if the first difference is greater than a preset protection duration.

[0165] In addition, the scheduled cleanup task is also used to obtain the second difference between the current timestamp and the first timestamp; if the second difference is greater than the preset maximum playback duration, the first node in the target channel index red-black tree is deleted.

[0166] It is understood that the method for deleting the index node corresponding to each video content source channel is the same. In this embodiment, the target video content source channel is used as an example, and the method for deleting the index node is not limited to the target video content source channel.

[0167] In practical applications, the process of deleting an inode is shown in Figure 7:

[0168] Deletion method:

[0169] 1) The channel timed processing mechanism is triggered at preset intervals (e.g., X seconds, where X is greater than 0).

[0170] 2) Cyclicly scan the status of each channel in the channel pool. If all channels have been scanned, proceed to step 1) after X seconds; otherwise, proceed to step 3).

[0171] 3) Determine whether the channel is managed by this service process. If yes, proceed to step 4); otherwise, return to step 2.

[0172] 4) Obtain the first node of the channel index red-black tree, i.e., the leftmost node, denoted as min_node.

[0173] 5) Determine if the value of min_node's key minus the channel index linked list start_node->key is greater than "protection duration". If it is, proceed to step 6); otherwise, proceed to step 8.

[0174] 6) Delete the video slice file indexed by start_node and release the memory resources of the video slice information maintained by start_node.

[0175] 7) start_node points to the next node after start_node, that is, it points to start_node->next.

[0176] 8) Add a write lock to the lock of the shared index structure.

[0177] 9) Obtain the current Unix timestamp (timestamp), and determine whether the timestamp minus the key value of min_node is greater than the maximum playback duration. If yes, proceed to step 10); otherwise, proceed to step 12.

[0178] 10) Remove the min_node node from the channel index red-black tree.

[0179] 11) min_node points to the next index node of min_node, that is, it points to min_node->next, and we return to step 9).

[0180] 12) Unlock the lock on the shared index structure and return to step 2).

[0181] In one embodiment, as shown in Figure 8, a flowchart of a video slice management method is provided. Taking the application of this method to a live streaming server system as an example, the method includes the following steps:

[0182] Step S802: Receive a video playback request sent by the client.

[0183] Step S804: Create the first node pointer and the second node pointer.

[0184] Step S806: Traverse the target channel index red-black tree in a loop using the first node pointer. For any time in the first time and the second time, determine whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any time.

[0185] Step S808: If the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any time, the index node currently pointed to by the first node pointer is used as the query result currently stored by the second node pointer, and the loop ends.

[0186] Step S810: If the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is less than any time, the index node currently pointed to by the first node pointer is used as the query result currently stored by the second node pointer, and the first node pointer is made to point to the right child node of the index node currently pointed to.

[0187] Step S812: If the judgment result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is greater than any time, then the first node pointer is made to point to the left child node of the index node currently pointed to.

[0188] Step S814: Return to the step of determining whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any time, until they are equal or the next index node pointed to by the first node pointer is empty, then end the loop.

[0189] Step S816: In the target channel index list corresponding to the target video content source channel of the channel shared index structure, traverse and obtain the video slice files corresponding to each index node between the first index node and the second index node, and return them to the client.

[0190] It should be noted that the specific limitations of the above steps can be found in the specific limitations of a video slice management method described above.

[0191] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0192] Based on the same inventive concept, this application also provides a video slice management apparatus for implementing the video slice management method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more video slice management apparatus embodiments provided below can be found in the limitations of the video slice management method described above, and will not be repeated here.

[0193] In one embodiment, as shown in FIG9, a video slice management device is provided, including: a receiving module 910, a query module 920, and a traversal module 930, wherein:

[0194] The receiving module 910 is used to receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0195] Query module 920 is used to query, in the target channel index red-black tree corresponding to the target video content source channel of the channel shared index structure, a first index node matching the first time and a second index node matching the second time; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as a key; and

[0196] The traversal module 930 is used to traverse the target channel index list corresponding to the target video content source channel in the channel shared index structure to obtain the video slice files corresponding to each index node between the first index node and the second index node, and return them to the client; the target channel index list is used to indicate the time order of each index node in the target channel index red-black tree.

[0197] In one embodiment, when the video playback request is an HLS request, the traversal module 930 is specifically used to traverse and obtain the video slice information stored in each index node between the first index node and the second index node; generate an m3u8 playlist file based on the video slice information; the m3u8 playlist file includes the slice download address of the video slice file corresponding to each index node between the first index node and the second index node; send the m3u8 playlist file to the client; the client is used to send a slice download request to the live streaming server system based on the slice download address in the m3u8 playlist file; and in response to the slice download request, send the video slice file corresponding to each index node between the first index node and the second index node to the client.

[0198] In one embodiment, when the video playback request is an RTSP request, the traversal module 930 is specifically used to traverse and obtain the video slice files corresponding to each index node between the first index node and the second index node; and to return each of the traversed video slice files to the client in chronological order.

[0199] In one embodiment, the timestamp information includes the absolute timestamp of the slice start time corresponding to the video slice file; the query module 920 is specifically used to create a first node pointer and a second node pointer; the first node pointer points to the root node of the target channel index red-black tree; the second node pointer is used to store the query result, which is initially set to null; the target channel index red-black tree is traversed cyclically through the first node pointer, and for any time of the first time and the second time, it is determined whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to the any time; and according to the determination result, the query result currently stored in the second node pointer is updated; the currently stored query result is used to determine the index node that matches the any time.

[0200] In one embodiment, the query module 920 is specifically used to, when the judgment result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the times, take the index node currently pointed to by the first node pointer as the query result currently stored by the second node pointer and end the loop; the index node in the query result currently stored by the second node pointer is the index node that matches any of the times.

[0201] In one embodiment, the query module 920 is specifically configured to: when the judgment result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is less than any of the times, use the index node currently pointed to by the first node pointer as the query result currently stored by the second node pointer, and make the first node pointer point to the right child node of the currently pointed-to index node; when the judgment result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is greater than any of the times, make the first node pointer point to the left child node of the currently pointed-to index node; and return to the step of judging whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the times, until they are equal or the next index node pointed to by the first node pointer is empty, and end the loop.

[0202] In one embodiment, the apparatus further includes: an update module, configured to receive and parse the video source stream of the target video content source channel; determine whether the duration of the current slice of the video source stream meets a preset threshold; and if so, insert the absolute timestamp of the slice start time corresponding to the current slice as a key into the target channel index red-black tree and the target channel index linked list.

[0203] In one embodiment, the apparatus further includes: a deletion module, configured to perform a timed cleanup task on the target video content source channel at preset time intervals; the timed cleanup task is configured to obtain a first difference between a first timestamp and a second timestamp; the first timestamp is the absolute timestamp of the slice start time corresponding to the first node in the target channel index red-black tree; the second timestamp is the absolute timestamp of the slice start time corresponding to the starting node in the target channel index linked list; the timed cleanup task is further configured to delete the video slice file corresponding to the starting node and release the memory resources of the video slice information maintained by the starting node when the first difference is greater than a preset protection duration.

[0204] In one embodiment, the timed cleanup task is further configured to obtain a second difference between the current timestamp and the first timestamp; the timed cleanup task is further configured to delete the first node in the target channel index red-black tree if the second difference is greater than a preset maximum playback duration.

[0205] Each module in the aforementioned video slicing management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0206] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram is shown in Figure 10. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes non-volatile or volatile storage media and internal memory. The non-volatile or volatile storage media stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile or volatile storage media. The database of the computer device stores video slice file data. The input / output interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communication with external terminals via a network connection. When the computer-readable instructions are executed by the processor, a video slice management method is implemented.

[0207] Those skilled in the art will understand that the structure shown in Figure 10 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or may combine certain components, or may have different component arrangements.

[0208] A computer device includes a memory and one or more processors, the memory storing computer-readable instructions that, when executed by the processors, cause the one or more processors to perform the following steps:

[0209] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0210] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0211] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0212] One or more computer-readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the following steps:

[0213] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0214] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0215] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0216] A computer program product includes a computer program that, when executed by one or more processors, causes the one or more processors to perform the following steps:

[0217] Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time.

[0218] In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and

[0219] In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

[0220] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0221] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a non-volatile computer-readable storage medium. When executed, these computer-readable instructions can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0222] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0223] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method of video slice management, wherein, The method includes: Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time. In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree using the timestamp information of the corresponding video slice file as the key; and In the target channel index linked list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client; the target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

2. The method of claim 1, wherein, When the video playback request is an HLS request, the step of traversing and retrieving the video slice files corresponding to each index node between the first index node and the second index node, and returning them to the client, includes: Iterate through and retrieve the video slice information stored in each index node between the first index node and the second index node; Based on the video slice information, an m3u8 playlist file is generated; the m3u8 playlist file includes the slice download address of the video slice file corresponding to each index node between the first index node and the second index node; The m3u8 playlist file is sent to the client; the client is used to send a segment download request to the live streaming server system based on the segment download address in the m3u8 playlist file; and In response to the slice download request, the video slice files corresponding to each index node between the first index node and the second index node are sent to the client.

3. The method of claim 1, wherein, When the video playback request is an RTSP request, the step of traversing and retrieving the video slice files corresponding to each index node between the first index node and the second index node, and returning them to the client, includes: Iterate through and obtain the video slice files corresponding to each index node between the first index node and the second index node; and The video slice files that have been traversed are returned to the client in chronological order.

4. The method of claim 1, wherein, The timestamp information includes the absolute timestamp of the slice start time corresponding to the video slice file; the step of querying the first index node matching the first time and the second index node matching the second time in the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure includes: Create a first node pointer and a second node pointer; the first node pointer points to the root node of the target channel index red-black tree; the second node pointer is used to store the query result, which is initially set to null. By iterating through the target channel index red-black tree using the first node pointer, for any time between the first time and the second time, determine whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any given time; and Based on the judgment result, update the query result currently stored in the second node pointer; the currently stored query result is used to determine the index node that matches any of the times.

5. The method of claim 4, wherein, The step of updating the query result currently stored in the second node pointer based on the judgment result includes: If the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the times indicated by the judgment result, the index node currently pointed to by the first node pointer is taken as the query result currently stored by the second node pointer, and the loop ends; the index node in the query result currently stored by the second node pointer is the index node that matches any of the times.

6. The method of claim 5, wherein, The step of updating the query result currently stored in the second node pointer based on the judgment result includes: If the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is less than any of the times indicated by the judgment result, the index node currently pointed to by the first node pointer is taken as the query result currently stored by the second node pointer, and the first node pointer is made to point to the right child node of the index node currently pointed to. If the determination result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is greater than any of the aforementioned times, then the first node pointer is set to point to the left child node of the currently pointed-to index node; and Return to the step of determining whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the timestamps, until they are equal or the next index node pointed to by the first node pointer is empty, then end the loop.

7. The method of claim 1, wherein, The method further includes: Receive and parse the video source stream of the target video content source channel; Determine whether the duration of the current slice of the video source stream meets a preset threshold; and If the conditions are met, the absolute timestamp of the slice start time corresponding to the current slice is used as the key and inserted into the target channel index red-black tree and the target channel index linked list.

8. The method of claim 1, wherein, The method further includes: A timed cleanup task is performed on the target video content source channel at preset intervals. The scheduled cleanup task is used to obtain a first difference between a first timestamp and a second timestamp; the first timestamp is the absolute timestamp of the slice start time corresponding to the first node in the target channel index red-black tree; the second timestamp is the absolute timestamp of the slice start time corresponding to the first node in the target channel index linked list. The timed cleanup task is also used to delete the video slice file corresponding to the starting node and release the memory resources of the video slice information maintained by the starting node when the first difference is greater than the preset protection duration.

9. The method of claim 8, wherein, The scheduled cleanup task is also used to obtain a second difference between the current timestamp and the first timestamp; the scheduled cleanup task is also used to delete the first node in the target channel index red-black tree if the second difference is greater than the preset maximum playback duration.

10. A video slice management device, comprising: The receiving module is used to receive video playback requests sent by the client; The video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time. The query module is used to query a first index node that matches the first time and a second index node that matches the second time in the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree with the timestamp information of the corresponding video slice file as the key; and The traversal module is used to traverse the target channel index chain corresponding to the target video content source channel in the channel shared index structure, obtain the video slice file corresponding to each index node between the first index node and the second index node, and return it to the client. The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

11. A computer device comprising a memory and one or more processors, the memory storing computer-readable instructions that, when executed by the processors, cause the one or more processors to perform the following steps: Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time. In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree with the timestamp information of the corresponding video slice file as the key; and In the target channel index chain list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client. The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

12. One or more computer-readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the following steps: Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time. In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree with the timestamp information of the corresponding video slice file as the key; and In the target channel index chain list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client. The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.

13. The storage medium of claim 12, wherein, When the computer-readable instructions are executed by the processor, the following steps are also performed: Iterate through and retrieve the video slice information stored in each index node between the first index node and the second index node; Based on the video slice information, generate an m3u8 playlist file; The m3u8 playlist file includes the slice download address of the video slice file corresponding to each index node between the first index node and the second index node; Send the m3u8 playlist file to the client; The client is used to send a slice download request to the live streaming server system based on the slice download address in the m3u8 playlist file; and In response to the slice download request, the video slice files corresponding to each index node between the first index node and the second index node are sent to the client.

14. The storage medium of claim 12, wherein, When the computer-readable instructions are executed by the processor, the following steps are also performed: Iterate through and obtain the video slice files corresponding to each index node between the first index node and the second index node; and The video slice files that have been traversed are returned to the client in chronological order.

15. The storage medium of claim 12, wherein, The timestamp information includes the absolute timestamp of the start time of the video slice file; when the computer-readable instruction is executed by the processor, the following steps are also performed: Create a first node pointer and a second node pointer; the first node pointer points to the root node of the target channel index red-black tree; the second node pointer is used to store the query result, which is initially set to null. By iterating through the target channel index red-black tree using the first node pointer, for any time between the first time and the second time, determine whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any time. and Based on the judgment result, update the query result currently stored in the second node pointer; the currently stored query result is used to determine the index node that matches any of the times.

16. The storage medium of claim 15, wherein, When the computer-readable instructions are executed by the processor, the following steps are also performed: If the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the times indicated by the judgment result, the index node currently pointed to by the first node pointer is taken as the query result currently stored by the second node pointer, and the loop ends. The index node in the query result currently stored by the second node pointer is the index node that matches any of the times.

17. The storage medium of claim 16, wherein, When the computer-readable instructions are executed by the processor, the following steps are also performed: If the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is less than any of the times indicated by the judgment result, the index node currently pointed to by the first node pointer is taken as the query result currently stored by the second node pointer, and the first node pointer is made to point to the right child node of the index node currently pointed to. If the determination result indicates that the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is greater than any of the times, then the first node pointer is made to point to the left child node of the currently pointed-to index node. and Return to the step of determining whether the absolute timestamp of the slice start time corresponding to the index node currently pointed to by the first node pointer is equal to any of the timestamps, until they are equal or the next index node pointed to by the first node pointer is empty, then end the loop.

18. The storage medium of claim 12, wherein, When the computer-readable instructions are executed by the processor, the following steps are also performed: Receive and parse the video source stream of the target video content source channel; Determine whether the duration of the current slice of the video source stream meets a preset threshold; and If the conditions are met, the absolute timestamp of the slice start time corresponding to the current slice is used as the key and inserted into the target channel index red-black tree and the target channel index linked list.

19. The storage medium of claim 12, wherein, When the computer-readable instructions are executed by the processor, the following steps are also performed: A timed cleanup task is performed on the target video content source channel at preset intervals. The scheduled cleanup task is used to obtain a first difference between a first timestamp and a second timestamp; the first timestamp is the absolute timestamp of the slice start time corresponding to the first node in the target channel index red-black tree; the second timestamp is the absolute timestamp of the slice start time corresponding to the first node in the target channel index linked list. The timed cleanup task is also used to delete the video slice file corresponding to the starting node and release the memory resources of the video slice information maintained by the starting node when the first difference is greater than the preset protection duration.

20. The storage medium of claim 19, wherein, The scheduled cleanup task is also used to obtain a second difference between the current timestamp and the first timestamp; the scheduled cleanup task is also used to delete the first node in the target channel index red-black tree if the second difference is greater than the preset maximum playback duration.

21. A computer program product comprising a computer program that, when executed by one or more processors, causes the one or more processors to perform the following steps: Receive a video playback request sent by the client; the video playback request is used to request video content from the target video content source channel within the time range from the first time to the second time. In the target channel index red-black tree corresponding to the target video content source channel in the channel shared index structure, a first index node matching the first time and a second index node matching the second time are queried; the target channel index red-black tree includes index nodes corresponding to multiple video slice files originating from the target video content source channel; each index node is inserted into the target channel index red-black tree with the timestamp information of the corresponding video slice file as the key; and In the target channel index chain list corresponding to the target video content source channel in the channel shared index structure, the video slice files corresponding to each index node between the first index node and the second index node are traversed and returned to the client. The target channel index linked list is used to indicate the time order of each index node in the target channel index red-black tree.