Data buffering processing method and apparatus, electronic device, and storage medium
By dynamically adjusting the data length threshold of the buffer and pausing or resuming the playback process based on network jitter, the problem of excessive player latency caused by a fixed buffer size is solved, improving playback smoothness and user experience.
Patent Information
- Application Number
- CN202310187828.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-02-22
AI Technical Summary
In existing technologies, a fixed buffer size cannot adapt to network jitter, resulting in excessively high latency for the player when the network is unstable, which affects the smoothness of playback.
By receiving media data packets and storing them in a data buffer, the data length threshold of the buffer is dynamically adjusted, and the playback process is paused or resumed based on network jitter values to ensure that the buffering strategy matches the network status.
It reduces memory usage, improves the player's adaptability to network jitter, avoids frequent pauses, and enhances playback smoothness and user experience.
Smart Images

Figure CN118540540B_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and more particularly to a data buffering processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Buffering refers to the process where a player pre-saves a portion of a file in a temporary folder on the local hard drive to improve playback smoothness when playing online video files. The buffering strategies provided by related technologies are based on dynamic buffers, meaning they divide the buffer into different sizes and perform buffering according to the corresponding buffer size during each playback. However, larger buffers result in higher memory consumption, which in turn affects the smoothness of application operation and leads to excessively high end-to-end latency.
[0003] There is currently no good buffering strategy to deal with network jitter. Summary of the Invention
[0004] This application provides a data buffering processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can ensure smooth playback of the player under various network conditions.
[0005] The technical solution of this application embodiment is implemented as follows: This application provides a data buffering processing method, the method comprising: Receive media data packets and store the media data packets in a data buffer; Invoke the media player to play the media data packets in the data buffer; In response to the data length in the data buffer being less than a first data length threshold, the playback process of the player is paused; Determine the network jitter value for receiving the media data packets; The second data length threshold is adjusted based on the network jitter value, wherein the second data length threshold before and after adjustment is greater than or equal to the first data length threshold. In response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold, the playback process of the player is resumed from the paused point in time.
[0006] This application provides a data buffering processing apparatus, including: The data receiving module is configured to receive media data packets and store the media data packets in a data buffer. The playback control module is configured to call the media player to play the media data packets in the data buffer; The playback control module is further configured to pause the playback process of the player in response to the data length in the data buffer being less than a first data length threshold. The data receiving module is also configured to determine the network jitter value for receiving the media data packets; The threshold adjustment module is configured to adjust a second data length threshold based on the network jitter value, wherein the second data length threshold before and after adjustment is greater than or equal to the first data length threshold. The playback control module is further configured to resume the playback process of the player from the paused point in response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold.
[0007] This application provides an electronic device, the electronic device comprising: Memory is used to store executable instructions for a computer; The processor, when executing computer-executable instructions stored in the memory, implements the data buffering processing method provided in the embodiments of this application.
[0008] This application provides a computer-readable storage medium storing computer-executable instructions for implementing the data buffering method provided in this application when executed by a processor.
[0009] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the data buffering processing method provided in this application.
[0010] The embodiments of this application have the following beneficial effects: By adjusting the second data length threshold of the data buffer based on network jitter values, the buffering strategy is matched to the network jitter values. This dynamically adjusts the playback process and the point at which playback resumes, improving the player's adaptability to network jitter, avoiding frequent pauses in playback, and reducing end-to-end latency during media data packet playback. Compared to techniques that dynamically adjust the total buffer capacity, this reduces memory usage, improves playback smoothness, and enhances the user experience. Attached Figure Description
[0011] Figure 1 This is a schematic diagram illustrating the application mode of the data buffering processing method provided in the embodiments of this application; Figure 2 This is a schematic diagram of the structure of the terminal device 400 provided in the embodiments of this application; Figures 3A to 3D This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figures 4A to 4C This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 5 This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 6 This is a threshold diagram of the data buffering processing method provided in the embodiments of this application; Figure 7A This is an optional flowchart illustrating the data buffering processing method provided in the embodiments of this application; Figure 7B This is a schematic diagram illustrating the principle of the buffering strategy provided in the embodiments of this application. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0014] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0015] It should be noted that in the embodiments of this application, user information, user feedback data and other related data are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0016] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0017] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0018] 1) Buffering refers to the process by which a player saves a portion of files in a temporary folder on the local hard drive before playing online video files to make playback smoother.
[0019] 2) Buffer, also known as temporary storage area, is a term derived from the fact that when high-speed and low-speed components of a computer communicate, the output of the high-speed component must be temporarily stored somewhere to ensure compatibility. The data filling of a player's buffer is mainly divided into two types: "active buffering" and "passive buffering."
[0020] 3) Active buffering refers to the player actively pausing data consumption in the buffer and waiting for data producers to gradually fill the data until a certain condition is met before resuming.
[0021] 4) Passive buffering refers to the situation where the rate of data consumption cannot keep up with the rate of data production, thus passively retaining data in the buffer.
[0022] 5) Network jitter is a parameter used to describe the degree of variation in network latency. For example, when network congestion occurs, queuing delays will affect end-to-end latency and cause packets transmitted over the same connection to have different delays. The degree of delay can be described by the jitter value. Jitter is an important parameter for real-time transmission.
[0023] The buffering strategies provided by related technologies are based on dynamic buffers, meaning that the player's buffering strategy does not change during the current playback. For example, EXOPlayer uses different protocols for different buffer levels, with varying buffer sizes and thresholds for buffered data volume before playback. IJKPlayer (a lightweight Android / iOS video player based on ffplay) uses an incremental buffer pattern; for example, the initial buffer length is 1 second, expanding to 2 seconds after the first pause, 3 seconds after another pause, and so on. However, these technologies only set the buffer size, resulting in a fixed buffering mode that cannot handle network jitter. While a larger buffer configuration can mitigate jitter, it leads to excessively high end-to-end latency. Even after the network stabilizes, the player's latency remains significant in some application scenarios (e.g., live streaming).
[0024] This application provides a data buffering method, a data buffering device, an electronic device, a computer-readable storage medium, and a computer program product, which can ensure smooth playback of the player under various network conditions.
[0025] The following describes exemplary applications of the electronic devices provided in the embodiments of this application. The electronic devices can be terminal devices. The terminal devices provided in the embodiments of this application can be implemented as various types of user terminals such as laptops, tablets, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), in-vehicle terminals, virtual reality (VR) devices, and augmented reality (AR) devices. The following will describe exemplary applications when the device is implemented as a terminal device.
[0026] refer to Figure 1 , Figure 1 This is a schematic diagram illustrating the application mode of the data buffering processing method provided in the embodiments of this application; for example, Figure 1 The system involves server 200, network 300, and terminal device 400. Terminal device 400 is connected to server 200 through network 300, which can be a wide area network (WAN), a local area network (LAN), or a combination of both.
[0027] In some embodiments, server 200 is the server of a live streaming platform, users are viewers watching the live stream, and terminal device 400 is a device with media player 401 installed, such as a mobile phone or laptop. Media player 401 can be a mini-program within a video application. Media player 401 has a buffer with a first data length threshold and a second data length threshold preset. When the current data length in the buffer is less than the first data length threshold, the playback process of media player 401 is paused; when the current data length in the buffer is greater than the second data length threshold, the playback process of the player resumes from the paused point.
[0028] For example, server 200 receives live video from the broadcaster's terminal device via network 300, and server 200 sends live video to the viewer's terminal device 400 via network 300. Terminal device 400 can call the data buffer processing method provided in this application embodiment to dynamically adjust the second data length threshold of the data buffer of media player 401. The second data length threshold is adjusted according to the network jitter value, which avoids the media player 401 from frequently pausing and resuming playback when the network jitter value is high, reduces the impact of network jitter on the player, improves the smoothness of the live video playback on terminal device 400, and enhances the user's viewing experience.
[0029] In some embodiments, the data buffering processing method of this application can also be applied in the following application scenarios: 1. Online Meetings. During video conferencing using video conferencing software, each participant is in a different network environment. In the event of network jitter, the terminal device can use the data buffering processing method provided in this application embodiment to adjust the data length threshold of the buffer, thereby reducing end-to-end latency and improving user experience.
[0030] 2. Cloud Gaming. Cloud gaming refers to a mode where the game logic is entirely run by the server, and the cloud server renders the game scene data into audio and video streams, which are then transmitted to the terminal device for display via the network. The terminal device only needs to have basic streaming media playback capabilities and the ability to obtain player operation commands and send them to the server. In cloud gaming scenarios, in the event of network jitter, the terminal device can call the data buffering processing method provided in this application embodiment to adjust the data length threshold of the buffer, thereby improving adaptability to network jitter and reducing game stuttering.
[0031] This application embodiment can be implemented using blockchain technology. The buffering strategy of this application embodiment can be uploaded to the blockchain for storage, and the reliability of the buffering strategy can be guaranteed by a consensus algorithm. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0032] This application embodiment can be implemented using database technology. A database, simply put, can be viewed as an electronic filing cabinet storing electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, having minimal redundancy, and being independent of application programs.
[0033] A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters or mobile devices; or according to the query language used, such as Structured Query Language (SQL) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, simultaneously supporting multiple query languages.
[0034] This application embodiment can also be implemented using cloud technology. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on cloud computing business models. It can form a resource pool, available on demand, and is flexible and convenient. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, and driven by demands for search services, social networks, mobile commerce, and open collaboration, every item may eventually have its own hash-coded identification mark, requiring transmission to a backend system for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.
[0035] In some embodiments, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal device can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment of the invention.
[0036] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the terminal device 400 provided in the embodiments of this application. Figure 2The terminal device 400 shown includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal device 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 440.
[0037] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0038] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0039] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0040] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0041] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0042] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 452 is used to reach other terminal devices via one or more (wired or wireless) network interfaces 420, such as Bluetooth, WiFi, and Universal Serial Bus (USB).
[0043] Presentation module 453 enables the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with user interface 430 (e.g., a display screen, a speaker, etc.).
[0044] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0045] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 A data buffer processing device 455 stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: a data receiving module 4551, a playback control module 4552, and a threshold adjustment module 4553. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0046] In some embodiments, the terminal or server can implement the data buffering processing method provided in this application by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a live streaming APP or an instant messaging APP; it can also be a mini-program, that is, a program that only needs to be downloaded into a browser environment to run; or it can be a mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plugin.
[0047] The data buffering method provided in the embodiments of this application will be described below. As before, the data buffering method of the embodiments of this application is implemented through a terminal device, so the execution subject of each step will not be described again below.
[0048] See Figure 3A , Figure 3A This is a flowchart illustrating the data buffering processing method provided in the embodiments of this application, which will be combined with... Figure 3A The steps shown are explained.
[0049] In step 301, media data packets are received and stored in a data buffer.
[0050] For example, media data packets can be audio data packets or video data packets. To facilitate understanding of the data buffering strategy, the concept of a buffer water mark is explained below. Imagine the buffer as a bucket, the data in the buffer as the water in the bucket, and the data length as the water volume. The buffer has a first data length threshold and a second data length threshold. If the first data length threshold is less than the second data length threshold, it means that the amount of data in the buffer is insufficient to support the playback process, and playback pauses. As more and more media data is received, the data length in the buffer gradually increases to the second data length threshold, and playback resumes from the paused point.
[0051] For example, the protocol used to read media data packets could be Hypertext Transfer Protocol-FlashVideo (HTTP-FLV), Real-Time Messaging Protocol (RTMP), Web Real-Time Communications (WebRTC), or other protocols. During data buffering, step 301 can be executed multiple times, for example, consecutively or intermittently, with step 302 executed after each execution of step 301.
[0052] In step 302, the media player is invoked to play the media data packets in the data buffer.
[0053] For example, in the embodiments of this application, the media player can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a live streaming APP or an instant messaging APP; it can also be a mini-program, that is, a program that only needs to be downloaded into the browser environment to run, such as a player plugin embedded in the network; or it can be a mini-program that can be embedded in any APP.
[0054] In step 303, in response to the data length in the data buffer being less than the first data length threshold, the playback process of the player is paused.
[0055] For example, data length can be characterized by the amount of data or the playback duration of the data, and the first data length threshold and the second data length threshold can be determined based on the actual application scenario.
[0056] In some embodiments, the data length threshold can be set in the following manner: obtain the total data length of the data buffer (the data length can be represented by duration or data volume); use the product between the total data length and the first data length ratio as the first data length threshold; use the product between the total data length and the second data length ratio as the second data length threshold; the first data length ratio is less than the second data length ratio, and the second data length ratio is less than one.
[0057] For example, the first data length ratio and the second data length ratio can be manually set according to the application scenario.
[0058] In step 304, the network jitter value of the received media data packets is determined.
[0059] For example, network jitter is a parameter used to measure network status. Network jitter can be represented by time, such as the difference between the transmission times of each media packet.
[0060] In some embodiments, reference Figure 3B , Figure 3B This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A Step 304 in the process can be achieved through Figure 3B Steps 3041A to 3045A are implemented, and the details are explained below.
[0061] In step 3041A, the sending time and receiving time of the currently received media data packet are obtained.
[0062] For example, the sending time of a media data packet is the time when the data source outputs the media data packet. For instance, if server 200 sends media data packet A to terminal device 400, the sending time is the time when media data packet A is sent by server 200. The receiving time is the time when the terminal device receives the media data packet. The sending time is carried by the media data packet, and the receiving time is obtained by the demuxer thread in the terminal device.
[0063] In step 3042A, the sending time and receiving time of the previous media data packet are obtained.
[0064] For example, the reception time of the previous media data packet is adjacent to the reception time of the next media data packet. That is, every two media data packets with adjacent reception times are combined into a data packet pair, and the transmission and reception times of each data packet in the data packet pair are obtained.
[0065] In step 3043A, the following processing is performed for each media data packet: obtain the first difference between the receiving time and the sending time, and use the first difference as the transmission duration of the media data packet.
[0066] For example: The currently received media data packet is data packet 1, and the first difference = (receive time T2 - send time T1) = transmission duration. The previous media data packet was data packet 2, and the first difference = (receive time T4 - send time T3).
[0067] In step 3044A, a second difference between the transmission duration of the media data packet and the transmission duration of the previous media data packet is obtained.
[0068] For example, when server 200 sends data packets to terminal device 400, the data size of each data packet is the same, but the transmission time of each data packet differs due to changes in network conditions. Continuing with the above example, the second difference = (receive time T2 - send time T1) - (receive time T4 - send time T3).
[0069] In step 3045A, the second difference is used as the network jitter value of the received media data packets.
[0070] In this embodiment, the network jitter value is characterized in real time based on the difference in transmission time corresponding to the data packets, which improves the accuracy of the network jitter value and thus improves the accuracy of the dynamic adjustment buffer strategy, making the playback of the player smoother, reducing the probability of stuttering, and improving the adaptability to network jitter.
[0071] In some embodiments, reference Figure 3C , Figure 3C This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A Step 304 in the process can be achieved through Figure 3C Steps 3041B to 3045B are implemented, and the details are explained below.
[0072] In step 3041B, the sending time and receiving time of the first number of received media data packets are obtained.
[0073] For example, the first number of media data packets is the first number of media data packets received most recently, and this first number can be preset according to the actual application scenario. Determining the network jitter value based on the difference in transmission time between multiple data packet pairs can improve the accuracy of obtaining the network jitter value.
[0074] In step 3042B, the following processing is performed for each media data packet: the first difference between the reception time of the media data packet and the transmission time of the media data packet is obtained, and the first difference is used as the transmission duration of the media data packet.
[0075] For example, the principle of obtaining the transmission duration is the same as in step 3043A, and will not be repeated here.
[0076] In step 3043B, a third difference between the transmission durations of the two media data packets in the media data packet pair is obtained.
[0077] For example, a media packet pair consists of two media packets received at adjacent times. Assuming five packets received at consecutive times—packets 1 through 5—can be received, these five packets can form four media packet pairs: packet 1 and packet 2, packet 2 and packet 3, packet 3 and packet 4, and packet 4 and packet 5. For each packet pair, the third difference is calculated.
[0078] In step 3044B, the sum of the third differences for each media packet pair is obtained, and the ratio of the sum to the second quantity is used as the network jitter value.
[0079] For example, the second quantity is the difference between the first quantity and one. Continuing with the above example, the second quantity is 4, which is the number of media data packet pairs. The third difference of the above 4 media data packet pairs is added together in sequence, and the ratio of the sum to the second quantity is used as the network jitter value.
[0080] In this embodiment, the average value of the difference in transmission time among multiple data packet pairs is used as the network jitter value, which improves the accuracy of obtaining the network jitter value, thereby improving the accuracy of adjusting the data length threshold and avoiding the consumption of computing resources caused by incorrect adjustment.
[0081] In some embodiments, reference Figure 3D , Figure 3D This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A Step 304 in the process can be achieved through Figure 3D Steps 3041C to 3045C are implemented as follows, and are explained in detail below.
[0082] In step 3041C, the number of media data packets received within the second window time is counted, and the sending time and receiving time of each media data packet are obtained.
[0083] For example, the second window time is greater than or equal to the time required to receive three media packets. That is, within the second window time, at least three media packets are received, forming two media packet pairs.
[0084] In step 3042C, the following processing is performed for each media data packet: the first difference between the reception time of the media data packet and the transmission time of the media data packet is obtained, and the first difference is used as the transmission duration of the media data packet.
[0085] For example, the principle of obtaining the transmission duration is the same as in step 3043A, and will not be repeated here.
[0086] In step 3043C, the fourth difference between the transmission durations of the two media data packets in the media data packet pair is obtained.
[0087] For example, a media data packet pair includes two media data packets received at adjacent times. Steps 3043C and 3043B are based on the same principle and will not be described again here.
[0088] In step 3044C, the sum of the fourth difference of each media data packet pair is obtained, and the ratio between the sum and the number of data packet pairs is used as the network jitter value.
[0089] For example, the number of data packets is the difference between the number of data packets and one. The principle of step 3044C is the same as that of step 3044B, and will not be repeated here.
[0090] In this embodiment, the average value of the transmission time difference between data packets received within the window time is used as the network jitter value, which improves the accuracy of obtaining the network jitter value, thereby improving the accuracy of adjusting the data length threshold and avoiding the consumption of computing resources caused by incorrect adjustment.
[0091] Continue to refer to Figure 3A In step 305, the second data length threshold is adjusted based on the network jitter value.
[0092] For example, the second data length threshold before and after adjustment is greater than or equal to the first data length threshold. Network jitter value can be used as a condition to determine whether to adjust the second data length threshold. Adjusting the second data length threshold based on the network jitter value allows the buffering strategy to change according to the network state, improving the player's network jitter adaptability.
[0093] In some embodiments, reference Figure 4A , Figure 4A This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A Step 305 in the process can be achieved through Figure 4A Steps 3051A to 3052A are implemented, and the details are explained below.
[0094] In step 3051A, in response to the network jitter value being greater than or equal to the network jitter threshold, the second data length threshold is added to the first data length, and the sum is used as the adjusted second data length threshold.
[0095] In the example, the first data length is the granularity of a single adjustment. The network jitter threshold can be set according to the actual application scenario.
[0096] In step 3052A, in response to the network jitter value being less than the network jitter threshold, the second data length threshold is subtracted from the second data length, and the difference is used as the adjusted second data length threshold.
[0097] For example, the second data length is a single-adjustment granularity. The terms "first" and "second" in the first and second data lengths are merely distinguishing features and do not imply any restriction on their relative size. In practical applications, the first and second data lengths can be set according to the specific scenario. For instance, if the maximum data length of the data buffer is 6 seconds, the first data length could be 1000 milliseconds, and the second data length could be 500 milliseconds.
[0098] In this embodiment, when the network jitter value is greater than or equal to the network jitter threshold, the second data length threshold is increased; when the network jitter value is less than the network jitter threshold, the second data length threshold is decreased. By dynamically adjusting the buffering strategy based on the network jitter value and adjusting the second data length threshold with a fixed adjustment granularity, the computational resources required to adjust the data length threshold are reduced, thus decreasing memory usage.
[0099] In some embodiments, reference Figure 4B , Figure 4B This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A Step 305 in the process can be achieved through Figure 4B Steps 3051B to 3052B are implemented, and the details are explained below.
[0100] In step 3051B, in response to the network jitter value being greater than or equal to the network jitter threshold, a length adjustment value is determined based on the network jitter value, and the second data length threshold is added to the length adjustment value, and the sum is used as the adjusted second data length threshold.
[0101] Here, the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number.
[0102] For example, the length adjustment value and the network jitter value can be linearly or non-linearly correlated. For instance, if the length adjustment value is linearly correlated with the network jitter value, the length adjustment value is obtained by multiplying the network jitter value by a fixed coefficient (greater than 0). Another example is a non-linear correlation: multiple network jitter value intervals are set, each interval corresponding to a different data length value, and the data length value corresponding to the interval to which the network jitter value belongs is used as the length adjustment value.
[0103] In step 3052B, in response to the network jitter value being less than the network jitter threshold, a length adjustment value is determined based on the network jitter value, the second data length threshold is subtracted from the length adjustment value, and the difference is used as the adjusted second data length threshold.
[0104] In this embodiment, the adjustment value of the second data length threshold is determined based on the network jitter value, which improves the accuracy of adjusting the second data length threshold and enhances the adaptability of the playback process to network jitter.
[0105] In some embodiments, reference Figure 4C , Figure 4C This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A Step 305 in the process can be achieved through Figure 4C Steps 3051C to 3052C are implemented as follows, and are explained in detail below.
[0106] In step 3051C, in response to the network jitter value increasing at a rate greater than the growth rate threshold within the first window time, a length adjustment value is determined based on the network jitter value. The second data length threshold is added to the length adjustment value, and the sum is used as the adjusted second data length threshold.
[0107] For example, the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number. The growth rate is the numerical increase in the network jitter value per unit time. The unit time can be a unit of time within a window time; for example, if the window time is 1 minute, the unit time can be every 10 seconds within 1 minute.
[0108] For example, if the growth rate exceeds the growth rate threshold, meaning the network jitter value shows an upward trend within the first window time and the increase is significant, the higher the network jitter value, the worse the network condition and the higher the network latency. The growth rate threshold and the first window time can be set according to the actual application scenario. There are no restrictions on the relationship between the first window time and the second and third window times mentioned above.
[0109] In step 3052C, in response to the network jitter value attenuating at a rate greater than the attenuation rate threshold within the first window time, a length adjustment value is determined based on the network jitter value, and the second data length threshold is subtracted from the length adjustment value, with the difference being used as the adjusted second data length threshold.
[0110] For example, the attenuation rate is the decrease in network jitter value per unit time. If the attenuation rate is greater than the attenuation rate threshold, meaning the network jitter value shows a downward trend within the first window time and the decrease is significant, the network condition gradually improves, and network latency gradually decreases, then the second data length threshold can be lowered. The attenuation rate threshold can be set according to the actual application scenario.
[0111] In this embodiment, the determination of whether to lower or raise the second data length threshold is based on the degree of change in the network jitter value, which improves the accuracy of adjusting the second data length threshold and avoids the consumption of computing resources caused by frequent adjustments to the data length threshold.
[0112] In some embodiments, Figure 4B or Figure 4C The steps in determining the length adjustment value based on network jitter can be implemented as follows: When the data length is the sum of the data amounts of the media data packets in the data buffer, the product of the network jitter value (represented by time) and a first proportionality coefficient is used as the length adjustment value, where the first proportionality coefficient is the ratio between the data amount and time; when the data length is the sum of the playback durations of the media data packets in the data buffer, the product of the network jitter value and a second proportionality coefficient is used as the length adjustment value, where the second proportionality coefficient is the ratio between times.
[0113] For example, the relationship between the first and second proportional coefficients is not restricted, and the first and second proportional coefficients can be obtained through experiments based on actual application scenarios.
[0114] Assumptions: Data length is represented by data volume, the first proportionality coefficient is P1 (in kilobytes per millisecond), and the length adjustment value equals the network jitter value (in milliseconds). P1; Data length is represented by playback duration, and the second proportional coefficient is P2. Therefore, the length adjustment value = network jitter value. P2.
[0115] In this embodiment, different scaling factors are used to obtain length adjustment values for different data length representation methods, so that the data buffering processing method provided in this embodiment can adapt to different types of data buffers. At the same time, the adjusted data length is determined based on the network jitter value, so that the buffering strategy can flexibly change with the network status, thereby improving the smoothness of media data playback by the player.
[0116] In some embodiments, Figure 4B or Figure 4C The step of determining the length adjustment value based on the network jitter value can be achieved as follows: based on the network jitter value and the current second data length threshold, a neural network model is invoked for prediction processing to obtain the length adjustment value; wherein, the training sample set of the neural network model includes: different second data length thresholds, the sample length adjustment value corresponding to each second data length threshold, and the sample network jitter value.
[0117] For example, the neural network model can be a convolutional neural network, a deep convolutional neural network, a fully connected neural network, a decision tree model, a gradient boosting tree, a multilayer perceptron, and a support vector machine, etc. The embodiments of this application do not specifically limit the type of machine learning model.
[0118] In this embodiment, artificial intelligence technology is used to determine the length adjustment value, which improves the accuracy of obtaining the adjustment length. The adjusted data length is determined based on the network jitter value, which enables the buffering strategy to flexibly change with the network status and improves the smoothness of the media data played by the player.
[0119] In some embodiments, Figure 4B or Figure 4C The steps in determining the length adjustment value based on network jitter can be implemented as follows: obtain the player's output bitrate; when the data length is the playback duration, obtain the receiving speed of the received media data packets, determine the ratio between the output bitrate and the receiving speed, and use the product of the network jitter value and the ratio as the length adjustment value; when the data length is the data volume, use the product of the network jitter value and the output bitrate as the length adjustment value.
[0120] For example, network jitter is represented by time, and bitrate is the ratio of data volume to time, such as KB / s. The receiving speed of media packets is also the ratio of data volume to time. When the data length is the playback duration, assuming a receiving speed of 400 kilobytes per second (kB / s), a bitrate of kilobytes per second, a ratio of 1.25, and a network jitter value of 800 milliseconds (ms), then the adjusted length could be 1000 milliseconds. When the data length is the data volume, assuming an output bitrate of 500 kilobytes per second, and a network jitter value of 800 milliseconds (0.8 seconds), then the adjusted length could be 400 kilobytes.
[0121] In this embodiment, the adjustment length is determined based on the player's output bitrate and network jitter value, which improves the accuracy of obtaining the adjustment length. This allows the buffering strategy to adapt to players with different output bitrates and enables the buffering strategy to flexibly change with the network status, thereby improving the smoothness of the player's playback of media data.
[0122] In some embodiments, before step 305, the time interval between the current time and the last adjustment time is obtained, wherein the last adjustment time is the time when the second data length threshold was last adjusted; in response to the time interval reaching the third window time, the process of adjusting the second data length threshold based on the network jitter value is performed.
[0123] For example, the third window time can be 600 milliseconds. That is, if the last adjustment time is greater than 600 milliseconds, then step 305 is executed; if it is less than 600 milliseconds, then no action is taken.
[0124] In some embodiments, prior to step 305, in response to the satisfaction of the adjustment conditions, the process of adjusting the second data length threshold based on the network jitter value is initiated. The adjustment conditions include at least one of the following: 1. The data source corresponding to the media data package has changed; for example: the current video is copyrighted on different video websites, and the data source is switched from website A to website B for viewing.
[0125] 2. The decoding bitrate corresponding to the player has changed; for example, from low bitrate to high bitrate.
[0126] 3. The file type played by the player has changed; for example, the video format has been switched.
[0127] 4. When the media data packet is a video data packet, the resolution corresponding to the player changes; for example, converting 720P to 1080P.
[0128] 5. When the media data packet is an audio data packet, the corresponding sound quality of the player changes. For example, it may be converted from standard sound quality to lossless sound quality.
[0129] In this embodiment of the application, by setting adjustment conditions, playback stuttering caused by frequent adjustments to the data length threshold is avoided, thus saving computing resources and reducing memory usage.
[0130] Continue to refer to Figure 3A In step 306, in response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold, the playback process of the player is resumed from the paused point in time.
[0131] For example, when the network jitter value is greater than the network jitter threshold, and the adjusted second data length threshold is greater than or equal to the original threshold, the pause duration is also greater than or equal to the original. However, since the data length stored in the buffer is larger at the start of playback compared to the original, frequent pauses are avoided. When the network jitter value is less than the network jitter threshold, and the adjusted second data length threshold is less than the original threshold, the pause duration is shorter than the original, so users do not need to wait longer, improving the smoothness of media playback.
[0132] In some embodiments, reference Figure 5 , Figure 5 This is a flowchart illustrating the data buffering processing method provided in an embodiment of this application; Figure 3A After step 304, execute Figure 5 Steps 307 to 309 are explained in detail below. The execution order of steps 307 to 309 is not important.
[0133] In step 307, in response to the network jitter value being greater than or equal to the network jitter threshold and the current second data length threshold being the upper limit of the threshold, the current second data length threshold is maintained.
[0134] For example, the upper limit of the threshold can be the total data length of the buffer. When the upper limit of the threshold is reached, the data length threshold adjustment stops.
[0135] In step 308, in response to the network jitter value being less than the network jitter threshold, greater than or equal to the preset jitter value, and the current second data length threshold being the lower limit of the threshold, the current second data length threshold is maintained.
[0136] For example, the preset jitter value can be set to 30 milliseconds. For humans, it is difficult to perceive stuttering within 1 to 30 milliseconds; network jitter within this range can be ignored. Network jitter exceeding this range can be used as a reference for adjusting the data length threshold. Setting a lower limit for the threshold can prevent the media player from frequently pausing playback due to excessively short passive buffer length.
[0137] In step 309, in response to the network jitter value being less than the preset jitter value, the current second data length threshold is maintained.
[0138] For example, if the network jitter value is less than the preset jitter value, it means that the network latency is unlikely to be noticeable to the user. Within this range, the network jitter value is small, and the second data length threshold does not need to be adjusted. This avoids frequent adjustments to the data length threshold and saves computing resources.
[0139] In this embodiment, network jitter is used to measure network latency. By adjusting the second data length threshold of the data buffer based on the network jitter value, the buffering strategy is matched to the network jitter value. This dynamically adjusts the playback process of the player to resume playback, improving the player's adaptability to network jitter, avoiding frequent pauses in the playback process, and reducing end-to-end latency during media data packet playback. Compared to related technologies that dynamically adjust the total buffer capacity, this reduces memory usage, improves playback smoothness, and enhances the user experience.
[0140] The following will describe an exemplary application of the data buffering processing method of this application in a practical application scenario.
[0141] The buffering strategy of the player provided by related technologies is based on dynamic buffers, meaning that the player's buffering strategy does not change during the current playback. The buffering strategies of the open-source players provided by related technologies are as follows: EXOPlayer: Different protocols correspond to different levels, and the buffer size and the threshold for buffered data to reach the playback state vary between levels.
[0142] A lightweight Android / iOS video player based on ffplay (IJKPlayer): It adopts an incremental buffer pattern. For example, the initial data length of the buffer is 1 second. After the playback process is paused for the first time, it is expanded to 2 seconds. If the playback process is paused again, it is expanded to 3 seconds, and so on.
[0143] VLC multimedia player: Different buffering strategies are customized according to different protocols. Different buffering strategies have different buffer sizes and multiple buffer states. Different buffer states will affect the sleep time of the packet reading thread.
[0144] The relevant technologies have the following problems: (1) The buffer mode is fixed and cannot cope with network jitter. (2) The buffer configuration is too large to resist jitter, but it will lead to excessive end-to-end latency. Even if the network recovers and stabilizes, the live broadcast latency is still very large. (3) The fixed buffer strategy cannot cope with various live broadcast scenarios and live broadcast protocols. In different scenarios, different buffer strategies need to be adopted for different protocols, which wastes computing resources, occupies memory, and leads to excessive maintenance costs.
[0145] The data buffering method provided in this application sets a first data length threshold and a second data length threshold in the buffer. The data length can be represented by the amount of data or the duration of the data. In this application embodiment, the duration of the data is used as an example for explanation. The first data length threshold can be called the first duration threshold, and the second data length threshold can be called the second duration threshold. When the duration of the data in the buffer is less than the first duration threshold, the playback process of the player pauses the playback of the data in the buffer and performs active buffering. In response to the duration of the data in the buffer being greater than or equal to the second duration threshold, the playback process of the player resumes the playback of the data in the buffer. Based on the above buffering strategy, the second duration threshold is dynamically adjusted based on the network jitter value. When the network condition is good, the second duration threshold is lowered to achieve low latency in the playback process. When the network condition is poor, the second duration threshold is raised to reduce the buffering probability and improve video smoothness.
[0146] To facilitate understanding of the buffering strategy in the embodiments of this application, the concept of buffer water mark is explained below. The buffer is likened to a bucket, and the size of the bucket is determined according to the application scenario. When the remaining amount in the player's buffer queue is less than or equal to the low water mark threshold, the amount of data in the buffer reaches the low water mark, triggering an active buffering event. The player's playback process pauses playback to buffer more data until the duration of the data in the buffer exceeds the high water mark threshold, the amount of data exceeds the high water mark, and the playback process resumes playback.
[0147] refer to Figure 6 , Figure 6 This is a threshold diagram illustrating the data buffering method provided in this application embodiment; buffer 601 is likened to a bucket, where the shaded area represents media data 602 in the buffer, and the blank area does not store media data. When the amount of data in the buffer is less than a first duration threshold (corresponding to a low watermark, i.e., low watermark threshold), the player's playback process pauses; when the amount of data in the buffer reaches a second duration threshold (corresponding to a high watermark, i.e., high watermark threshold), the playback process resumes. When the duration of data in the buffer reaches the maximum data duration of the buffer, if the playback process has not played media data, the buffer stops data buffering processing.
[0148] Below, with Figure 1 The terminal device 400 in this application is the executing entity, and the data buffering processing method provided in the embodiments of this application is described below. Figure 7A , Figure 7A This is an optional flowchart illustrating the data buffering processing method provided in the embodiments of this application.
[0149] In step 703A, data packets are read, and the sending time and receiving time of each data packet are obtained.
[0150] For example, the packet reading thread is used to perform packet reading processing, which can be done through the following protocol: 1. Hypertext Transfer Protocol-FlashVideo (HTTP-FLV): A hypertext transfer protocol that combines the Real Time Messaging Protocol (RTM) for reading data downloaded by the network data transfer tool CURL.
[0151] 2. Real-Time Messaging Protocol (RTMP): Reads network data through the Real-Time Messaging Protocol Streaming Toolkit (librtmp).
[0152] 3. Web Real-Time Communications (WebRTC): Reads data downloaded from the User Datagram Protocol Channel (UDP Channel).
[0153] For example, packet reading is a cyclical, continuous process. Each packet is sent when the data source (e.g., the server) outputs the packet, and received when the terminal device 400 receives the packet.
[0154] In step 704A, the network jitter value is determined based on the sending and receiving times of each data packet.
[0155] For example, the difference in transmission time between two adjacent packet reads can be used as the network jitter value, and the player's buffering strategy can be adjusted based on the network jitter value. Network jitter can be represented by time. Assuming two data packets received at adjacent times are data packet 1 and data packet 2, the network jitter value can be determined as follows: Calculate the transmission time Time1 of data packet 1 on the network: Time1 = recv_timestamp1 – send_timestamp1 (the time data packet 1 was received minus the time data packet 1 was sent); Calculate the transmission time Time2 of data packet 2 on the network: Time2 = recv_timestamp2 – send_timestamp2 (the time data packet 2 was received minus the time data packet 2 was sent); Use the difference in transmission times of the two data packets as the network jitter value: Jitter = Time2 – Time1 (the difference in transmission times between data packet 2 and data packet 1).
[0156] For example, steps 703A and 708A are implemented by the Demuxer thread 701A. The Demuxer thread performs steps 703A and 708A synchronously. The Demuxer thread 701A synchronizes the received time, the transmitted time, and the current data duration in the buffer to the jitter buffer process 702A in real time. The jitter buffer process executes steps 704A to 707A and steps 709A to 710A.
[0157] In this embodiment, by obtaining different process execution parameters and adjusting buffering strategies, memory pressure is reduced and the smoothness of media playback is improved.
[0158] In step 705A, it is determined whether the network jitter value is greater than the network jitter threshold. If the determination result of step 705A is yes, step 706A is executed to increase the second duration threshold of the buffer. If the determination result of step 705A is no, step 707A is executed to decrease the second duration threshold of the buffer.
[0159] For example, the jitter buffering process 702A calculates the network jitter value and compares it with the network jitter threshold to analyze whether the packet read jitter time is too long (whether it is greater than the network jitter value). If the result is greater than the threshold, it indicates that the network is poor or that network jitter has occurred. To avoid frequent buffering, the high watermark needs to be increased to reduce the buffering rate. If the packet read jitter time is within a reasonable level (less than the network jitter value), it indicates that the network condition is good, and the high watermark can be decreased to reduce playback latency.
[0160] The network jitter threshold, first duration threshold, and second duration threshold can be preset or default values provided by the player kernel. The following explains each configuration item and the default values of the configuration items in the player.
[0161] The configuration option mMinDecreaseDurationMs is defined as the minimum duration that allows the second duration threshold to be lowered. Lowering the second duration threshold (high watermark threshold) will be prohibited if the duration is lowered below the minimum. The default value is 2000 milliseconds.
[0162] The configuration item mMaxIncreaseDurationMs is defined as the maximum duration for which the second duration threshold can be increased. If the duration exceeds the maximum, the second duration threshold will be prohibited from being increased. The default value is 8000 milliseconds.
[0163] The configuration option mPerIncreaseDurationMs is defined as the duration for each increase of the second duration threshold, with a default value of 1000 milliseconds.
[0164] The configuration option mPerDecreaseDurationMs is defined as the duration for each reduction of the second duration threshold, with a default value of 500 milliseconds.
[0165] The configuration option mAdjustIntervalThresholdMs is defined as the time interval for performing adjustment processing. It determines at regular intervals whether the second duration threshold needs to be adjusted under the current network jitter value to prevent frequent adjustments. The default value is 600 milliseconds.
[0166] The configuration item mFrozenThresholdMs is defined as the threshold for packet read latency (i.e., network jitter threshold). If the network jitter value exceeds the packet read latency threshold, the second latency threshold needs to be adjusted. The default value is 800 milliseconds.
[0167] In some embodiments, steps 703A to 707A are performed synchronously with steps 708A to 709A.
[0168] In step 708A, the duration of the current data in the buffer is obtained.
[0169] For example, the splitter process 701A reads the data duration from the buffer and synchronizes the data duration to the jitter buffer process 702A.
[0170] In step 709A, in response to the current data duration being less than the first duration threshold, the playback process of the player is paused.
[0171] For example, if the current data duration is less than the first duration threshold, it means that the amount of data in the buffer is too small to sustain the player's continued playback. The playback process is then paused, and a buffering (loading) icon is displayed on the player's corresponding human-computer interaction interface to indicate to the user that the player is currently actively buffering.
[0172] In step 710A, in response to the current data duration being greater than or equal to the second duration threshold, the playback process of the player is controlled to resume playback from the paused point.
[0173] To better understand the relationship between changes in the amount of data in the buffer and adjustments to the second duration threshold, refer to... Figure 7B , Figure 7B This is a schematic diagram illustrating the principle of the buffering strategy provided in the embodiments of this application.
[0174] right Figure 7B The buffering process is explained below. At time t0, the current data duration in the buffer is 0, which is less than the first duration threshold, triggering active buffering, pausing playback, and displaying a buffer icon in the player. From t0 to t1, data is buffered, and playback remains paused. At time t1, the current data duration in the buffer reaches the second duration threshold, ending active buffering, and playback resumes from the paused point. Assuming a poor network connection, from t1 to t2, the data in the buffer cannot supply playback, and the current data duration gradually decreases to the first duration threshold. The second duration threshold Q0 is the initial duration threshold. After executing step 706A, the second duration threshold Q0 is adjusted to the second duration threshold Q1. The duration required to resume playback of media data is extended from t1 to t3, and the time required for the data duration in the buffer to decrease below the first duration threshold is extended from t2-t1 to t4-t3. This avoids frequent pauses during video playback and improves playback smoothness. After performing step 707A, the time required to restore playback media data is reduced, pausing time is decreased, and the user's viewing experience is improved.
[0175] This application embodiment uses dynamic water level adjustment to allow the player to adapt to different network environments and playback protocols, enabling smooth viewing of live video even in areas with poor network connectivity. By calculating packet jitter time, the buffering strategy is adjusted in real time according to network conditions, raising or lowering the data duration threshold of the buffer, accurately initiating active buffering or resuming playback. It can adapt well to both weak and normal network environments, achieving the best live streaming effect and improving user experience.
[0176] The following description continues to illustrate the exemplary structure of the data buffer processing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the data buffer processing device 455 of the memory 450 may include: a data receiving module 4551 configured to receive media data packets and store the media data packets in a data buffer; a playback control module 4552 configured to call a media player to play the media data packets in the data buffer; the playback control module 4552 is further configured to pause the playback process of the player in response to the data length in the data buffer being less than a first data length threshold; the data receiving module 4551 is further configured to determine the network jitter value of the received media data packets; a threshold adjustment module 4553 configured to adjust a second data length threshold based on the network jitter value, wherein the second data length threshold before and after adjustment is greater than or equal to the first data length threshold; the playback control module 4552 is further configured to resume the playback process of the player from the paused time point in response to the data length in the data buffer being greater than or equal to the adjusted second data length threshold.
[0177] In some embodiments, the threshold adjustment module 4552 is configured to, in response to a network jitter value being greater than or equal to a network jitter threshold, add a second data length threshold to a first data length and use the sum as the adjusted second data length threshold, wherein the first data length is a single adjustment granularity; and in response to a network jitter value being less than a network jitter threshold, subtract the second data length threshold from the second data length and use the difference as the adjusted second data length threshold, wherein the second data length is a single adjustment granularity.
[0178] In some embodiments, the threshold adjustment module 4552 is configured to, in response to a network jitter value being greater than or equal to a network jitter threshold, determine a length adjustment value based on the network jitter value, add the second data length threshold to the length adjustment value, and use the sum as the adjusted second data length threshold; in response to a network jitter value being less than the network jitter threshold, determine a length adjustment value based on the network jitter value, subtract the second data length threshold from the length adjustment value, and use the difference as the adjusted second data length threshold; wherein the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number.
[0179] In some embodiments, the threshold adjustment module 4552 is configured to: respond to a network jitter value whose growth rate within a first window time is greater than a growth rate threshold; determine a length adjustment value based on the network jitter value; add a second data length threshold to the length adjustment value; and use the sum as the adjusted second data length threshold. In response to a network jitter value whose decay rate within a first window time is greater than a decay rate threshold, determine a length adjustment value based on the network jitter value; subtract the second data length threshold from the length adjustment value; and use the difference as the adjusted second data length threshold. The length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number.
[0180] In some embodiments, the threshold adjustment module 4552 is configured to use the product of the network jitter value and a first proportional coefficient as the length adjustment value when the data length is the sum of the data amounts of the media data packets in the data buffer, wherein the first proportional coefficient is the ratio between the data amount and the time; and to use the product of the network jitter value and a second proportional coefficient as the length adjustment value when the data length is the sum of the playback durations of the media data packets in the data buffer, wherein the second proportional coefficient is the ratio between the time periods.
[0181] In some embodiments, the threshold adjustment module 4552 is configured to call a neural network model to perform prediction processing based on the network jitter value and the current second data length threshold to obtain a length adjustment value; wherein, the training sample set of the neural network model includes: different second data length thresholds, sample length adjustment values corresponding to each second data length threshold, and sample network jitter values.
[0182] In some embodiments, the threshold adjustment module 4552 is configured to obtain the output bitrate of the player; when the data length is the playback duration, obtain the receiving speed of the received media data packets, determine the ratio between the output bitrate and the receiving speed, and use the product between the network jitter value and the ratio as the length adjustment value; when the data length is the data volume, use the product between the network jitter value and the output bitrate as the length adjustment value.
[0183] In some embodiments, the data receiving module 4551 is configured to obtain the sending time and receiving time of the currently received media data packet; obtain the sending time and receiving time of the previous media data packet, wherein the receiving time of the previous media data packet is adjacent to the receiving time of the media data packet; and perform the following processing for each media data packet: obtain a first difference between the receiving time and the sending time, and use the first difference as the transmission duration of the media data packet; obtain a second difference between the transmission duration of the media data packet and the transmission duration of the previous media data packet; and use the second difference as the network jitter value of the received media data packet.
[0184] In some embodiments, the data receiving module 4551 is configured to acquire the transmission time and reception time of a first number of received media data packets; and perform the following processing for each media data packet: acquire a first difference between the reception time and the transmission time of the media data packet, and use the first difference as the transmission duration of the media data packet; acquire a third difference between the transmission durations of two media data packets in a media data packet pair, wherein the media data packet pair includes two media data packets with adjacent reception times; acquire the sum of the third differences for each media data packet pair, and use the ratio of the sum to a second number as a network jitter value, wherein the second number is the difference between the first number and one.
[0185] In some embodiments, the data receiving module 4551 is configured to count the number of media data packets received within a second window time, and obtain the transmission time and reception time of each media data packet; for each media data packet, the following processing is performed: obtaining a first difference between the reception time and the transmission time of the media data packet, and using the first difference as the transmission duration of the media data packet; obtaining a fourth difference between the transmission durations of two media data packets in a media data packet pair, wherein the media data packet pair includes two media data packets with adjacent reception times; obtaining the sum of the fourth differences for each media data packet pair, and using the ratio between the sum and the number of data packet pairs as the network jitter value, wherein the number of data packet pairs is the difference between the number of data packets and one.
[0186] In some embodiments, the threshold adjustment module 4552 is configured to, after determining the network jitter value of the received media data packet, maintain the current second data length threshold in response to the network jitter value being greater than or equal to the network jitter threshold and the current second data length threshold being the upper limit of the threshold; maintain the current second data length threshold in response to the network jitter value being less than the network jitter threshold, greater than or equal to a preset jitter value, and the current second data length threshold being the lower limit of the threshold; and maintain the current second data length threshold in response to the network jitter value being less than the preset jitter value.
[0187] In some embodiments, the threshold adjustment module 4552 is configured to obtain the time interval between the current time and the previous adjustment time before adjusting the second data length threshold based on the network jitter value, wherein the previous adjustment time is the time when the second data length threshold was last adjusted; in response to the time interval reaching the third window time, it switches to the process of adjusting the second data length threshold based on the network jitter value.
[0188] In some embodiments, the threshold adjustment module 4552 is configured to, in response to meeting adjustment conditions, proceed to perform the process of adjusting the second data length threshold based on network jitter value before adjusting the second data length threshold based on network jitter value; wherein the adjustment conditions include at least one of the following: the data source corresponding to the media data packet changes; the decoding bitrate corresponding to the player changes; the file type played by the player changes; when the media data packet is a video data packet, the resolution corresponding to the player changes; when the media data packet is an audio data packet, the sound quality corresponding to the player changes.
[0189] In some embodiments, the threshold adjustment module 4552 is configured to obtain the total data length of the data buffer; use the product between the total data length and a first data length ratio as a first data length threshold; and use the product between the total data length and a second data length ratio as a second data length threshold; wherein the first data length ratio is less than the second data length ratio, and the second data length ratio is less than one.
[0190] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the data buffering processing method described in this application.
[0191] This application provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the data buffering method provided in this application. For example, ... Figure 3A The data buffering method is shown.
[0192] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0193] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0194] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0195] As an example, computer-executable instructions can be deployed to execute on a single terminal device, or on multiple terminal devices located in one location, or on multiple terminal devices distributed across multiple locations and interconnected via a communication network.
[0196] In summary, this application's embodiments measure network latency using network jitter values and adjust the second data length threshold of the data buffer based on these values. This ensures the buffering strategy matches the network jitter, dynamically adjusting the playback process and the point at which playback resumes. This improves the player's adaptability to network jitter, avoids frequent playback pauses, and reduces end-to-end latency during media data packet playback. Compared to techniques that dynamically adjust the total buffer capacity, this reduces memory usage, improves playback smoothness, and enhances the user experience.
[0197] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A data buffering processing method, characterized in that, The method includes: Receive media data packets and store the media data packets in a data buffer; Invoke the media player to play the media data packets in the data buffer; In response to the data length in the data buffer being less than a first data length threshold, the playback process of the media player is paused; Obtain the sending time and receiving time of the currently received media data packet; Obtain the sending time and receiving time of the previous media data packet of the currently received media data packet; For each media data packet, the following processing is performed: obtain a first difference between the reception time and the transmission time of the media data packet, and use the first difference as the transmission duration of the media data packet; Obtain a second difference between the transmission duration of the currently received media data packet and the transmission duration of the previous media data packet; use the second difference as the network jitter value for receiving the media data packet; Adjusting a second data length threshold based on the network jitter value; wherein, adjusting the second data length threshold based on the network jitter value includes: responding to the network jitter value's growth rate being greater than a growth rate threshold within a first window time, determining a length adjustment value based on the network jitter value, adding the second data length threshold to the length adjustment value, and using the sum as the adjusted second data length threshold; responding to the network jitter value's decay rate being greater than a decay rate threshold within the first window time, determining a length adjustment value based on the network jitter value, subtracting the second data length threshold from the length adjustment value, and using the difference as the adjusted second data length threshold, wherein the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number; the second data length threshold before and after adjustment is greater than or equal to the first data length threshold; The step of determining the length adjustment value based on the network jitter value includes: obtaining the output bitrate of the media player; when the data length is the playback duration, obtaining the receiving speed of the media data packets, determining the ratio between the output bitrate and the receiving speed, and using the product of the network jitter value and the ratio as the length adjustment value; when the data length is the data volume, using the product of the network jitter value and the output bitrate as the length adjustment value. In response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold, the playback process of the media player is resumed from the paused point in time.
2. The method according to claim 1, characterized in that, The method further includes: In response to the network jitter value being greater than or equal to the network jitter threshold, and the current second data length threshold being the upper limit of the threshold, the current second data length threshold is maintained; In response to the network jitter value being less than the network jitter threshold, greater than or equal to the preset jitter value, and the current second data length threshold being the lower limit of the threshold, the current second data length threshold is maintained; In response to the network jitter value being less than a preset jitter value, the current second data length threshold is maintained.
3. The method according to claim 1, characterized in that, The method further includes: Obtain the time interval between the current time and the last adjustment time, where the last adjustment time is the time when the second data length threshold was last adjusted; In response to the time interval reaching the third window time, the process of adjusting the second data length threshold based on the network jitter value is initiated.
4. The method according to claim 1, characterized in that, The method further includes: In response to the fulfillment of the adjustment conditions, the process of adjusting the second data length threshold based on the network jitter value is initiated. The adjustment conditions include at least one of the following: The data source corresponding to the media data packet has changed; The decoding bitrate corresponding to the media player has changed; The file type played by the media player has changed; When the media data packet is a video data packet, the resolution corresponding to the media player changes; When the media data packet is an audio data packet, the sound quality of the media player changes.
5. The method according to claim 1, characterized in that, The method further includes: Obtain the total data length of the data buffer; The product of the total data length and the ratio of the first data length is used as the first data length threshold. The product of the total data length and the ratio of the second data length is used as the second data length threshold; Wherein, the first data length ratio is less than the second data length ratio, and the second data length ratio is less than one.
6. The method according to claim 1, characterized in that, The transmission time of the media data packet is carried by the media data packet itself, and the reception time of the media data packet is obtained by the splitter thread in the terminal device on which the media player is installed.
7. The method according to claim 1, characterized in that, The reception time of the previous media data packet is adjacent to the reception time of the currently received media data packet.
8. The method according to claim 1, characterized in that, The method further includes: In response to the data length in the data buffer being less than the first data length threshold, when the playback process of the media player is paused, a buffer icon is displayed in the human-computer interaction interface corresponding to the media player to indicate that the media player is currently performing active buffering.
9. The method according to claim 1, characterized in that, The method further includes: When the duration of data in the data buffer reaches the maximum duration of the data buffer, and the media player is not playing media data, buffering media data into the data buffer stops.
10. A data buffer processing apparatus, characterized in that, The device includes: The data receiving module is configured to receive media data packets and store the media data packets in a data buffer. The playback control module is configured to call the media player to play the media data packets in the data buffer; The playback control module is further configured to pause the playback process of the media player in response to the data length in the data buffer being less than a first data length threshold. The data receiving module is further configured to obtain the sending time and receiving time of the currently received media data packet; obtain the sending time and receiving time of the previous media data packet of the currently received media data packet; and perform the following processing for each media data packet: obtain a first difference between the receiving time and the sending time of the media data packet, and use the first difference as the transmission duration of the media data packet; The data receiving module is further configured to obtain a second difference between the transmission duration of the currently received media data packet and the transmission duration of the previous media data packet; and to use the second difference as the network jitter value for receiving the media data packet. A threshold adjustment module is configured to adjust a second data length threshold based on the network jitter value; wherein, adjusting the second data length threshold based on the network jitter value includes: responding to the network jitter value's growth rate being greater than a growth rate threshold within a first window time, determining a length adjustment value based on the network jitter value, adding the second data length threshold to the length adjustment value, and using the sum as the adjusted second data length threshold; responding to the network jitter value's decay rate within the first window time being greater than a decay rate threshold, determining a length adjustment value based on the network jitter value, subtracting the second data length threshold from the length adjustment value, and using the difference as the adjusted second data length threshold. Two data length thresholds are defined, wherein the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number; the second data length threshold before and after adjustment is greater than or equal to the first data length threshold; the step of determining the length adjustment value based on the network jitter value includes: obtaining the output bitrate of the media player; when the data length is the playback duration, obtaining the receiving speed of the media data packets, determining the ratio between the output bitrate and the receiving speed, and using the product between the network jitter value and the ratio as the length adjustment value; when the data length is the data volume, using the product between the network jitter value and the output bitrate as the length adjustment value; The playback control module is further configured to resume the playback process of the media player from the paused point in response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold.
11. The apparatus according to claim 10, characterized in that, The threshold adjustment module is configured as follows: In response to the network jitter value being greater than or equal to the network jitter threshold, and the current second data length threshold being the upper limit of the threshold, the current second data length threshold is maintained; In response to the network jitter value being less than the network jitter threshold, greater than or equal to the preset jitter value, and the current second data length threshold being the lower limit of the threshold, the current second data length threshold is maintained; In response to the network jitter value being less than a preset jitter value, the current second data length threshold is maintained.
12. The apparatus according to claim 10, characterized in that, The threshold adjustment module is configured as follows: Obtain the time interval between the current time and the last adjustment time, where the last adjustment time is the time when the second data length threshold was last adjusted; In response to the time interval reaching the third window time, the process of adjusting the second data length threshold based on the network jitter value is initiated.
13. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions for a computer; A processor, when executing computer-executable instructions stored in the memory, implements the data buffer processing method according to any one of claims 1 to 9.
14. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by a processor, they implement the method described in any one of claims 1 to 9.
15. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, they implement the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method of dynamically adjusting data reception cache and video decoding device
CN106331835A
Display device and media asset playing method
CN114827715A
