Channel switching method, system and device, electronic equipment and readable storage medium

By acquiring and parsing channel switching requests in user mode and reading video data periodically, the problems of stuttering and resource consumption during IPTV channel switching are solved, achieving an efficient channel switching process and improving system performance.

CN121888030APending Publication Date: 2026-04-17CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511829981.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-05
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In Internet Protocol Television (IPTV) scenarios, when switching channels, it is impossible to determine exactly where the player is at the start of the live stream frame, causing the player to stutter. Furthermore, existing fast channel switching systems require frequent kernel-mode data switching, resulting in high system resource consumption and significant performance bottlenecks.

Method used

The process, running in user space, acquires the target channel switching request, parses the channel information, and reads video data according to a preset period, bypassing the kernel protocol stack to perform channel switching, thus avoiding data copying and context switching.

Benefits of technology

It reduces the system resource usage during channel switching, improves the performance of the channel switching system, reduces latency and stuttering, and ensures the continuity of the live stream.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121888030A_ABST
    Figure CN121888030A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a channel switching method, system and device, electronic equipment and a computer readable storage medium. The method specifically comprises the steps of obtaining a target channel switching request under the condition that a current process enters a service state; the current process runs in a user mode; analyzing the target channel switching request to obtain target channel information; the target channel information comprises application layer information and protocol layer information corresponding to the target channel switching request; reading video data corresponding to the target channel according to the application layer information and a preset period; and pushing video data to the client according to the protocol layer information so as to switch the current channel to the target channel. According to the invention, channel switching can be realized in a user mode, a kernel protocol stack is bypassed, use of a large number of system calls is prevented, and context switching and data copying of the user mode and the kernel mode through the kernel protocol stack are avoided, so that delay of data pushing is reduced, occupation of resources such as a CPU (Central Processing Unit) of the system is greatly reduced, and the overall performance of the channel switching system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a channel switching method, system, device, electronic device, and computer-readable storage medium. Background Technology

[0002] In Internet Protocol Television (IPTV) scenarios, multicast methods based on the Real-time Transport Protocol (RTP) are widely used to provide live streaming services to users. When a user joins a multicast group, because it is impossible to determine exactly where they are at the beginning of the live stream frame, the player may experience stuttering, resulting in slow channel switching.

[0003] In related technologies, before joining a live channel multicast, users can request a unicast stream from the Fast Channel Change (FCC) system. The FCC system transmits the video stream to the user at double speed from the latest starting frame using the RTP protocol until it is synchronized with the live stream, thereby improving the channel switching speed of the live stream.

[0004] However, in the relevant technologies, the current FCC system needs to receive and parse hundreds of live stream sources in real time through the kernel, and provide high-speed unicast push services to a large number of users. This results in frequent switching between user-mode data and kernel-mode data, leading to high system resource consumption and obvious performance bottlenecks.

[0005] Application content This application provides a channel switching method, system, device, electronic device, and computer-readable storage medium, which can reduce the system resource occupancy rate during channel switching and improve the performance of the channel switching system.

[0006] In a first aspect, this application provides a channel switching method, the method comprising: If the current process enters the service state, it retrieves the target channel switching request; the current process is running in user mode. The target channel switching request is parsed to obtain the target channel information; the target channel information includes the application layer information and protocol layer information corresponding to the target channel switching request. Based on application layer information, read the video data corresponding to the target channel according to a preset cycle; Based on protocol layer information, video data is pushed to the client to switch the current channel to the target channel.

[0007] Secondly, this application provides a channel switching device, which includes: an acquisition module, a parsing module, a reading module, and a push module.

[0008] The acquisition module is used to acquire target channel switching requests when the current process enters the service state; the current process runs in user mode. The parsing module is used to parse the target channel switching request to obtain the target channel information; the target channel information includes the application layer information and protocol layer information corresponding to the target channel switching request. The reading module is used to read the video data corresponding to the target channel according to the application layer information and a preset period. The push module is used to push video data to the client based on protocol layer information in order to switch the current channel to the target channel.

[0009] Thirdly, this application provides an electronic device including a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors as described above in the channel switching method.

[0010] Fourthly, this application provides a computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the aforementioned channel switching method.

[0011] The embodiments of this application have the following advantages: In this embodiment, when the current process enters the service state, a target channel switching request is obtained. The current process is restricted to user mode with limited permissions; even if subsequent processing exceptions occur, only the current process is affected, without causing kernel crashes or interruptions to other process services. Furthermore, the current process running in user mode bypasses the kernel protocol stack, eliminating the need for data copying and context switching when receiving subsequent requests, thus laying the foundation for low latency. The target channel switching request is then parsed to obtain target channel information, including application layer and protocol layer information corresponding to the request. This allows for full protocol layer information parsing, obtaining business requirements and transmission parameters, providing data support for subsequent channel switching. Finally, based on the application layer information, video data corresponding to the target channel is read at a preset period. Based on the protocol layer information, video data is pushed to the client to switch the current channel to the target channel. This allows for channel switching processing in user mode, and reading data at a preset period ensures the continuity of the live stream while avoiding frequent readings that could strain the central processing unit (CPU). Unit (CPU) overload, while user-mode encapsulation can prevent the use of a large number of system calls, avoid context switching and data copying between user mode and kernel mode through the kernel protocol stack, thereby reducing the latency of data push, significantly reducing the system's CPU and other resource consumption, and improving the overall performance of the channel switching system. Attached Figure Description

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

[0013] Figure 1 This is a schematic diagram of a channel switching system architecture provided in an embodiment of this application; Figure 2 This is a flowchart illustrating the steps of a channel switching method provided in an embodiment of this application; Figure 3 This is a flowchart of another channel switching method provided in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the specific implementation process of a channel switching method provided in an embodiment of this application; Figure 5 This is a schematic diagram illustrating the specific implementation process of initializing a second communication interface according to an embodiment of this application; Figure 6 This is a schematic diagram of a target channel switching request filtering process provided in this embodiment; Figure 7 This is a schematic diagram of another channel switching system architecture provided in an embodiment of this application; Figure 8 This is a structural block diagram of a channel switching device provided in an embodiment of this application; Figure 9 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0014] 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, 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.

[0015] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and are not limited in number; for example, a first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In the embodiments of this application, the term "multiple" refers to two or more, and other quantifiers are similar.

[0016] In Internet Protocol Television (IPTV) scenarios, multicast methods based on the Real-time Transport Protocol (RTP) are widely used to provide live streaming services to users. When a user joins a multicast group, because it is impossible to determine exactly where they are at the beginning of the live stream frame, the player may experience stuttering, resulting in slow channel switching.

[0017] In related technologies, before joining a live channel multicast, users can request a unicast stream from the Fast Channel Change (FCC) system. The FCC system transmits the video stream to the user at double speed from the latest starting frame using the RTP protocol until it is synchronized with the live stream. This can effectively solve the problem of slow channel switching when providing live streaming via multicast and improve the user experience. Figure 1 This is a schematic diagram of a channel switching system architecture provided in the embodiments of this application; as shown... Figure 1 As shown, the channel switching system may include a content source, a client, a kernel protocol stack, and a fast channel switching subsystem, such as the FCC system.

[0018] Content sources can include the original content that needs to be distributed (such as videos, files, etc.).

[0019] The client can actively initiate a request to retrieve content; or it can passively receive content pushed by the system.

[0020] The kernel stack can transmit data from the content source to the FCC system, and the client and the FCC system can also interact with each other through the kernel stack.

[0021] The FCC system comprises multiple sub-modules responsible for receiving, parsing, caching, and distributing data.

[0022] For example, the FCC system can obtain content source data from the content source, parse the content source data through the video stream parsing module, and then store the parsed content source data into a shared cache through the cache management module. When a client sends a request for content to the FCC system through the Kernel Stack, the FCC system can receive the client's request, parse the request through the request channel parsing module, control the reading of content from the cache block through the cache management module, and push the read content to the client through the Kernel Stack.

[0023] However, in the relevant technologies, the current FCC system needs to receive and parse hundreds of live stream sources in real time through the kernel, and provide high-speed unicast push services to a large number of users. This results in frequent switching between user-mode data and kernel-mode data, leading to high system resource consumption and obvious performance bottlenecks.

[0024] IPTV is a technology that transmits television content over an Internet Protocol (IP) network. Unlike traditional broadcast television (such as cable TV and satellite TV), IPTV utilizes broadband networks, such as fiber optics, Digital Subscriber Line (DSL), and 5th Generation Mobile Networks (5G), to achieve real-time transmission or on-demand video streaming. Users can watch content through devices such as smart TVs, set-top boxes, mobile phones, and computers.

[0025] The FCC (Fast Channel Switching) technology addresses the issue of delayed channel switching for users accessing live streaming services via multicast. When joining a multicast stream, users may experience stuttering lasting longer than a second because they cannot guarantee they will be positioned precisely at a keyframe in the live video stream, resulting in a poor user experience. Introducing the FCC system can effectively reduce channel switching time for users accessing live streaming services via multicast to within seconds, thus improving the user experience.

[0026] RTP is a network protocol specifically designed for transmitting real-time data (such as audio and video streams) over the Internet. Defined by the Internet Engineering Task Force (IETF) in RFC 3550, it is widely used in real-time communication scenarios (such as video conferencing, IPTV live streaming, and IP telephony) to ensure timely and low-latency data transmission.

[0027] Multicast is a type of IP transmission method that allows a message to be sent from one source and forwarded to a specific group of receivers, with only one copy of the message on each transmission link. Compared to traditional unicast and broadcast, multicast can effectively save network bandwidth and reduce network load, and is therefore widely used in network services such as IPTV, real-time data transmission, and multimedia conferencing.

[0028] Against this background, embodiments of this application provide a channel switching method that can reduce the system resource occupancy rate during channel switching and improve the performance of the channel switching system.

[0029] The channel switching method of this application embodiment will be further described below with reference to the relevant accompanying drawings and embodiments: Figure 2 This is a flowchart illustrating the steps of a channel switching method provided in an embodiment of this application. Figure 2 As shown, the method may include steps 201-204.

[0030] Step 201: If the current process is in service state, obtain the target channel switching request.

[0031] In this embodiment, after the current process completes the initialization process, it enters the service state. The current process runs in user mode, meaning it lacks kernel-mode privileges and cannot directly manipulate hardware, such as network card direct memory access (DMA), video memory, or directly access kernel space memory, such as the kernel protocol stack buffer. A target channel switching request can be understood as a network request initiated by the client to switch video playback channels. For example, in IPTV, switching from channel 1 to channel 2, where channel 1 can be understood as the current channel and channel 2 as the target channel; or, for example, a live streaming platform switching from game streaming to entertainment streaming, where game streaming can be understood as the current channel and entertainment streaming as the target channel. With the current process in the service state, the channel switching system can receive target channel switching requests initiated by the client; these requests can also be called FCC requests.

[0032] Step 202: Parse the target channel switching request to obtain the target channel information.

[0033] In this embodiment, the target channel switching request can be understood as a data packet encapsulated by multiple layers of network protocols. The network protocol layer of the data packet corresponding to the target channel switching request can be parsed, the protocol header stripped, and key information extracted to obtain the target channel information. The target channel information may include application layer information and protocol layer information corresponding to the target channel switching request. The application layer information includes business-related fields agreed upon between the server and client of the FCC system, used to locate the video data to be played after the channel switch, such as video data of the target channel read from the cache area. The protocol layer information may include network transmission-related protocol parameters used to accurately push the read video data to the client, such as sending via UDP protocol and adapting the client's receiving window.

[0034] For example, when parsing a target channel switching request, the network protocol validity can be checked first to see if the request starts with a conventional identifier to exclude illegal requests. Then, the fields are split by delimiter. The string is then converted to the corresponding type, such as converting the target channel identifier (ID) to an integer and the bitrate to an enumeration value, and its validity is verified, such as whether the target channel ID exists and whether the bitrate is supported. Finally, the parsing result, namely the target channel information mentioned above, is obtained.

[0035] Step 203: Based on the application layer information, read the video data corresponding to the target channel according to the preset cycle.

[0036] For example, a client-side push timed write event can be added periodically. Each time the timed write event is triggered, the video data corresponding to the target channel is read once. When the preset period is 10 milliseconds (ms), a timed write event is triggered every 10 milliseconds, and the video data corresponding to the target channel is read every 10 ms based on application layer information. Simultaneously, when reading the video data corresponding to the target channel, reading starts from the latest keyframe, and the amount of data read each time is a preset multiple of the original data amount. This reduces video playback stuttering and latency when pushing video data to the user, allowing the user to immediately see a clear video picture. For example, when reading the video data corresponding to the target channel, it can start from the latest keyframe. Based on the actual scenario requirements, the preset multiple can be determined to be 1.3, so video data is read once every 10 ms, and the amount of video data read is 1.3 times the amount of data played within 10 ms.

[0037] Step 204: Push video data to the client according to the protocol layer information to switch the current channel to the target channel.

[0038] In this embodiment, the read video data can first be processed to form a complete transmittable data packet. Then, based on the protocol layer information, the communication interface required to push the video data to the client is selected from multiple communication interfaces (xdp sockets) corresponding to the current process. The video data is then pushed to the client through this communication interface to switch the client's current channel to the target channel.

[0039] After pushing video data to the client, it can be checked whether the currently pushed video frame has reached the target technical position requested by the user. If it has, the video switching process for that client ends, meaning no more timed write events are added. If it hasn't, the timed write event for the next cycle is added, and the video data pushing process is repeated until the currently pushed video frame reaches the target technical position requested by the user. The target technical position can be understood as the current playback time of the target channel. After reaching the user-requested target technical position, the video switching process for that client ends, and the client joins the normal live stream push, meaning it can directly obtain data from the live stream data source without needing FCC system forwarding. This can also be understood as the client joining the multicast of the target channel.

[0040] This embodiment of the application, when the current process enters the service state, acquires the target channel switching request; and restricts the current process to run in user mode with limited permissions, so even if subsequent processing exceptions occur, only the current process will be affected, without causing kernel crashes or interruptions to other process services. Furthermore, the current process running in user mode can bypass the kernel protocol stack, and subsequent request reception does not require data copying or context switching, laying the foundation for low latency; subsequently, the target channel switching request is parsed to obtain target channel information; the target channel information includes application layer information and protocol layer information corresponding to the target channel switching request; it can achieve full protocol layer information parsing to obtain business requirements and transmission parameters. This provides data support for subsequent channel switching; finally, based on application layer information, it reads the video data corresponding to the target channel according to a preset period; based on protocol layer information, it pushes video data to the client to switch the current channel to the target channel. The channel switching process can be implemented in user space. Reading data according to a preset period ensures the continuity of the live stream and avoids frequent reading that could cause CPU overload. At the same time, user space encapsulation can prevent the use of a large number of system calls and avoid context switching and data copying between user space and kernel space through the kernel protocol stack, thereby reducing the latency of data push, significantly reducing the system's CPU and other resource consumption, and improving the overall performance of the channel switching system.

[0041] Figure 3 This is a flowchart illustrating the steps of another channel switching method provided in an embodiment of this application. Figure 3 As shown, the method includes steps 301-308.

[0042] Step 301: Obtain the first network card queue corresponding to the current process.

[0043] Step 302: Initialize the second communication interface corresponding to each first network card queue.

[0044] Step 303: After each second communication interface has been initialized, obtain the target channel switching request.

[0045] In this embodiment of the application, for steps 301-303, each process can correspond to multiple first network card queues, and each first network card queue can correspond to a second communication interface (xdp socket). It can also be understood that each network card queue is only bound to one second communication interface, that is, the first network card queue and the second communication interface correspond one-to-one.

[0046] For example, regarding the correspondence between processes and network interface card (NIC) queues, assuming there are a total of N NICs, each NIC has y queues, and the N NICs have a total of M queues, and the FCC system starts a total of P processes, then the queue set of all NICs is: [eth0_0, eth0_1, eth0_2, ..., eth1_0, eth1_1, ..., ethN-1_y-1]; the queue set of all NICs can be simplified to: [0, 1, 2...y-1, y...M-1]; the NIC sequence corresponding to process x is: [x, x+P, x + 2P, ..., x+nP], where x+nP<= M-1.

[0047] For example, Figure 4 This is a schematic diagram illustrating the specific implementation flow of a channel switching method provided in an embodiment of this application. For example... Figure 4As shown, after the current process of the FCC system starts, S1 can be executed to load the eXpress DataPath (XDP) processing module; then, according to the correspondence between the current process and the network interface card (NIC) queue, S2 can be executed to extract the first NIC queue corresponding to the current process; subsequently, S3 can be executed to initialize the second communication interface corresponding to each first NIC queue; after the second communication interface initialization is completed, S4 can be executed to add FCC request processing read events based on each second communication interface; when the second communication interface corresponding to all first NIC queues is initialized, the current process enters the service state; that is, S5, the current process enters the service state; after the current process enters the service state, if an FCC request enters the current process, S6 can be executed to start the FCC processing flow based on the high-performance network data processing (eXpress Data Path, XDP) module. XDP is a high-performance network data path technology in the Linux kernel, implemented based on the extended Berkeley Packet Filter (eBPF) program. Its core objective is to perform high-speed processing directly at the network card driver layer before network data packets reach the kernel protocol stack, thereby significantly improving network performance and making it suitable for scenarios requiring low latency and high throughput.

[0048] Figure 5 This is a schematic diagram illustrating the specific implementation process of initializing a second communication interface according to an embodiment of this application. For example... Figure 5 As shown, when initializing the second communication interface, S1 can be executed first to determine if the network interface card queue number corresponding to the second communication interface is 0. If the network interface card queue number corresponding to the second communication interface is 0, S2 can be executed to load the eBPF program. Then, S3 can be executed to obtain the eBPF program mapping. If the network interface card queue number corresponding to the second communication interface is not 0, S3 can be executed to obtain the eBPF program mapping. Then, S4 can be executed to initialize the receive and send buffers. This can be understood as initializing the shared memory (receive buffer and send buffer) corresponding to the second communication interface for subsequent zero-copy data transmission and reception. After S4 is executed, S5 can be executed to create the second communication interface. This can be understood as creating a specific second xdp socket instance for the current network interface card queue. After S5 is executed, S6 can be executed to add the second communication interface to the eBPF program mapping. The newly created second communication interface is registered in the eBPF mapping table so that the eBPF program can forward the data packets of the corresponding network interface card queue to the second communication interface. After S6 is executed, the initialization process of the second communication interface can be ended.

[0049] This embodiment obtains the first network interface card (NIC) queue corresponding to the current process, initializes the second communication interface corresponding to each first NIC queue, and obtains the target channel switching request after each second communication interface has been initialized. This allows the current process to only interface with its own corresponding first NIC queue, with each queue independently carrying data and not being reused with queues of other processes. This avoids multiple processes competing for the same queue resources, reducing the risk of lock conflicts and data corruption. At the same time, each first NIC queue corresponds to a unique second communication interface, with the interface and queue strongly bound together. This ensures that data packets of this queue are transmitted only through the dedicated interface, without competing for resources with the interfaces of other queues, guaranteeing the independence of data transmission and reception. Furthermore, obtaining the target channel switching request after the interface initialization is complete can avoid eBPF forwarding failure or data packet loss due to interface insecurity, improving the success rate of request reception.

[0050] Step 304: Parse the target channel switching request to obtain the target channel information; the target channel information includes the application layer information and protocol layer information corresponding to the target channel switching request.

[0051] In this application embodiment, the specific implementation of step 304 can be referred to the relevant description of the specific implementation of step 202 above, and will not be repeated here.

[0052] Step 305: Based on the target channel identifier and video data playback parameters, read the video data corresponding to the target channel from the buffer area of ​​the channel switching system according to a preset cycle.

[0053] In this embodiment, the application layer information may include a target channel identifier and video data playback parameters. The target channel identifier may be a unique ID of the target channel. Video data playback parameters may include bitrate, resolution, and frame rate. The preset period can be understood as the time interval between video data pushes by the FCC system, for example, 10 milliseconds.

[0054] The target channel identifier is a unique index for the buffer. The buffer of the channel switching system can be organized and stored according to the target channel identifier (for example, each channel corresponds to an independent buffer area). The video data storage location of the target channel can be directly located through this identifier.

[0055] The video data playback parameters determine the starting point, data volume, and version of the video data to be read from the target channel. The video data playback parameters are used to read the video data corresponding to the target channel at a predetermined rate, multiplied by the original data volume per unit time.

[0056] The system can quickly locate the cache of video content for a target channel based on the target channel identifier. Using video data playback parameters, it reads the video data corresponding to the target channel from the cache area of ​​the channel switching system starting from the latest keyframe according to a preset cycle.

[0057] In this embodiment, according to the target channel identifier and video data playback parameters, video data corresponding to the target channel is read from the cache area of the channel switching system at a preset period, and when reading the video data corresponding to the target channel, it starts reading from the latest key frame. The key frame is the basic frame for video decoding and can be independently decoded without relying on other frames. Starting from the latest key frame for reading can enable the client to directly decode a clear picture and avoid the phenomenon of screen freeze and carding caused by starting from non-key frames. At the same time, video data corresponding to the target channel is read at a preset multiple of the original data volume at a preset period, which can improve the synchronization degree between the reading frequency and the client playback rhythm and increase the speed of channel switching.

[0058] Step 306: Perform a hash calculation on the network layer information and the transport layer information to obtain a hash calculation result.

[0059] In the embodiment of the present application, the fields in the network layer information and the transport layer information can be converted into a byte stream in a unified format to avoid hash conflicts caused by format differences; the preprocessed byte stream is input into a hash algorithm (such as CRC32, Jenkins Hash, xxHash, etc.), and a hash value with a fixed length (such as a 32-bit or 64-bit integer) is output, which is the above-mentioned hash calculation result. Requests from the same client always obtain the same hash value.

[0060] Step 307: Determine the first communication interface corresponding to the target channel switching request according to the hash calculation result.

[0061] Exemplarily, the total number K of the first communication interfaces of the current process can be modulo by the obtained hash value above, and the index value index = hash_value % K is obtained, and an index value is obtained, and the range of this index value is 0 ≤ index < K. For example, if the hash value is 123456 and the process takes over 3 first communication interfaces, that is, K = 3, then 123456 % 3 = 0, and the index value is 0. According to the index value obtained by modulo, the corresponding interface is extracted from the communication interface list of the current process as the first communication interface. For example, index 0 corresponds to xdp socket0 in the list, then xdp sock0 is the first communication interface corresponding to the target channel switching request.

[0062] Step 308: Push video data to the client through the first communication interface.

[0063] In this embodiment of the application, the video data corresponding to the target channel can be directly transmitted to the second network card queue bound to the first communication interface. The network card can convert the video data into a physical signal (e.g., an electrical signal or an optical signal) and push the video data to the client through the physical signal. The client video playback application listens to the corresponding port, receives the video data, and decodes and plays it.

[0064] This embodiment performs hash calculations on network layer and transport layer information to obtain hash results. Based on the hash results, it determines the first communication interface corresponding to the target channel switching request and pushes video data to the client through the first communication interface. This allows all video frames from the same client to be pushed through the same first communication interface, preventing data packet out-of-order issues caused by interface switching (e.g., the previous frame uses xdp sock0, and the next frame uses xdp sock1). The client does not need to perform additional frame reordering, avoiding stuttering and frame skipping. At the same time, the hash results from different clients are evenly distributed, and after modulo, the data to be transmitted can be evenly distributed to all first communication interfaces within the process, avoiding overload of a single interface (e.g., a large number of client streams concentrated on one interface), and fully utilizing the parallel processing capabilities of multiple interfaces and multiple network card queues.

[0065] Optionally, step 306 may include sub-steps 3061-3063.

[0066] Sub-step 3061: Extract the Internet Protocol addresses of the sending and receiving ends corresponding to the target channel switching request from the network layer information.

[0067] In this embodiment, the Internet Protocol address (IP address) of the sending end corresponding to the target channel switching request, i.e., the source IP address, or client IP, can be extracted from the network layer information. The client IP can be used to uniquely identify the network address of the terminal where the client is located. The Internet Protocol address of the receiving end corresponding to the target channel switching request, i.e., the destination IP address, or server IP, can be extracted from the network layer information. The server IP can be used to identify the server node currently providing the service.

[0068] Sub-step 3062: Extract the port information of the sending and receiving ends and the transmission protocol information corresponding to the target channel switching request from the transport layer information.

[0069] In this embodiment, the port information of the sending end corresponding to the target channel switching request, i.e., the source port, or client port, can be extracted from the transport layer information. The client port can be used to uniquely identify the live streaming application process on the client. The port information of the receiving end corresponding to the target channel switching request, i.e., the destination port number, or server port, can be extracted from the transport layer information. The server port can be used to identify the FCC push streaming service on the server. Transport protocol information can be extracted from the transport layer information. The transport protocol information may include the protocol type, such as the UDP protocol, to identify the protocol used for data transmission.

[0070] Sub-step 3063: Perform hash calculation on the Internet Protocol address, port information and transmission protocol information of the sending end and the receiving end to obtain the hash calculation result.

[0071] For example, the extracted Internet Protocol addresses, port information, and transport protocol information of the sender and receiver can be standardized in format. The standardized byte streams of the five fields are then concatenated in a fixed order to form a complete input byte stream, for example, sender IP byte stream → receiver IP byte stream → sender port byte stream → receiver port byte stream → transport protocol byte stream. The concatenated input byte stream can then be fed into a selected hash algorithm to output a fixed-length integer (e.g., CRC32 outputs a 32-bit integer 0x12345678, MurMurHash3 outputs a 64-bit integer 0x123456789ABCDEF0), which is the hash calculation result.

[0072] This embodiment extracts the Internet Protocol (IP) addresses of the sending and receiving ends corresponding to the target channel switching request from the network layer information, and extracts the port information and transport protocol information of the sending and receiving ends corresponding to the target channel switching request from the transport layer information. A hash calculation is then performed on the IP address, port information, and transport protocol information of the sending and receiving ends to obtain the hash calculation result. By combining IP address, port, and protocol, it is ensured that each client's channel switching request corresponds to a unique hash result, preventing confusion with other clients. The high distribution of the hash algorithm ensures that the hash results of different clients are evenly distributed, laying the foundation for load balancing of subsequent intra-process communication interfaces and further improving the overall performance of the system.

[0073] Optionally, the above channel switching method may also include steps 309-312.

[0074] Step 309: Obtain multiple network requests.

[0075] In this embodiment, a client can send multiple network requests. For example, multiple clients can send network requests simultaneously, with each client sending one network request, and the channel switching system can receive multiple network requests; or, a single client can send multiple network requests, and the channel switching system can also receive multiple network requests; or, multiple clients can send network requests simultaneously, with each client sending multiple network requests, and the channel switching system can also receive multiple network requests. The network packets from multiple network requests can enter the extended Berkeley Packet Filter (eBPF) program through the network interface card queue.

[0076] Step 310: Parse the network protocol layer of the network request to obtain the parsing information of the network request.

[0077] Step 311: Filter and parse network requests that meet the preset requirements.

[0078] Step 312: When the current process enters the service state, obtain network requests whose parsing information meets the preset requirements; network requests whose parsing information meets the preset requirements are target channel switching requests.

[0079] In this embodiment of the application, for steps 310-312, the eBPF program can perform simple network protocol layer parsing on the network data packets, which can also be understood as the eBPF program can parse the layer 2, layer 3 and layer 4 protocols of the network data packets to obtain the parsing information of the network request; and through the parsing information of the network request, filter out the network request that meets the preset requirements from multiple network requests, namely the target channel switching request.

[0080] For example, Figure 6 This is a schematic diagram of a target channel switching request filtering process provided in this embodiment. Figure 6 As shown, after a network packet enters the eBPF program through the network interface card queueX, S1 can be executed to parse the network packet. Based on the parsed information of the network packet, S2 is executed to determine whether the parsed information contains a Virtual Local Area Network (VLAN) header. If the parsed information contains a VLAN header, then execute S3 to determine whether the VLAN header is valid; If the parsed information does not contain a VLAN header, then execute S4 to determine whether the IP layer protocol is IPv4 or IPv6; If the VLAN header is valid, then execute S4 to determine whether the IP layer protocol is IPv4 or IPv6; If the VLAN header is invalid, execute S5 and pass it through to the kernel for processing; If the IP layer protocol is IPv4 or IPv6, then execute S6 to determine whether the transport layer protocol is UDP. If the IP layer protocol is not IPv4 or IPv6, then S5 is executed and passed through to the kernel for processing; If the transport layer protocol is UDP, then execute S7 to determine whether the UDP port number is the FCC service port; If the transport layer protocol is not UDP, then S5 is executed and passed through to the kernel for processing; If the UDP port number is the FCC service port, then execute S8 and forward the request to the xdpsocket corresponding to the network card queue queueX for processing.

[0081] After the eBPF program identifies the target channel switching request, it can send the request to the FCC system. For example, if the target channel switching request enters the eBPF program through network interface card (NIC) queue 1, and the eBPF program identifies the target channel switching request from multiple network requests, it can send the target channel switching request to the communication interface corresponding to NIC queue 1. When the current process is in service mode, the FCC system can receive the target channel switching request and execute the subsequent channel push process in response to it.

[0082] This embodiment acquires multiple network requests, parses their network protocol layers to obtain parsed information, filters network requests whose parsed information meets preset requirements, and finally, when the current process enters a service state, acquires network requests whose parsed information meets the preset requirements and limits them to target channel switching requests. The network data packets corresponding to the network requests can be processed directly at the network card driver layer. Simple network protocol layer parsing is performed on the network data packets to filter out user FCC requests, bypassing the kernel protocol stack, and forwarding them to the FCC system user-mode process for processing.

[0083] In one specific embodiment Figure 6 This is a schematic diagram illustrating another specific implementation of a channel switching method provided in an embodiment of this application. For example... Figure 6As shown, when starting the FCC processing flow based on the XDP module, S1 is executed first to respond to the FCC request read event and parse the network protocol layer of the FCC request data packet; then S2 is executed to process the FCC request and parse the application layer request content; then S3 is executed to add a client push timed write event; after S3 is executed, S4 is executed to respond to the write event and read the RTP unicast stream buffer at the double bitrate; after S4 is executed, S5 is executed to determine the first communication interface and push video data based on the hash result of the five-tuple information of the channel switching request; after pushing video data to the client, S6 is executed to determine whether the video data has been sent to the target technical location; if the video data has been sent to the target technical location, the current processing flow ends; if the video data has not been sent to the target technical location, it returns to executing S3 and adding a client push timed write event; until the video data is sent to the target technical location.

[0084] In summary, this embodiment of the application, when the current process enters the service state, obtains the target channel switching request; and restricts the current process to run in user mode with limited permissions, so even if subsequent processing exceptions occur, only the current process will be affected, and it will not cause kernel crashes or interruptions to other process services. At the same time, the current process running in user mode can bypass the kernel protocol stack, and subsequent request reception does not require data copying and context switching, laying the foundation for low latency; then, the target channel switching request is parsed to obtain the target channel information; the target channel information includes the application layer information and protocol layer information corresponding to the target channel switching request; it can realize full protocol layer information parsing to obtain business requirements and transmission parameters. The system first provides data support for subsequent channel switching; then, based on application layer information, it reads the video data corresponding to the target channel at a preset period; and finally, based on protocol layer information, it pushes the video data to the client to switch the current channel to the target channel. The channel switching process can be implemented in user space. Reading data at a preset period ensures the continuity of the live stream without frequent reading that could overload the CPU. At the same time, user space encapsulation can prevent the use of a large number of system calls and avoid context switching and data copying between user space and kernel space through the kernel protocol stack, thereby reducing the latency of data push, significantly reducing the system's CPU and other resource consumption, and improving the overall performance of the channel switching system.

[0085] Figure 7 This is a schematic diagram of another channel switching system architecture provided in an embodiment of this application; as shown Figure 7 As shown, the channel switching system may include: a client, a network interface card queue, an extended Berkeley packet filter (eBPF) program, and a fast channel switching subsystem (e.g., an FCC system).

[0086] The client is used to send target channel switching requests and receive video data corresponding to the target channel; The network interface card (NIC) queue is used to temporarily store target channel switching requests; The extended Berkeley packet filter is used to filter target channel switching requests from multiple network requests; The fast channel switching subsystem is used to obtain a target channel switching request when the current process enters the service state. The current process runs in user mode. The target channel switching request is parsed to obtain the target channel information. The target channel information includes the application layer information and protocol layer information corresponding to the target channel switching request. Based on the application layer information, the video data corresponding to the target channel is read at a preset period. Based on the protocol layer information, the video data is pushed to the client to switch the current channel to the target channel.

[0087] Optionally, the channel switching system may also include a content source and a kernel stack.

[0088] Content sources can include the original content of the target channel, such as the video stream from channel 1.

[0089] The kernel stack can pass data from the content source to the fast channel switching subsystem for caching.

[0090] Optionally, the fast channel switching subsystem may also include an XDP processing module, a content source event processing module, a video stream parsing module, a cache management module, a common cache module, a client request read event processing module, a client push write event processing module, and a request channel parsing module.

[0091] For example, the FCC system can obtain the live stream of the target channel from the content source, parse the live stream of the target channel through the video stream parsing module, and then store the parsed live stream of the target channel into the shared cache through the cache management module. When the current process enters the service state, the XDP processing module can receive client requests and add client request read events through the client request read event handling module. In response to triggering the client request read event, the request is parsed by the request channel parsing module. Then, client push timed write events are added through the client push timed write event handling module. In response to triggering the client push timed write event, the content in the cache block is read through the cache management module, and the read content is pushed to the client through the XDP processing module.

[0092] This application also provides a channel switching device. Figure 8 This is a structural block diagram of a channel switching device provided in an embodiment of this application. Figure 8 As shown, the channel switching device 800 may include: an acquisition module 801, a parsing module 802, a reading module 803, and a push module 804.

[0093] The acquisition module 801 is used to acquire the target channel switching request when the current process enters the service state; the current process runs in user mode. The parsing module 802 is used to parse the target channel switching request to obtain the target channel information; the target channel information includes the application layer information and protocol layer information corresponding to the target channel switching request. The reading module 803 is used to read the video data corresponding to the target channel according to the application layer information and a preset period. The push module 804 is used to push video data to the client based on protocol layer information in order to switch the current channel to the target channel.

[0094] Optionally, the application layer information includes the target channel identifier and video data playback parameters. The reading module 803 is specifically used to read the video data corresponding to the target channel from the cache area of ​​the channel switching system according to the target channel identifier and video data playback parameters at a preset period.

[0095] Optionally, the protocol layer information includes network layer information and transport layer information. The push module 804 is specifically used to perform hash calculation on the network layer information and transport layer information to obtain the hash calculation result; determine the first communication interface corresponding to the target channel switching request based on the hash calculation result; and push video data to the client through the first communication interface.

[0096] Optionally, the push module 804 is specifically used to extract the Internet Protocol addresses of the sender and receiver corresponding to the target channel switching request from the network layer information; extract the port information and transmission protocol information of the sender and receiver corresponding to the target channel switching request from the transport layer information; and perform hash calculation on the Internet Protocol address, port information and transmission protocol information of the sender and receiver to obtain the hash calculation result.

[0097] Optionally, the acquisition module 801 is specifically used to acquire the first network interface card queue corresponding to the current process; initialize the second communication interface corresponding to each first network interface card queue; the first network interface card queue and the second communication interface are in one-to-one correspondence; and acquire the target channel switching request after each second communication interface has been initialized.

[0098] Optionally, the acquisition module 801 is specifically used to acquire multiple network requests; parse the network protocol layer of the network requests to obtain the parsing information of the network requests; filter network requests whose parsing information meets preset requirements; when the current process enters the service state, acquire network requests whose parsing information meets preset requirements; and network requests whose parsing information meets preset requirements are target channel switching requests.

[0099] This application also provides an electronic device, with reference to... Figure 9 , Figure 9 This is a structural block diagram of an electronic device for channel switching provided in an embodiment of this application. Figure 9 As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store executable instructions, which cause the processor to execute the channel switching method of the aforementioned embodiment.

[0100] The processor can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable devices, transistor logic devices, hardware components, or any combination thereof. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.

[0101] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.

[0102] This application also provides a non-transitory computer-readable storage medium, which, when the instructions in the storage medium are executed by the processor of an electronic device (server or terminal), enables the processor to perform... Figure 2 or Figure 3 The channel switching method is shown.

[0103] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0104] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0105] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0106] These computer program instructions may also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing terminal device to operate in a predictive manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0107] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0108] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0109] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0110] The above provides a detailed description of a channel switching method, system, device, electronic device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A channel switching method, characterized in that, The method includes: When the current process enters the service state, it acquires a target channel switching request; the current process is running in user mode. The target channel switching request is parsed to obtain target channel information; the target channel information includes application layer information and protocol layer information corresponding to the target channel switching request. Based on the application layer information, read the video data corresponding to the target channel according to a preset period; The video data is pushed to the client based on the protocol layer information to switch the current channel to the target channel.

2. The method according to claim 1, characterized in that, The application layer information includes a target channel identifier and video data playback parameters. The step of reading the video data corresponding to the target channel according to the application layer information at a preset period includes: Based on the target channel identifier and the video data playback parameters, the video data corresponding to the target channel is read from the cache area of ​​the channel switching system according to a preset period.

3. The method according to claim 1, characterized in that, The protocol layer information includes network layer information and transport layer information. The step of pushing the video data to the client based on the protocol layer information to switch the current channel to the target channel includes: Perform a hash calculation on the network layer information and the transport layer information to obtain the hash calculation result; Based on the hash calculation result, determine the first communication interface corresponding to the target channel switching request; The video data is pushed to the client through the first communication interface.

4. The method according to claim 3, characterized in that, The step of performing hash calculations on the network layer information and the transport layer information to obtain hash calculation results includes: Extract the Internet Protocol addresses of the sending and receiving ends corresponding to the target channel switching request from the network layer information; Extract the port information of the sending and receiving ends and the transmission protocol information corresponding to the target channel switching request from the transport layer information; The Internet Protocol address, port information, and transmission protocol information of the sending end and the receiving end are hashed to obtain the hash calculation result.

5. The method according to claim 1, characterized in that, When the current process enters the service state, obtaining the target channel switching request includes: Obtain the first network interface card queue corresponding to the current process; The second communication interface corresponding to each of the first network interface card queues is initialized; the first network interface card queue and the second communication interface correspond one-to-one. Once each of the second communication interfaces has been initialized, the target channel switching request is obtained.

6. The method according to claim 1, wherein obtaining the target channel switching request when the current process enters the service state includes: Retrieve multiple network requests; The network protocol layer of the network request is parsed to obtain the parsing information of the network request; Filter network requests whose parsed information meets preset requirements; When the current process enters the service state, obtain the network request that meets the preset requirements based on the parsed information; The network request whose parsed information meets the preset requirements is the target channel switching request.

7. A channel switching system, characterized in that, The system includes: a client, a network interface card queue, an extended Berkeley packet filter, and a fast channel switching subsystem; The client is used to send a target channel switching request and receive video data corresponding to the target channel; The network interface card queue is used to temporarily store target channel switching requests; The extended Berkeley packet filter is used to filter the target channel switching request from multiple network requests; The fast channel switching subsystem is used to obtain a target channel switching request when the current process enters the service state; the current process runs in user mode; the target channel switching request is parsed to obtain target channel information; the target channel information includes application layer information and protocol layer information corresponding to the target channel switching request; according to the application layer information, video data corresponding to the target channel is read at a preset period; according to the protocol layer information, the video data is pushed to the client to switch the current channel to the target channel.

8. A channel switching device, characterized in that, The device includes: The acquisition module is used to acquire the target channel switching request when the current process enters the service state; the current process runs in user mode. The parsing module is used to parse the target channel switching request to obtain target channel information; the target channel information includes application layer information and protocol layer information corresponding to the target channel switching request. The reading module is used to read video data corresponding to the target channel according to the application layer information and at a preset period. The push module is used to push the video data to the client according to the protocol layer information, so as to switch the current channel to the target channel.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 6.