Data buffering processing method and device, electronic equipment and storage medium

By dynamically adjusting the second data length threshold of the buffer and optimizing the player's playback process according to the network jitter value, the problems of high delay and poor user experience caused by the fixed buffer size in the existing technology are solved, and smoother playback is achieved. playback experience.

CN118540540AActive Publication Date: 2024-08-23TENCENT TECH (BEIJING) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310187828.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23
Estimated Expiration
2043-02-22

AI Technical Summary

Technical Problem

When dealing with network jitter, the existing technology has a fixed buffer size and cannot effectively respond to changes in network status, resulting in high player latency and poor user experience.

Method used

By receiving media data packets and storing them in the data buffer, the second data length threshold of the buffer is adjusted according to the network jitter value, and the playback process of the player is dynamically adjusted to avoid frequent pauses and delays.

Benefits of technology

It improves the player's adaptability to network jitter, reduces playback delay and memory usage, and improves playback fluency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540540A
    Figure CN118540540A
Patent Text Reader

Abstract

The invention provides a data buffering processing method and device, electronic equipment, a computer program product and a computer readable storage medium. The method comprises the following steps: receiving a media data packet, and storing the media data packet into a data buffer area; calling a media player to play the media data packet in the data buffer area; in response to the fact that the data length in the data buffer area is smaller than the first data length threshold value, pausing the playing process of the player; determining a network jitter value of the received media data packet; second data length threshold values are adjusted based on the network jitter value, and the second data length threshold values before and after adjustment are both larger than or equal to the first data length threshold value; and in response to the fact that the data length of the data buffer area is greater than or equal to the adjusted second data length threshold value, recovering the playing process of the player from the pause time point. According to the invention, the playing fluency of the player can be ensured in diversified network states.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, and in particular to a data buffer processing method, device, electronic device and storage medium. Background Art

[0002] Buffering refers to the process of pre-saving some files in a temporary folder on the local hard disk by the player when playing online audio and video files to make the playback smoother. The buffering strategy of the player provided by the relevant technology is based on a dynamic buffer, that is, the buffer size is divided into different gears, and during the current playback process, buffering is performed according to the corresponding buffer gear. However, the larger the buffer, the higher the memory usage, which in turn affects the smoothness of the application running process and makes the end-to-end delay too high.

[0003] Related technologies currently do not have a good buffering strategy to deal with network jitter. Summary of the invention

[0004] The embodiments of the present application provide a data buffering processing method, device, electronic device, computer-readable storage medium, and computer program product, which can ensure the smoothness of player playback under various network conditions.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] The present application provides a data buffer processing method, the method comprising:

[0007] receiving a media data packet, and storing the media data packet in a data buffer;

[0008] Invoke a media player to play the media data packet in the data buffer;

[0009] In response to the data length in the data buffer being less than a first data length threshold, pausing the playing process of the player;

[0010] Determining a network jitter value for receiving the media data packet;

[0011] Adjusting a second data length threshold based on the network jitter value, wherein the second data length threshold before and after the adjustment is greater than or equal to the first data length threshold;

[0012] In response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold, the playing process of the player is resumed from the paused time point.

[0013] The present application provides a data buffer processing device, including:

[0014] A data receiving module, configured to receive a media data packet and store the media data packet into a data buffer;

[0015] A play control module, configured to call a media player to play the media data packet in the data buffer;

[0016] 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;

[0017] The data receiving module is further configured to determine a network jitter value for receiving the media data packet;

[0018] a threshold adjustment module, configured to adjust a second data length threshold based on the network jitter value, wherein the second data length threshold before and after the adjustment is greater than or equal to the first data length threshold;

[0019] The playback control module is further configured to resume the playback process of the player from a paused time point in response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold.

[0020] An embodiment of the present application provides an electronic device, the electronic device comprising:

[0021] A memory for storing computer executable instructions;

[0022] The processor is used to implement the data buffer processing method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0023] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing the data buffer processing method provided in the embodiment of the present application when executed by a processor.

[0024] An embodiment of the present application provides a computer program product, including a computer program or a computer executable instruction. When the computer program or the computer executable instruction is executed by a processor, the data buffer processing method provided in the embodiment of the present application is implemented.

[0025] The embodiments of the present application have the following beneficial effects:

[0026] By adjusting the second data length threshold of the data buffer based on the network jitter value, the buffer strategy is matched with the network jitter value, and the node where the player resumes playback can be dynamically adjusted, which improves the player's adaptability to network jitter, avoids frequent pauses in the player's playback process, and reduces the end-to-end delay during the playback of media data packets. Compared with related technologies that dynamically adjust the total capacity of the buffer, this reduces memory usage, improves the player's playback fluency, and improves user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a schematic diagram of an application mode of the data buffer processing method provided in an embodiment of the present application;

[0028] Figure 2 is a schematic diagram of the structure of a terminal device 400 provided in an embodiment of the present application;

[0029] FIG. 3A to FIG. 3D It is a flowchart of a data buffer processing method provided in an embodiment of the present application;

[0030] FIG. 4A to FIG. 4C It is a flowchart of a data buffer processing method provided in an embodiment of the present application;

[0031] Figure 5 It is a flowchart of a data buffer processing method provided in an embodiment of the present application;

[0032] Figure 6 is a threshold diagram of the data buffer processing method provided in an embodiment of the present application;

[0033] Fig. 7A This is an optional flowchart of the data buffer processing method provided in the embodiment of the present application;

[0034] Figure 7B It is a schematic diagram of the buffer strategy principle provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0036] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be 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.

[0037] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0038] It should be pointed out that in the embodiments of the present application, related data such as user information and user feedback data are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0040] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0041] 1) Buffering refers to the process of pre-saving some files in a temporary folder on the local hard disk by the player when playing online audio and video files to make the playback smoother.

[0042] 2) Buffer, also known as temporary storage area, the Chinese translation of buffer comes from the fact that when the high-speed component of the computer communicates with the low-speed component, the output of the high-speed component must be temporarily stored somewhere to ensure that the high-speed component and the low-speed component match. There are two main situations for filling the data in the player's buffer, the first one is called "active buffering" and the other one is called "passive buffering".

[0043] 3) Active buffering means that the player actively pauses data consumption in the buffer and waits for the data producer to gradually fill the data until a certain condition is met and then resumes.

[0044] 4) Passive buffering means that the data consumption speed cannot keep up with the production speed, thus the data is passively retained in the buffer.

[0045] 5) Network jitter value is a parameter used to describe the degree of network delay variation. For example, when the network is congested, queuing delay will affect the end-to-end delay and cause the packet delays transmitted through the same connection to vary. The degree of delay can be described by the jitter value. The jitter value is an important parameter for real-time transmission.

[0046] The buffering strategy of the player provided by the related technology is based on a dynamic buffer, that is, the buffering strategy of the player will not change during the current playback process. For example: EXOPlayer, different protocols correspond to different gears, and the buffer size and the threshold of the buffer data volume to the playback state are different between gears; IJKPlayer (a lightweight Android / iOS video player based on ffplay): adopts a buffer increment mode, for example: the initial data length of the buffer is 1s, and it is expanded to 2s after the playback process is paused for the first time, and it is expanded to 3s when the playback process is paused again, and it increases in sequence. However, the related technology only sets the buffer size, and the buffer mode is fixed, which cannot cope with network jitter. If the buffer configuration is too large, it can resist jitter, but it will cause the end-to-end delay to be too high. Even if the network is restored to stability, in some application scenarios (for example: live broadcast scenarios), the delay of the player is still very large.

[0047] The embodiments of the present application provide a data buffer processing method, a data buffer processing device, an electronic device, a computer-readable storage medium, and a computer program product, which can ensure the smoothness of player playback under various network conditions.

[0048] The following describes an exemplary application of an electronic device provided by an embodiment of the present application. The electronic device may be a terminal device. The terminal device provided by an embodiment of the present application may be implemented as a laptop, a tablet computer, a desktop computer, a set-top box, a mobile device (e.g., a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device), a vehicle-mounted terminal, a virtual reality (VR) device, an augmented reality (AR) device, and other types of user terminals. The following describes an exemplary application when the device is implemented as a terminal device.

[0049] refer to Figure 1 , Figure 1 is a schematic diagram of an application mode of the data buffer processing method provided in an embodiment of the present application; for example, Figure 1 The server 200, the network 300 and the terminal device 400 are involved. The terminal device 400 is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0050] In some embodiments, the server 200 is a server of a live broadcast platform, the user is a viewer watching a live broadcast, and the terminal device 400 is a device installed with a media player 401, such as a mobile phone, a laptop computer, etc. The media player 401 can be a small program in a video application. A first data length threshold and a second data length threshold are preset in the buffer of the media player 401. When the current data length in the buffer is less than the first data length threshold, the playback process of the media player 401 is paused, and when the current data length in the buffer is greater than the second data length threshold, the playback process of the player is resumed from the paused time point.

[0051] For example, the server 200 receives the live video from the terminal device of the anchor user through the network 300, and the server 200 sends the live video to the terminal device 400 of the audience through the network 300. The terminal device 400 can call the data buffer processing method provided in the embodiment of the present application to dynamically adjust the second data length threshold of the data buffer of the media player 401, and adjust the second data length threshold according to the network jitter value, thereby avoiding the media player 401 from frequently pausing and resuming playback when the network jitter value is high, reducing the impact of network jitter on the player, improving the smoothness of the terminal device 400 in playing the live video, and improving the user's viewing experience.

[0052] In some embodiments, the data buffer processing method of the embodiment of the present application can also be applied in the following application scenarios:

[0053] 1. Online conference. During a video conference using video conferencing software, each participating user is in a different network environment. In the event of network jitter, the terminal device can call the data buffer processing method provided in the embodiment of the present application to adjust the data length threshold of the buffer, reduce end-to-end delay, and improve user experience.

[0054] 2. Cloud gaming. Cloud gaming mode means that the game logic is completely run by the server, and the cloud server renders the game scene data as an audio and video stream, and transmits it to the terminal device for display through the network. The terminal device only needs to have basic streaming media playback capabilities and the ability to obtain the player's operating instructions and send them to the server. In the cloud gaming scenario, in the event of network jitter, the terminal device can call the data buffer processing method provided in the embodiment of the present application to adjust the data length threshold of the buffer, improve the adaptability to network jitter, and reduce game freezes.

[0055] The embodiments of the present application can be implemented through blockchain technology. The buffering strategy of the embodiments of the present application can be uploaded to the blockchain for storage, and the reliability of the buffering strategy can be guaranteed by the consensus algorithm. Blockchain is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.

[0056] The embodiments of the present application can be implemented through database technology. In short, a database can be regarded as an electronic file cabinet where electronic files are stored. Users can add, query, update, delete, etc. data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application program.

[0057] A database management system (DBMS) is a computer software system designed for managing databases. It generally has basic functions such as storage, retrieval, security, and backup. Database management systems can be classified according to the database model they support, such as relational, XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters, mobile phones; or according to the query language used, such as Structured Query Language (SQL), XQuery; or according to performance focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMS can cross categories, for example, supporting multiple query languages ​​at the same time.

[0058] The embodiments of the present application can also be implemented through cloud technology. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model application. It can form a resource pool, which is used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, as well as the promotion of search services, social networks, mobile commerce and open collaboration, each item may have its own hash code identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data require strong system backing support, which can only be achieved through cloud computing.

[0059] In some embodiments, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal device may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present invention.

[0060] See also Figure 2 , Figure 2 is a schematic diagram of the structure of a terminal device 400 provided in an embodiment of the present application, Figure 2 The terminal 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 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .

[0061] 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., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0062] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The 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.

[0063] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0064] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0065] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0066] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0067] The network communication module 452 is used to reach other terminal devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Authentication (WiFi), and Universal Serial Bus (USB).

[0068] The presentation module 453 is used to enable presentation of information (eg, a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (eg, a display screen, a speaker, etc.) associated with the user interface 430 .

[0069] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.

[0070] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The data buffer processing device 455 stored in the memory 450 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a data receiving module 4551, a playback control module 4552, and a threshold adjustment module 4553. These modules are logical, so they can be arbitrarily combined or further divided according to the functions implemented. The functions of each module will be explained below.

[0071] In some embodiments, the terminal or server can implement the data buffering processing method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a live broadcast APP or an instant messaging APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0072] The following describes a data buffer processing method provided in an embodiment of the present application. As described above, the data buffer processing method in an embodiment of the present application is implemented by a terminal device, so the execution subject of each step will not be repeatedly described below.

[0073] See also Figure 3A , Figure 3A is a flow chart of the data buffer processing method provided in the embodiment of the present application, which will be combined with Figure 3A The steps shown are explained.

[0074] In step 301, a media data packet is received and stored in a data buffer.

[0075] For example, the media data packet may be an audio data packet or a video data packet. To facilitate understanding of the buffering strategy of the data buffer, the concept of buffer water mark is explained below. The buffer is compared to a bucket, the data in the buffer is the water in the bucket, the data length is the amount of water, and a first data length threshold and a second data length threshold are set in the buffer. The first data length threshold is less than the second data length threshold. When the data length is greater than or less than the first data length threshold, it means that the amount of data in the buffer is difficult to support the playback requirements of the playback process, and the playback process is paused. As more and more media data is received, the data length in the buffer gradually increases to the second data length threshold, and the playback process is resumed from the paused time point.

[0076] For example, the protocol for reading the media data packet may be a Hypertext Transfer Protocol-Flash Video (HTTP-FLV), a Real Time Messaging Protocol (RTMP), a Web Real-Time Communications (WebRTC), etc. In the process of data caching, step 301 may be executed multiple times, for example, continuously or intermittently, and step 302 is executed after each execution of step 301.

[0077] In step 302, a media player is called to play the media data packets in the data buffer.

[0078] For example, in the embodiments of the present application, the media player can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a live broadcast APP or an instant messaging APP; it can also be a mini-program, that is, a program that only needs to be downloaded to a browser environment to run, for example: a player plug-in embedded in the network; it can also be a mini-program that can be embedded in any APP.

[0079] In step 303, in response to the data length in the data buffer being less than the first data length threshold, the playing process of the player is paused.

[0080] For example, the data length may be represented by the data volume or the playback duration of the data, and the first data length threshold and the second data length threshold may be determined based on an actual application scenario.

[0081] 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 time length or data volume); use the product of the total data length and the first data length ratio as the first data length threshold; use the product of 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.

[0082] For example, the first data length ratio and the second data length ratio may be manually set according to an application scenario.

[0083] In step 304, a network jitter value of the received media data packet is determined.

[0084] For example, a network jitter value is a parameter used to measure a network status. The network jitter value can be expressed by time, such as the difference between the transmission time of each media data packet.

[0085] In some embodiments, reference Figure 3B , Figure 3B It is a flowchart of a data buffer processing method provided in an embodiment of the present application; Figure 3A Step 304 in can be Figure 3B Steps 3041A to 3045A are implemented as described in detail below.

[0086] In step 3041A, the sending time and receiving time of the currently received media data packet are obtained.

[0087] For example, the sending time of a media data packet is the time when the data source of the media data packet outputs the media data packet. For example, if the server 200 sends a media data packet A to the terminal device 400, the sending time is the time when the media data packet A is sent by the 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 demultiplexer thread in the terminal device.

[0088] In step 3042A, the sending time and receiving time of the previous media data packet are obtained.

[0089] For example, the receiving time of the previous media data packet is adjacent to the receiving time of the media data packet. That is, every two media data packets with adjacent receiving times are combined into a data packet pair, and the sending and receiving time of each data packet in the data packet pair is obtained.

[0090] In step 3043A, the following processing is performed for each media data packet: a first difference between the receiving time and the sending time is obtained, and the first difference is used as the transmission duration of the media data packet.

[0091] For example: the currently received media data packet is data packet 1, the first difference = (receiving time T2 - sending time T1) = transmission duration. The previous media data packet is data packet 2, the first difference = (receiving time T4 - sending time T3).

[0092] 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.

[0093] For example, when the server 200 sends a data packet to the terminal device 400, the amount of data in each data packet is the same, and due to changes in the network state, the transmission time of each data packet is different. Continuing to explain based on the above example, the second difference = (receiving time T2-sending time T1)-(receiving time T4-sending time T3).

[0094] In step 3045A, the second difference is used as the network jitter value of the received media data packet.

[0095] In an embodiment of the present application, the network jitter value is represented in real time based on the difference in transmission time corresponding to the data packets, thereby improving the accuracy of the network jitter value, and further improving the accuracy of the dynamic adjustment of the buffer strategy, making the player's playback processing smoother, reducing the probability of occurrence of freezes, and improving the adaptability to network jitter.

[0096] In some embodiments, reference Figure 3C , Figure 3C It is a flowchart of a data buffer processing method provided in an embodiment of the present application; Figure 3A Step 304 in can be Figure 3C Steps 3041B to 3045B in are implemented as described in detail below.

[0097] In step 3041B, the sending time and receiving time of the first number of received media data packets are obtained.

[0098] For example, the first number of media data packets is the first number of media data packets received most recently, and the first number can be pre-set according to an actual application scenario. Determining the network jitter value based on the difference in transmission time of multiple groups of data packet pairs can improve the accuracy of obtaining the network jitter value.

[0099] In step 3042B, the following processing is performed for each media data packet: a 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.

[0100] For example, the principle of obtaining the transmission duration is the same as step 3043A, and will not be repeated here.

[0101] In step 3043B, a third difference between the transmission durations of two media data packets in the media data packet pair is obtained.

[0102] For example, a media data packet pair includes two media data packets whose receiving times are adjacent. Assuming that five data packets whose receiving times are adjacent in sequence are currently received: data packet 1 to data packet 5, the five data packets can form four media data packet pairs, including: data packet 1 and data packet 2, data packet 2 and data packet 3, data packet 3 and data packet 4, data packet 4 and data packet 5. For each data packet pair, a third difference is obtained.

[0103] In step 3044B, the sum of the third difference values ​​of each pair of media data packets is obtained, and the ratio of the sum to the second number is used as the network jitter value.

[0104] For example, the second number is the difference between the first number and one. Continuing with the explanation based on the above example, the second number is 4, that is, the number of media data packet pairs. The third differences of the above 4 media data packet pairs are added in sequence, and the ratio of the sum to the second number is used as the network jitter value.

[0105] In an embodiment of the present application, the average value of the difference in transmission time of 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 erroneous adjustment.

[0106] In some embodiments, reference Figure 3D , Figure 3D It is a flowchart of a data buffer processing method provided in an embodiment of the present application; Figure 3A Step 304 in can be Figure 3D Steps 3041C to 3045C are implemented as described in detail below.

[0107] 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.

[0108] For example, the second window time is greater than or equal to the time required to receive three media data packets. That is, within the second window time, at least three media data packets are received to form two media data packet pairs.

[0109] In step 3042C, the following processing is performed for each media data packet: a 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.

[0110] For example, the principle of obtaining the transmission duration is the same as step 3043A, and will not be repeated here.

[0111] In step 3043C, a fourth difference between the transmission durations of two media data packets in the media data packet pair is obtained.

[0112] For example, the media data packet pair includes two media data packets received at adjacent times. The principle of step 3043C is the same as that of step 3043B, and will not be described in detail here.

[0113] In step 3044C, the sum of the fourth difference values ​​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.

[0114] For example, the number of data packet pairs is the difference between the number of data packets and 1. The principle of step 3044C is the same as that of step 3044B, and will not be repeated here.

[0115] In an embodiment of the present application, the average value of the difference in transmission time between data packets received within the window time is obtained 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 erroneous adjustment.

[0116] Continue to refer Figure 3A In step 305, the second data length threshold is adjusted based on the network jitter value.

[0117] For example, the second data length threshold before and after adjustment is greater than or equal to the first data length threshold. The network jitter value can be used as a condition for determining whether to adjust the second data length threshold. The second data length threshold is adjusted according to the network jitter value, so that the buffering strategy changes according to the network status, thereby improving the network jitter adaptability of the player.

[0118] In some embodiments, reference Figure 4A , Figure 4A It is a flowchart of a data buffer processing method provided in an embodiment of the present application; Figure 3A Step 305 in can be Figure 4A Steps 3051A to 3052A in are implemented as described in detail below.

[0119] 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.

[0120] For example, the first data length is a single adjustment granularity. The network jitter threshold can be set according to the actual application scenario.

[0121] 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 obtained difference is used as the adjusted second data length threshold.

[0122] For example, the second data length is a single adjustment granularity. The "first" and "second" in the first data length and the second data length are only for distinction, and do not represent a restriction on the size relationship between the two. In actual applications, the first and second data lengths can be set according to specific scenarios. For example: the maximum data length of the data buffer is 6 seconds, the first data length can be 1000 milliseconds, and the second data length can be 500 milliseconds.

[0123] In the embodiment of the present application, when the network jitter value is greater than or equal to the network jitter threshold, the second data length threshold is adjusted upward, and when the network jitter value is less than the network jitter threshold, the second data length threshold is adjusted downward. The buffer strategy is dynamically adjusted according to the network jitter value, and the second data length threshold is adjusted based on a fixed adjustment granularity, which reduces the computing resources required to adjust the data length threshold and reduces the memory usage.

[0124] In some embodiments, reference Figure 4B , Figure 4B It is a flowchart of a data buffer processing method provided in an embodiment of the present application; Figure 3A Step 305 in can be Figure 4B Steps 3051B to 3052B in are implemented as described in detail below.

[0125] 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, the second data length threshold is added to the length adjustment value, and the sum is used as the adjusted second data length threshold.

[0126] Here, the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number.

[0127] For example, the length adjustment value and the network jitter value may be linearly related or nonlinearly related, for example, the length adjustment value and the network jitter value are linearly related, and the network jitter value is multiplied by a fixed coefficient (greater than 0) to obtain the length adjustment value. For another example, the length adjustment value and the network jitter value are nonlinearly related, multiple network jitter value intervals are set, each interval corresponds 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.

[0128] 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.

[0129] In the embodiment of the present application, the adjustment value for adjusting the second data length threshold is determined based on the network jitter value, thereby improving the accuracy of adjusting the second data length threshold and improving the adaptability of the playback process to network jitter.

[0130] In some embodiments, reference Figure 4C , Figure 4C It is a flowchart of a data buffer processing method provided in an embodiment of the present application; Figure 3A Step 305 in can be Figure 4C Steps 3051C to 3052C in are implemented as described in detail below.

[0131] In step 3051C, in response to the growth rate of the network jitter value within the first window time being greater than the growth rate threshold, 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.

[0132] 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 value of the network jitter value growing in a unit time. The unit time can be a unit time in the window time, for example, if the window time is 1 minute, the unit time can be every 10 seconds in 1 minute.

[0133] For example, the growth rate is greater than the growth rate threshold, that is, the network jitter value shows an upward trend in the first window time, and the degree of increase is large. The larger the network jitter value, the worse the network status and the higher the network delay. The growth rate threshold and the first window time can be set according to the actual application scenario. There is no restriction on the relationship between the first window time and the second and third window times mentioned above.

[0134] In step 3052C, in response to the attenuation rate of the network jitter value within the first window time being greater than the attenuation rate 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.

[0135] For example, the attenuation rate is the value of the network jitter value decreasing per unit time. If the attenuation rate is greater than the attenuation rate threshold, that is, the network jitter value is decreasing within the first window time, and the degree of decrease is large, the network status is gradually improving, and the network delay is gradually decreasing, the second data length threshold can be lowered. The attenuation rate threshold can be set according to the actual application scenario.

[0136] In an embodiment of the present application, whether to lower or increase the second data length threshold is determined based on the degree of change of the network jitter value, thereby improving the accuracy of adjusting the second data length threshold and avoiding computing resource consumption caused by frequent adjustment of the data length threshold.

[0137] In some embodiments, Figure 4B or Figure 4C The step of determining the length adjustment value based on the network jitter value can be implemented in the following way: 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 (characterized by time) and the first proportional coefficient is used as the length adjustment value, wherein the first proportional coefficient is the ratio between the data amount and the 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 the second proportional coefficient is used as the length adjustment value, wherein the second proportional coefficient is the ratio between time and time.

[0138] For example, the relationship between the first proportionality coefficient and the second proportionality coefficient is not limited, and the first and second proportionality coefficients can be obtained by conducting experiments based on actual application scenarios.

[0139] Assumption: data length is represented by data volume, the first proportional coefficient is P1 (in kilobytes per millisecond), length adjustment value = network jitter value (in milliseconds) * P1; data length is represented by playback time, the second proportional coefficient is P2, then length adjustment value = network jitter value * P2.

[0140] In an embodiment of the present application, length adjustment values ​​are obtained by using different proportional coefficients for different data length representation methods, so that the data buffer processing method provided in the embodiment of the present application 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 be flexibly changed according to the network status, thereby improving the fluency of the player's playback of media data.

[0141] In some embodiments, Figure 4B or Figure 4C The step of determining the length adjustment value based on the network jitter value can be implemented in the following way: based on the network jitter value and the current second data length threshold, calling the neural network model 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, sample length adjustment values ​​corresponding to each second data length threshold, and sample network jitter values.

[0142] For example, the neural network model can be a convolutional neural network, a deep convolutional neural network, or 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 the present application do not specifically limit the type of machine learning model.

[0143] In an embodiment of the present application, the length adjustment value is determined by artificial intelligence technology, which improves the accuracy of obtaining the adjusted length. The adjusted data length is determined based on the network jitter value, so that the buffering strategy can be flexibly changed according to the network status, thereby improving the smoothness of the player's playback of media data.

[0144] In some embodiments, Figure 4B or Figure 4C The steps in the method of determining the length adjustment value based on the network jitter value can be implemented in the following ways: obtaining the output bit rate of the player; when the data length is the playback time, obtaining the receiving speed of the received media data packet, determining the ratio between the output bit rate and the receiving speed, and taking the product between the network jitter value and the ratio as the length adjustment value; when the data length is the data volume, taking the product between the network jitter value and the output bit rate as the length adjustment value.

[0145] For example, the network jitter value is characterized by time, and the bit rate is the ratio of data volume to time, for example: KB / S. The receiving speed of the media data packet is also the ratio of data volume to time. When the data length is the playback time, assuming that the receiving speed is 400 kilobytes per second (kB / s), the bit rate is kilobytes per second, the ratio is 1.25, and the network jitter value is 800 milliseconds (ms), then the adjusted length can be 1000 milliseconds. When the data length is the data volume, assuming that the output bit rate is 500 kilobytes per second, the network jitter value is 800 milliseconds, that is, 0.8 seconds, then the adjusted length can be 400 kilobytes.

[0146] In an embodiment of the present application, the adjustment length is determined based on the output bit rate of the player and the network jitter value, which improves the accuracy of obtaining the adjustment length, enables the buffering strategy to adapt to players with different output bit rates, and enables the buffering strategy to be flexibly changed according to the network status, thereby improving the smoothness of the player's playback of media data.

[0147] In some embodiments, before step 305, the time interval between the current moment and the last adjustment moment is obtained, wherein the last adjustment moment is the moment when the second data length threshold was last adjusted; in response to the time interval reaching the third window time, the processing of adjusting the second data length threshold based on the network jitter value is executed.

[0148] For example, the third window time may be 600 milliseconds, that is, if the last adjustment time is greater than 600 milliseconds, step 305 is executed, and if it is less than 600 milliseconds, no processing is performed.

[0149] In some embodiments, before step 305, in response to satisfying the adjustment condition, the process of adjusting the second data length threshold based on the network jitter value is performed;

[0150] The adjustment conditions include at least one of the following:

[0151] 1. The data source corresponding to the media data packet has changed; for example, the current video has copyrights on different video websites, and the data source is switched from website A to website B for viewing.

[0152] 2. The decoding bit rate corresponding to the player changes; for example: from a low bit rate to a high bit rate.

[0153] 3. The file type played by the player changes; for example: the video format switches.

[0154] 4. When the media data packet is a video data packet, the corresponding resolution of the player changes; for example: converting 720P to 1080P.

[0155] 5. When the media data packet is an audio data packet, the sound quality of the player will change, for example, from normal sound quality to lossless sound quality.

[0156] The embodiment of the present application avoids playback jams caused by frequent adjustment of the data length threshold by setting adjustment conditions, saves computing resources, and reduces memory usage.

[0157] Continue to refer 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 time point.

[0158] For example, when the network jitter value is greater than the network jitter value threshold, the adjusted second data length threshold is greater than or equal to the value before adjustment, and the pause duration is greater than or equal to the value before adjustment. However, since the data length stored in the buffer is larger than before adjustment when playback starts, frequent pauses in playback are avoided. When the network jitter value is less than the network jitter value threshold, the adjusted second data length threshold is less than before adjustment, and the pause duration is less than before adjustment. Users do not need to wait longer, which improves the smoothness of media data playback.

[0159] In some embodiments, reference Figure 5 , Figure 5 is a flow chart of a data buffer processing method provided in an embodiment of the present application; Figure 3A After step 304 in Figure 5 Steps 307 to 309 in the method are described in detail below. The execution order of steps 307 to 309 is not specific.

[0160] 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 threshold value, the current second data length threshold is maintained.

[0161] For example, the upper threshold value may be the total data length of the buffer, and when the upper threshold value is reached, the adjustment of the data length threshold is stopped.

[0162] In step 308, in response to the network jitter value being less than the network jitter threshold and greater than or equal to the preset jitter value, and the current second data length threshold being the lower threshold value, the current second data length threshold is maintained.

[0163] For example, the preset jitter value can be set to 30 milliseconds. For humans, it is difficult to detect the jamming between 1 millisecond and 30 milliseconds. The network jitter within this range can be ignored. The network jitter above this range can be used as a reference for adjusting the data length threshold. Setting the lower limit of the threshold can prevent the buffer length of the passive buffer from being too small, causing the media player to frequently pause.

[0164] 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.

[0165] For example, if the network jitter value is less than the preset jitter value, it means that the network delay is difficult for the user to perceive. Within this range, the network jitter value is small, and the second data length threshold may not be adjusted. Avoiding frequent adjustment of the data length threshold saves computing resources.

[0166] In the embodiment of the present application, the network delay is measured by the network jitter value, and the second data length threshold of the data buffer is adjusted based on the network jitter value, so that the buffer strategy matches the network jitter value, and the node at which the player's playback process resumes playback can be dynamically adjusted, thereby improving the player's adaptability to network jitter, avoiding the situation where the player's playback process is frequently paused, and reducing the end-to-end delay during the playback of media data packets. Compared with the related technology of dynamically adjusting the total capacity of the buffer, it reduces memory usage, improves the player's playback fluency, and improves the user experience.

[0167] The following describes an exemplary application of the data buffer processing method according to an embodiment of the present application in a practical application scenario.

[0168] The buffer strategy of the player provided by the related technology is based on a dynamic buffer, that is, the buffer strategy of the player will not change during the current playback process. The buffer strategy of the open source player provided by the related technology is as follows:

[0169] EXOPlayer: Different protocols correspond to different gears, and the buffer size and the threshold for buffered data volume to playback state are different between gears.

[0170] Lightweight Android / iOS video player based on ffplay (IJKPlayer): uses a buffer increment mode. For example, the initial data length of the buffer is 1s, which is extended to 2s after the playback process is paused for the first time, and then extended to 3s when the playback process is paused again, and so on.

[0171] VLC multimedia player: Different buffer strategies are customized according to different protocols. Different buffer strategies have different buffer sizes and multiple buffer states. Different buffer states will affect the sleep time of the packet reading thread.

[0172] The related technologies have the following problems: (1) The buffer mode is fixed and cannot cope with network jitter. (2) Buffer configuration that is too large can resist jitter, but it will cause the end-to-end delay to be too high. Even if the network is restored to stability, the live broadcast delay is still very large. (3) Fixed buffer strategies cannot cope with various live broadcast scenarios and protocols. Different buffer strategies need to be adopted for different protocols in different scenarios, which wastes computing resources, occupies memory, and leads to high maintenance costs.

[0173] The data buffer processing method provided in the embodiment of the present application sets a first data length threshold and a second data length threshold in the buffer. The data length can be characterized by the amount of data or the duration of the data. In the embodiment of the present application, the data duration 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 playing the data in the buffer and actively buffers. 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 playing the data in the buffer. On the basis of the above buffering strategy, the second duration threshold is dynamically adjusted based on the network jitter value. When the network status is good, the second duration threshold is lowered to achieve low latency in the playback process. When the network status is poor, the second duration threshold is raised to reduce the buffering probability and improve video fluency.

[0174] To facilitate understanding of the buffering strategy in the embodiments of the present application, the concept of the buffer water level (Water Mark) is explained below. The buffer is compared to a bucket, and the size of the bucket (Buffer size) is determined according to the application scenario. When the buffer queue balance of the player is less than or equal to the low water level threshold, the amount of data in the buffer reaches the low water level (Low Water Mark), triggering an active buffering event. The player's playback process pauses and buffers more data until the data duration in the buffer is greater than the high water level threshold and the data amount is greater than the high water level (High Water Mark), and the playback process resumes playback.

[0175] refer to Figure 6 , Figure 6 601 is a threshold diagram of the data buffer processing method provided in the embodiment of the present application; the buffer 601 is compared to a bucket, wherein the shaded portion is the media data 602 in the buffer, and the blank portion does not store media data. When the amount of data in the buffer is less than the first duration threshold (corresponding to the low water mark, i.e., the low water threshold), the player's playback process is suspended; when the amount of data in the buffer reaches the second duration threshold (corresponding to the high water mark, i.e., the high water threshold), the playback process resumes playback. When the data duration in the buffer reaches the maximum data duration of the buffer, if the playback process does not play the media data, the buffer stops data buffering processing.

[0176] Below, Figure 1 The terminal device 400 in the embodiment is the execution subject, and the data buffer processing method provided in the embodiment of the present application is described. Fig. 7A , Fig. 7A It is an optional flow chart of the data buffer processing method provided in the embodiment of the present application.

[0177] In step 703A, the data packets are read, and the sending time and receiving time of each data packet are obtained.

[0178] For example, the packet reading thread is used to perform packet reading processing, and the packet reading processing can be performed through the following protocols:

[0179] 1. Hypertext Transfer Protocol-FlashVideo (HTTP-FLV): A hypertext transfer protocol combined with the Real Time Messaging Protocol, used to read data downloaded by the network data transmission tool CURL.

[0180] 2. Real Time Messaging Protocol (RTMP): A toolkit for reading network data through the Real Time Messaging Protocol stream (librtmp).

[0181] 3. Web Real-Time Communications (WebRTC): Read data downloaded from the User Datagram Protocol Channel (UDP Channel).

[0182] For example, the packet reading process is cyclic and continuous. The sending time of each data packet is the time when the data source (eg, server) that sends the data packet outputs the data packet, and the receiving time is the time when the terminal device 400 receives the data packet.

[0183] In step 704A, a network jitter value is determined based on the sending time and receiving time of each data packet.

[0184] For example, the transmission time difference between two adjacent read packet processing can be used as the network jitter value, and the player's buffering strategy can be adjusted according to the network jitter value. The network jitter value can be represented by time. Assuming that the two adjacent data packets at the receiving time are data packet 1 and data packet 2, the network jitter value can be determined in the following way: calculate the transmission time Time1 of data packet 1 packet1 on the network: Time1 = recv_timestamp1-send_timestamp1 (the time when data packet 1 is received minus the time when data packet 1 is sent); calculate the transmission time Time2 of data packet 2 packet2 on the network: Time2 = recv_time stamp2-send_timestamp2 (the time when data packet 2 is received minus the time when data packet 2 is sent); the difference between the transmission time of the two data packets is used as the network jitter value Jitter: Jitter = Time2-Time1 (the difference between the transmission time of data packet 2 and data packet 1).

[0185] For example, step 703A and step 708A are implemented by the demultiplexer thread 701A. The demultiplexer (Demuxer) thread, step 703A and step 708A are performed synchronously. The demultiplexer thread 701A synchronizes the acquired receiving time, sending time and current data duration in the buffer to the jitter buffer process 702A in real time. The jitter buffer process (Jitter Buffer) executes steps 704A to 707A, and steps 709A to 710A.

[0186] In the embodiment of the present application, different processes are used to execute parameter acquisition and buffer strategy adjustment, thereby reducing memory pressure and improving the fluency of the player in playing media.

[0187] In step 705A, it is determined whether the network jitter value is greater than the network jitter threshold. When the determination result of step 705A is yes, step 706A is executed to increase the second duration threshold of the buffer. When the determination result of step 705A is yes, step 707A is executed to decrease the second duration threshold of the buffer.

[0188] For example, the jitter buffer process 702A calculates the network jitter value, compares the network jitter value with the network jitter threshold, and analyzes whether the packet reading jitter time is too long (whether it is greater than the network jitter value). If the judgment result is greater than, it means that the network is not good or network jitter occurs. To avoid frequent buffering, it is necessary to raise the high water mark and reduce the buffering rate. If the packet reading jitter time is at a reasonable level (less than the network jitter value), it means that the network condition is good, and the high water mark can be lowered to reduce the playback delay.

[0189] The network jitter threshold, the first duration threshold, and the second duration threshold may be pre-set or the default values ​​provided by the player kernel. The following explains each configuration item and the default values ​​of the player for the configuration item.

[0190] The configuration item mMinDecreaseDurationMs is defined as the minimum duration allowed to lower the second duration threshold. If the duration is lower than the minimum duration, lowering the second duration threshold (high water mark threshold) will be prohibited. The default value is 2000 milliseconds.

[0191] The configuration item mMaxIncreaseDurationMs is defined as the maximum duration allowed to increase the second duration threshold. If the duration is higher than the maximum duration, the second duration threshold will be prohibited from being increased. The default value is 8000 milliseconds.

[0192] The configuration item mPerIncreaseDurationMs is defined as the duration of each increase in the second duration threshold. The default value is 1000 milliseconds.

[0193] The configuration item mPerDecreaseDurationMs is defined as the duration of each reduction of the second duration threshold. The default value is 500 milliseconds.

[0194] The configuration item mAdjustIntervalThresholdMs is defined as the time interval for performing the adjustment process. It determines whether the second duration threshold needs to be adjusted under the current network jitter value at a certain interval to prevent frequent adjustments. The default value is 600 milliseconds.

[0195] The configuration item mFrozenThresholdMs is defined as the packet reading freeze duration threshold (that is, the network jitter value threshold). If the network jitter value exceeds the packet reading freeze duration threshold, the second duration threshold needs to be adjusted. The default value is 800 milliseconds.

[0196] In some embodiments, steps 703A to 707A are performed synchronously with steps 708A to 709A.

[0197] In step 708A, the current data duration in the buffer is obtained.

[0198] For example, the splitter process 701A reads the data duration in the buffer and synchronizes the data duration to the jitter buffer process 702A.

[0199] In step 709A, in response to the current data duration being less than the first duration threshold, the playback process of the player is controlled to be paused.

[0200] 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 small and it is difficult to maintain the player to continue playing. The playback process is controlled to be paused, and a buffering (loading) icon is displayed in the human-computer interaction interface corresponding to the player to prompt the user that the player is currently actively buffering.

[0201] 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 time point.

[0202] To understand the principle between the change in the amount of data in the buffer and the adjustment of the second duration threshold, refer to Figure 7B , Figure 7B It is a schematic diagram of the buffer strategy principle provided in an embodiment of the present application.

[0203] right Figure 7B The buffering process in is explained. At time t0, the duration of the current data in the buffer is 0, which is less than the first duration threshold, touching the low water mark, triggering active buffering, pausing playback, and displaying the buffering icon in the player. From t0 to t1, the data is buffered, and the playback process is still in a paused state. At time t1, the duration of the current data in the buffer reaches the second duration threshold, ending active buffering, and the playback process continues to play the media data from the paused time node. Assuming that the network is poor, from t1 to t2, the data in the buffer cannot be supplied to the playback process, and the current data duration will gradually decrease 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, and the duration required to resume playback of the media data is extended from t1 to t3. The time required for the duration of the data in the buffer to decrease below the first duration threshold is extended from t2-t1 to t4-t3, avoiding frequent pauses during video playback and improving playback fluency. After executing step 707A, the time required to resume playing the media data is reduced, the pause time is reduced, and the user's viewing experience is improved.

[0204] The embodiment of the present application uses dynamic water level adjustment to allow the player to adapt to different network environments and playback protocols, so that live video can be watched smoothly in areas with poor network conditions. By calculating the time consumption of packet reading jitter, the buffering strategy is changed in real time according to the network status, the data duration threshold of the buffer is increased or decreased, and active buffering or playback is accurately initiated. Whether it is a weak network environment or a normal network, it can adapt well to achieve the best live broadcast effect and improve user experience.

[0205] The following is a description of an exemplary structure of the data buffer processing device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2As 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 also 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 also configured to determine the network jitter value of the received media data packet; the threshold adjustment module 4553 is configured to adjust the second data length threshold based on the network jitter value, wherein the second data length threshold before and after the adjustment is greater than or equal to the first data length threshold; the playback control module 4552 is also configured to resume the playback process of the player from the paused time point in response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold.

[0206] In some embodiments, the threshold adjustment module 4552 is configured to, in response to a network jitter value being greater than or equal to the network jitter threshold, add the second data length threshold to the first data length, and use the sum as the adjusted second data length threshold, wherein the first data length is a single adjustment granularity; in response to a network jitter value being less than the 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.

[0207] 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.

[0208] In some embodiments, the threshold adjustment module 4552 is configured to, in response to a growth rate of the network jitter value within the first window time being greater than a growth rate 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 decay rate of the network jitter value within the first window time being greater than the 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; wherein, the length adjustment value is positively correlated with the network jitter value, and the length adjustment value is a positive number.

[0209] In some embodiments, the threshold adjustment module 4552 is configured to use the product of the network jitter value and the 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 the second proportional coefficient as the length adjustment value when the data length is the sum of the playback duration of the media data packets in the data buffer, wherein the second proportional coefficient is the ratio between time and time.

[0210] In some embodiments, the threshold adjustment module 4552 is configured to call the neural network model for 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.

[0211] In some embodiments, the threshold adjustment module 4552 is configured to obtain the output bit rate of the player; when the data length is the playback time, the receiving speed of the received media data packet is obtained, the ratio between the output bit rate and the receiving speed is determined, and the product between the network jitter value and the ratio is used as the length adjustment value; when the data length is the data volume, the product between the network jitter value and the output bit rate is used as the length adjustment value.

[0212] In some embodiments, the data receiving module 4551 is configured to obtain the sending time and receiving time of a currently received media data packet; obtain the sending time and receiving time of a previous media data packet of the media data packet, wherein the receiving time of the previous media data packet is adjacent to the receiving time of the media data packet; 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 for receiving the media data packet.

[0213] In some embodiments, the data receiving module 4551 is configured to obtain the sending time and the receiving time of a first number of received media data packets; perform the following processing for each media data packet: obtain a first difference between the receiving time of the media data packet and the sending time of the media data packet, and use the first difference as the transmission duration of the media data packet; obtain 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 receiving times; obtain the sum of the third differences of each media data packet pair, and use the ratio of the sum to the second number as a network jitter value, wherein the second number is the difference between the first number and one.

[0214] In some embodiments, the data receiving module 4551 is configured to count the number of media data packets received within the second window time, and obtain the sending time and the receiving time of each media data packet; perform the following processing for each media data packet: obtain a first difference between the receiving time of the media data packet and the sending time of the media data packet, and use the first difference as the transmission duration of the media data packet; obtain 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 receiving times; obtain the sum of the fourth differences of each media data packet pair, and use 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.

[0215] 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 threshold value; 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 the preset jitter value, and the current second data length threshold being the lower threshold value; maintain the current second data length threshold in response to the network jitter value being less than the preset jitter value.

[0216] In some embodiments, the threshold adjustment module 4552 is configured to obtain the time interval between the current moment and the last adjustment moment before adjusting the second data length threshold based on the network jitter value, wherein the last adjustment moment is the moment when the second data length threshold was last adjusted; in response to the time interval reaching the third window time, proceed to execute the processing of adjusting the second data length threshold based on the network jitter value.

[0217] In some embodiments, the threshold adjustment module 4552 is configured to proceed to execute the processing of adjusting the second data length threshold based on the network jitter value in response to satisfying the adjustment condition before adjusting the second data length threshold based on the network jitter value; wherein the adjustment condition includes at least one of the following: the data source corresponding to the media data packet changes; the decoding bit rate 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.

[0218] In some embodiments, the threshold adjustment module 4552 is configured to obtain the total data length of the data buffer; use the product of the total data length and the first data length ratio as the first data length threshold; use the product of the total data length and the second data length ratio 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.

[0219] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the data buffer processing method described above in the embodiment of the present application.

[0220] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will execute the data buffer processing method provided by the embodiment of the present application, for example, Figure 3A The data buffer processing method is shown.

[0221] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0222] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script 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 a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0223] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as 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 coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0224] As an example, computer executable instructions may be deployed to be executed on one terminal device, or on multiple terminal devices located at one site, or on multiple terminal devices distributed at multiple sites and interconnected by a communication network.

[0225] In summary, the embodiment of the present application measures the degree of network delay through the network jitter value, and adjusts the second data length threshold of the data buffer based on the network jitter value, so that the buffering strategy matches the network jitter value, and can dynamically adjust the node where the player's playback process resumes playback, thereby improving the player's adaptability to network jitter, avoiding the situation where the player's playback process is frequently paused, and reducing the end-to-end delay during the playback of media data packets. Compared with the related technology of dynamically adjusting the total capacity of the buffer, it reduces memory usage, improves the playback fluency of the player, and improves the user experience.

[0226] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A data buffer processing method, characterized in that: The method comprises: receiving a media data packet, and storing the media data packet in a data buffer; Invoke a media player to play the media data packet in the data buffer; In response to the data length in the data buffer being less than a first data length threshold, pausing the playing process of the player; Determining a network jitter value for receiving the media data packet; Adjusting a second data length threshold based on the network jitter value, wherein the second data length threshold before and after the 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 playing process of the player is resumed from the paused time point.

2. The method according to claim 1, characterized in that The adjusting the second data length threshold based on the network jitter value includes: In response to the network jitter value being greater than or equal to the network jitter threshold, adding the second data length threshold to the first data length, and using the sum as an adjusted second data length threshold, wherein the first data length is a single adjustment granularity; 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 obtained difference is used as the adjusted second data length threshold, wherein the second data length is a single adjustment granularity.

3. The method according to claim 1, characterized in that: The adjusting the second data length threshold based on the network jitter value includes: In response to the network jitter value being greater than or equal to the network jitter threshold, 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 an adjusted second data length threshold; In response to the network jitter value being less than a network jitter 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 obtained difference as an 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.

4. The method according to claim 1, characterized in that: The adjusting the second data length threshold based on the network jitter value includes: In response to a growth rate of the network jitter value within the first window time being greater than a growth rate threshold, 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 an adjusted second data length threshold; In response to the attenuation rate of the network jitter value within the first window time being greater than the attenuation 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 obtained 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.

5. The method according to claim 3 or 4, characterized in that: The determining the length adjustment value based on the network jitter value comprises: 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 and a first proportionality coefficient is used as the length adjustment value, wherein the first proportionality coefficient is a ratio between the data amount and the time; When the data length is the sum of the play durations of the media data packets in the data buffer, the product of the network jitter value and a second proportional coefficient is used as a length adjustment value, wherein the second proportional coefficient is a ratio between time and time.

6. The method according to claim 3 or 4, characterized in that: The determining the length adjustment value based on the network jitter value comprises: Based on the network jitter value and the current second data length threshold, calling a neural network model to perform prediction processing to obtain the length adjustment value; 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.

7. The method according to claim 3 or 4, characterized in that: The determining the length adjustment value based on the network jitter value comprises: Obtaining the output bit rate of the player; When the data length is the playback duration, obtaining a receiving speed of the media data packet, determining a ratio between the output bit rate and the receiving speed, and taking a product between the network jitter value and the ratio as the length adjustment value; When the data length is the data amount, the product of the network jitter value and the output bit rate is used as the length adjustment value.

8. The method according to claim 1, characterized in that: The determining a network jitter value for receiving the media data packet comprises: Obtaining the sending time and receiving time of the currently received media data packet; Acquire the sending time and receiving time of a previous media data packet of the media data packet, wherein the receiving time of the previous media data packet is adjacent to the receiving time of the media data packet; For each of the media data packets, the following processing is performed: obtaining a first difference between the receiving time and the sending time, and using the first difference as the transmission duration of the media data packet; Acquire a second difference between the transmission duration of the media data packet and the transmission duration of the previous media data packet; The second difference is used as a network jitter value for receiving the media data packet.

9. The method according to claim 1, characterized in that: The determining a network jitter value for receiving the media data packet comprises: Obtaining the sending time and receiving time of the first number of received media data packets; For each of the media data packets, the following processing is performed: obtaining a first difference between a receiving time of the media data packet and a sending time of the media data packet, and using the first difference as a transmission duration of the media data packet; Acquire a third difference between 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 receiving times; A sum of the third difference values ​​of each of the media data packet pairs is obtained, and a ratio of the sum to the second number is used as the network jitter value, wherein the second number is a difference between the first number and one.

10. The method according to claim 1, characterized in that The determining a network jitter value for receiving the media data packet comprises: Counting the number of media data packets received within the second window time, and obtaining the sending time and receiving time of each media data packet; For each of the media data packets, the following processing is performed: obtaining a first difference between a receiving time of the media data packet and a sending time of the media data packet, and using the first difference as a transmission duration of the media data packet; Acquire a fourth difference between 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 receiving times; A sum of the fourth difference values ​​of each of the media data packet pairs is obtained, and a ratio between the sum and the number of data packet pairs is used as the network jitter value, wherein the number of data packet pairs is the difference between the number of data packets and one.

11. The method according to claim 1, characterized in that: After determining the network jitter value of receiving the media data packet, 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 an upper threshold value, maintaining the current second data length threshold; In response to the network jitter value being less than the network jitter threshold and greater than or equal to the preset jitter value, and the current second data length threshold being the lower threshold value, maintaining the current second data length threshold; In response to the network jitter value being less than a preset jitter value, maintaining the current second data length threshold.

12. The method according to claim 1, characterized in that Before adjusting the second data length threshold based on the network jitter value, the method further includes: Obtaining a time interval between a current moment and a last adjustment moment, wherein the last adjustment moment is a moment 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 executed.

13. The method according to claim 1, characterized in that Before adjusting the second data length threshold based on the network jitter value, the method further includes: In response to the adjustment condition being met, proceeding to execute the process of adjusting the second data length threshold based on the network jitter value; The adjustment condition includes at least one of the following: The data source corresponding to the media data packet changes; The decoding bit rate corresponding to the player changes; The type of file 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.

14. The method according to claim 1, characterized in that The method further comprises: Obtaining the total data length of the data buffer; Taking the product of the total data length and the first data length ratio as the first data length threshold; taking the product of the total data length and the second data length ratio as the second data length threshold; Among them, the first data length ratio is smaller than the second data length ratio, and the second data length ratio is smaller than one.

15. A data buffer processing device, characterized in that: The device comprises: A data receiving module, configured to receive a media data packet and store the media data packet into a data buffer; A play control module, configured to call a media player to play the media data packet 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 further configured to determine a network jitter value for receiving the media data packet; a threshold adjustment module, configured to adjust a second data length threshold based on the network jitter value, wherein the second data length threshold before and after the 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 a paused time point in response to the data length of the data buffer being greater than or equal to the adjusted second data length threshold.

16. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; A processor, configured to implement the data buffer processing method according to any one of claims 1 to 15 when executing the computer executable instructions or computer programs stored in the memory.

17. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 15 is implemented.

18. 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, the method according to any one of claims 1 to 15 is implemented.

Citation Information

Patent Citations

  • Method of dynamically adjusting data reception cache and video decoding device

    CN106331835A

  • Display device and media asset playing method

    CN114827715A

  • Method and device for determining network jitter state, electronic equipment and storage medium

    CN115118636A