Data sending method and device in weak network scenario

By transmitting keyframes and necessary video data in weak network scenarios, accurately calculating timestamps and adjusting the transmission rate, the problems of network congestion and latency were solved, and the stability and smoothness of video playback were achieved.

CN119893155BActive Publication Date: 2026-01-13CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411794182.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2026-01-13
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

When network conditions are poor, existing technologies rely on server-side caching of data to quickly transmit video, leading to network congestion and latency, which affects the normal operation of other network applications.

Method used

In weak network scenarios, only key frames and necessary video data are transmitted. By accurately calculating the timestamps of video frames and the transmission rate, smooth video transmission is ensured, and the transmission rate is dynamically adjusted when network conditions change.

Benefits of technology

It reduces network load, lowers network congestion and latency, improves network stability and reliability, ensures the synchronization and smoothness of video playback, and reduces playback delay and stuttering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119893155B_ABST
    Figure CN119893155B_ABST
Patent Text Reader

Abstract

The application relates to the weak media technology field and discloses a data sending method and device in a weak network scene. The method comprises the following steps: acquiring cache data and the latest frame in the cache data; the latest frame is a data frame to be sent; according to the type of the latest frame, a target key frame is determined from the cache data; the video time stamp between the target key frame and the latest frame is changed into the video time stamp corresponding to the target key frame, so that a modified video frame is obtained; the modified video frame is encapsulated into a video stream; and the video stream is sent to a client according to a target rate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of streaming media, in particular to a data sending method and device in a weak network scenario, a computer device, a storage medium and a program product. BACKGROUND

[0002] The "fast start" playback strategy on the market currently mainly relies on the cached data stored on the server side to realize fast start. When a user initiates a playback request, the system will preferentially read data from the cache of the server and immediately send it to the terminal user.

[0003] When the network condition is not good, quickly delivering a large amount of data to the terminal user can further occupy the network exit resources. This can cause tension of the network bandwidth and even cause network congestion, thereby affecting the normal operation of other network applications. SUMMARY

[0004] Therefore, the present application provides a data sending method and device in a weak network scenario, a computer device, a storage medium and a program product.

[0005] In a first aspect, the present application provides a data sending method in a weak network scenario, which comprises: obtaining cached data and the latest frame in the cached data; wherein the latest frame is a data frame to be sent; determining a target key frame from the cached data according to the type of the latest frame; changing the video timestamps between the target key frame and the latest frame to the video timestamp corresponding to the target key frame to obtain modified video frames; encapsulating the modified video frames into a video stream and sending the video stream to a client at a target rate.

[0006] The data sending method in a weak network scenario provided by the present embodiment reduces the amount of data transmitted when the network condition is not good by transmitting only key frames and necessary video data, so that reducing the data transmission amount means reducing the load on the network, thereby reducing network congestion and delay and improving the stability and reliability of the overall network. At the same time, the sending rate of the video stream is dynamically adjusted according to the network condition to ensure that the client can stably receive data and play it.

[0007] In one possible implementation, determining the target key frame from the cached data according to the type of the latest frame comprises: if the type of the latest frame is a bidirectional prediction frame, obtaining a preset cache time, a decoding time of the bidirectional prediction frame and a display time of the decoded bidirectional prediction frame; obtaining a first target time according to the display time of the decoded bidirectional prediction frame, the decoding time of the bidirectional prediction frame and the preset cache time; traversing the cached data to determine a first target data frame that is different from the latest frame by the first target time; wherein if the first target data frame is a key frame, the key frame is taken as the target key frame.

[0008] The method for sending data in a weak network scenario provided in this embodiment can obtain an accurate first target time by accurately calculating the decoding time, display time and preset cache time of the bidirectional prediction frame. This time point is used to find a key frame matching the target time in the cached data, thereby ensuring the synchronization of video playback. Moreover, since the playback time can be accurately controlled, the playback delay caused by waiting for data decoding or transmission can be reduced. Meanwhile, the bidirectional prediction frame usually needs to rely on the previous and subsequent frames for decoding, and the method can reduce the decoding operation on unnecessary frames by determining the target key frame, thereby improving the decoding efficiency.

[0009] In a possible implementation, the target key frame is determined from the cached data according to the type of the latest frame, including: if the type of the latest frame is a prediction frame, determining the previous data frame of the prediction frame; obtaining the preset cache time, the display time of the decoded prediction frame, and the display time of the decoded previous data frame of the prediction frame; determining a second target time according to the preset cache time, the display time of the decoded prediction frame, and the display time of the decoded previous data frame of the prediction frame; and traversing the cached data to determine a second target data frame that is different from the data frame by the second target time; wherein, if the second target data frame is a key frame, the key frame is taken as the target key frame.

[0010] The method for sending data in a weak network scenario provided in this embodiment can ensure that the previous data frame relied on by the prediction frame is ready when the prediction frame is played, thereby reducing the possibility of playback interruption. Moreover, since it can be ensured that the dependent frame of the prediction frame has been decoded and is available, the video can be played more smoothly, and the freezing phenomenon caused by waiting for the dependent frame to be decoded can be reduced. Meanwhile, by accurately calculating the second target time and determining the target key frame, the occupation of unnecessary data in the cache can be reduced, thereby reducing the consumption of system resources.

[0011] In a possible implementation, the method further includes: if the first target data frame is not a key frame, continuing to traverse the cached data until the determined data frame is a key frame, and taking the key frame as the target key frame.

[0012] The method for sending data in a weak network scenario provided in this embodiment can ensure that the subsequent video frames can be correctly decoded based on the key frame if the first target data frame is not a key frame, by continuing to traverse the cached data until the determined data frame is a key frame. Meanwhile, if a non-key frame is directly used as the starting point for decoding, decoding failure or playback interruption can occur. By ensuring the existence of the target key frame, this risk can be reduced, thereby maintaining the continuity of video playback.

[0013] In a possible implementation, the video stream is sent to the client at the target rate, including: detecting whether the current acknowledgement packet returned by the client is the acknowledgement packet corresponding to the current data packet sent to the client; detecting whether the target acknowledgement packet returned by the client is not received within a preset time length; wherein the target acknowledgement packet is the acknowledgement packet corresponding to the current data packet sent by the client; if the current acknowledgement packet returned by the client is not the acknowledgement packet corresponding to the data packet sent by the client or the target acknowledgement packet returned by the client is not received within the preset time length, starting from the tail of the video stream, gradually advancing forward at a target proportion, to discard predicted frames until the number of discarded predicted frames reaches a preset threshold, and sending the adjusted video stream to the client at the target rate.

[0014] The data sending method in the weak network scenario provided by the embodiment can ensure that the client correctly receives the data packet by detecting the acknowledgement packet. If the acknowledgement packet is not received or does not match, the system can timely discover and take corresponding measures, thereby avoiding data loss or transmission errors. When it is detected that the client fails to return the target acknowledgement packet within a preset time length, the system can start from the tail of the video stream and gradually advance forward to discard predicted frames. This method helps to reduce the video lag or unsmooth playing phenomenon caused by network delay or packet loss, and improves user experience.

[0015] In a second aspect, the present application provides a data sending device in a weak network scenario, which comprises: an acquisition module, configured to acquire cache data and a latest frame in the cache data; wherein the latest frame is a data frame to be sent; a determination module, configured to determine a target key frame from the cache data according to the type of the latest frame; a change module, configured to change the video timestamps between the target key frame and the latest frame into the video timestamp corresponding to the target key frame, to obtain a modified video frame; and a sending module, configured to encapsulate the modified video frame into a video stream, and send the video stream to a client at a target rate.

[0016] In a possible implementation, the determination module comprises: an acquisition unit, configured to acquire a preset cache time, a decoding time of the bidirectional predicted frame, and a display time of the decoded bidirectional predicted frame, if the type of the latest frame is the bidirectional predicted frame; a first determination unit, configured to obtain a first target time according to the display time of the decoded bidirectional predicted frame, the decoding time of the bidirectional predicted frame, and the preset cache time; and a second determination unit, configured to traverse the cache data to determine a first target data frame that is different from the latest frame by the first target time; wherein if the first target data frame is a key frame, the key frame is taken as the target key frame.

[0017] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, which are connected with each other in communication, and the memory stores computer instructions, and the processor executes the computer instructions to perform the data sending method in the weak network scenario according to the first aspect or any one of the corresponding embodiments.

[0018] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions, and the computer instructions are used to make a computer execute the data sending method in the weak network scenario according to the first aspect or any one of the corresponding embodiments.

[0019] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions, and the computer instructions are used to make a computer execute the data sending method in the weak network scenario according to the first aspect or any one of the corresponding embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0021] Figure 1 is a flow diagram of the data sending method in the weak network scenario according to the embodiment of the present application;

[0022] Figure 2 is a schematic diagram of the timestamp setting strategy provided according to the embodiment of the present application;

[0023] Figure 3 is a schematic diagram of the data sending method in the weak network scenario according to the embodiment of the present application;

[0024] Figure 4 is a schematic diagram of the discard strategy provided according to the embodiment of the present application;

[0025] Figure 5 is a structural block diagram of the data sending device in the weak network scenario according to the embodiment of the present application;

[0026] Figure 6 is a hardware structure schematic diagram of the computer device according to the embodiment of the present application. DETAILED DESCRIPTION

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] Currently available "quick start" playback strategies primarily rely on cached data stored on the server side to achieve rapid startup. When a user initiates a playback request, the system will first read data from the server's cache and immediately send it to the end user.

[0029] When network conditions are poor, rapidly transmitting large amounts of data to end users may further strain network egress resources. This can lead to network bandwidth constraints and even network congestion, thereby affecting the normal operation of other network applications.

[0030] Based on this, the present invention provides a data transmission method for weak network scenarios. By transmitting only key frames and necessary video data, the amount of data transmitted under poor network conditions is reduced. This reduction in data transmission volume means a decrease in network load, thereby reducing network congestion and latency, and improving the overall stability and reliability of the network. Simultaneously, the video stream transmission rate is dynamically adjusted according to network conditions to ensure that the client can stably receive and play data.

[0031] According to an embodiment of the present invention, a data transmission method embodiment for weak network scenarios is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0032] This embodiment provides a data transmission method for weak network scenarios, which can be used in computer devices such as computers and servers. Figure 1 This is a flowchart illustrating a data transmission method in a weak network scenario according to an embodiment of the present invention, as shown below. Figure 1 As shown, the process includes the following steps:

[0033] Step S101: Obtain cached data and the latest frame in the cached data; wherein, the latest frame is the data frame that is about to be sent.

[0034] The cached data can represent data stored in a memory for temporarily storing data to be processed or transmitted. In video transmission, the cached data can include multiple frames of video data. Specifically, the cached data can be 2 gops (Group of Pictures) of live data. The latest frame can represent a frame to be transmitted. Specifically, the cached data is read from the memory, and a latest frame therefrom is determined.

[0035] As an example, the data is read by a memory access operation, and the cached data is managed by a data structure (e.g., a linked list, a queue) for quickly locating the latest frame.

[0036] At step S102, a target key frame is determined from the cached data according to a type of the latest frame.

[0037] The type of the latest frame can include a P frame, an I frame, and a B frame.

[0038] The I frame is an intra-frame compression encoded frame, also known as an intra picture. It is a key frame in a video sequence and contains complete picture information, which can be decoded independently. The I frame can be decoded without relying on other frames. The I frame has relatively low compression efficiency, but decoding speed is fast because it does not need to refer to other frames. The I frame can be used as a reference point for random access to quickly locate a frame in a video. In video editing and trimming, the I frame can be used as a key frame for precise operations.

[0039] The P frame is an encoded frame that compresses the current frame data according to the differences between the current frame and the adjacent previous frame (I frame or P frame), also known as a predicted frame. It improves video compression efficiency by reducing redundant information. In video playback, the P frame can be decoded by relying on the previous I frame or P frame, thereby ensuring the smoothness of the video. The B frame is an encoded frame that compresses the current frame according to the differences between the adjacent previous frame, the current frame, and the next frame, also known as a bidirectional predicted frame.

[0040] The target key frame can be an I frame. Specifically, the way to determine the target key frame from the cached data is different according to the type of the latest frame.

[0041] As an example, when the type of the latest frame is a P frame, the target key frame needs to be determined according to the information of the previous data frame of the P frame.

[0042] As an example, when the type of the latest frame is a B frame, the target key frame needs to be determined by the information of the B frame.

[0043] At step S103, the video timestamps between the target key frame and the latest frame are both changed to a video timestamp corresponding to the target key frame, to obtain a modified video frame.

[0044] The video timestamp is used to identify the time position of a video frame in a video stream, ensuring that the video frames can be played in the correct order. Specifically, after determining the target key frame, the video timestamps corresponding to all data frames between the target key frame and the latest frame are changed to the video timestamp corresponding to the target key frame.

[0045] As an example, first, a key frame is determined as the target key frame in the cached data according to certain rules (such as time interval, content change, etc.). Starting from the target key frame, the latest frame is traversed backward, and all frames including the two frames will be processed. For each frame traversed, its video timestamp is changed to the timestamp of the target key frame. This usually involves modifying the timestamp field in the frame header.

[0046] In one possible implementation, it can be recorded which frames have had their timestamps modified for subsequent processing or debugging.

[0047] Please refer to Figure 2 , Figure 2 is a schematic diagram of a timestamp setting strategy provided according to an embodiment of the present application.

[0048] The video timestamps from the I frame to the history (the latest frame) are all changed to the I frame timestamp. The audio timestamp remains unchanged.

[0049] As an example, changing the video timestamps from the I frame to the history (the latest frame) to the I frame timestamp can be the process of changing a segment of data frames.

[0050] Step S104, encapsulate the modified video frames into a video stream, and send the video stream to the client at the target rate.

[0051] The modified video frames are encapsulated into a video stream. Specifically, the modified video frames can be encapsulated into a video stream by professional encapsulation software, or by other means, etc., which are not limited here and can be implemented by those skilled in the art.

[0052] As an example, according to the application scenario and client requirements, a suitable video encapsulation format (such as MP4, FLV, MKV, etc.) is selected. The encapsulation format determines the organization structure of the video data and the storage method of the metadata (such as timestamp, index, etc.). The modified video frames are packaged according to the requirements of the encapsulation format. Each video frame will be encapsulated into one or more data packets, and the corresponding header information (such as frame type, timestamp, etc.) will be added. The encapsulated data packets will form a continuous video stream, facilitating network transmission and client decoding.

[0053] The target rate can represent a rate greater than the playback bitrate. Specifically, the target transmission rate of the video stream is determined according to factors such as network bandwidth, client processing capability, video quality demand, etc. The target rate should ensure smooth playback of the video stream while avoiding network congestion and client decoding pressure. An appropriate rate control algorithm (such as TCP flow control, UDP rate limiting, etc.) is used to ensure that the video stream is sent at the target rate. The algorithm dynamically adjusts the sending rate according to network conditions (such as delay, packet loss rate, etc.) to maintain the stability and reliability of transmission. Buffering is set at the sending end and the receiving end to store temporary data to cope with network fluctuations and data transmission delays. The sending end adjusts the sending rate according to the size and state of the buffer to avoid buffer overflow or underflow.

[0054] The data transmission method in a weak network scenario provided by the embodiment reduces the amount of data transmitted when the network is poor by transmitting only key frames and necessary video data, thereby reducing the amount of data transmission, which means reducing the load on the network, thereby reducing network congestion and delay and improving the stability and reliability of the overall network. At the same time, the sending rate of the video stream is dynamically adjusted according to the network conditions to ensure that the client can stably receive data and play it.

[0055] In one possible implementation, the step S102 includes:

[0056] In step a1, if the type of the latest frame is a bidirectional prediction frame, a preset buffer time, a decoding time of the bidirectional prediction frame, and a display time of the decoded bidirectional prediction frame are obtained.

[0057] As can be seen from the above, the bidirectional prediction frame can be a B frame. If the type of the latest frame is a bidirectional prediction frame, a preset buffer time, a decoding time of the bidirectional prediction frame, and a display time of the decoded bidirectional prediction frame are obtained. The preset buffer time can be determined according to the requirements of the system or application to ensure sufficient buffering between decoding and display of the video frame. The decoding time of the bidirectional prediction frame can represent the time required to decode the current bidirectional prediction frame. The display time of the decoded bidirectional prediction frame can represent the timestamp at which the bidirectional prediction frame should be displayed to the user after decoding.

[0058] In step a2, a first target time is obtained according to the display time of the decoded bidirectional prediction frame, the decoding time of the bidirectional prediction frame, and the preset buffer time.

[0059] Based on the time parameters obtained in step a1, a value called "first target time" is calculated. This value can be obtained by combining the display time, decoding time, and preset buffer time of the bidirectional prediction frame, and is used to find the frame that differs from the latest frame by this time in the buffered data.

[0060] As an example, the first target time can be determined as the sum of the display time of the decoded bidirectional prediction frame, the decoding time of the bidirectional prediction frame, and the preset cache time, minus the preset cache time.

[0061] Step a3: traversing the cache data to determine a first target data frame that is different from the latest frame by a first target time; if the first target data frame is a key frame, the key frame is determined as the target key frame.

[0062] According to the calculated first target time, a frame that is different from the latest frame by the first target time is searched in the cache data. Specifically, the position of the first target time can be searched from the position of the latest frame, so as to determine the first target data frame. If the first target data frame is a key frame (such as an I frame), it is determined as the target key frame. If the first target data frame is not a key frame, the target key frame can be further determined according to a specific rule or algorithm, or in some cases, the current target key frame can be selected without change.

[0063] The data sending method in the weak network scenario provided by the embodiment can obtain an accurate first target time by accurately calculating the decoding time, display time, and preset cache time of the bidirectional prediction frame. This time point is used to search for a key frame that matches the target time in the cache data, so as to ensure the synchronization of video playing. Moreover, since the playing time can be accurately controlled, the playing delay caused by waiting for data decoding or transmission can be reduced. Meanwhile, the bidirectional prediction frame usually needs to be decoded by relying on the previous and subsequent frames, and the method can reduce the decoding operation on unnecessary frames, thereby improving the decoding efficiency.

[0064] In one possible implementation, the step S102 includes:

[0065] Step b1: if the type of the latest frame is a prediction frame, determining the last data frame of the prediction frame.

[0066] As known from the above, the prediction frame can be a P frame. For details, please refer to Figure 3 When the prediction frame is a P frame, its last data frame can be found. The last data frame can be an I frame (key frame) or a P frame (another prediction frame, but it is used as a reference frame here).

[0067] Step b2: obtaining a preset cache time, a display time of the decoded prediction frame, and a display time of the decoded last data frame of the prediction frame.

[0068] The display time of the decoded prediction frame can represent a timestamp of when the prediction frame should be displayed to a user after being decoded. The display time of the last data frame of the prediction frame after being decoded can represent a timestamp of when the last data frame of the prediction frame should be displayed to a user after being decoded.

[0069] In step b3, the second target time is determined according to the preset cache time, the display time of the decoded prediction frame, and the display time of the last data frame of the prediction frame after being decoded.

[0070] Please refer to Figure 2 Due to the cache time, the frame needs to be processed or transmitted in advance. The display time of the last data frame can also be considered to ensure that the interval between frames is reasonable. The display time of the last data frame is mainly used to determine the order and dependency of the frames, rather than being directly used to calculate the second target time. The display time of the last data frame and the predicted decoding time of the current prediction frame can be used to calculate a safe second target time.

[0071] As an example, the second target time can be obtained by subtracting the preset cache time from the sum of the display time of the decoded prediction frame and the display time of the last data frame of the prediction frame after being decoded.

[0072] In step b4, the second target data frame that is different from the data frame by the second target time is determined by traversing the cache data. If the second target data frame is a key frame, the key frame is taken as the target key frame.

[0073] According to the calculated second target time, the frame that is different from the second target time in the cache data is searched. Specifically, the position of the second target time can be searched from the position of the latest frame, so as to determine the second target data frame. If the second target data frame is a key frame (such as an I frame), it is determined as the target key frame. If the second target data frame is not a key frame, the target key frame can be further determined according to a specific rule or algorithm, or in some cases, the current target key frame can be selected without change.

[0074] The data sending method in the weak network scenario provided by the embodiment can ensure that the dependent data frame of the prediction frame is ready when the prediction frame is played, thereby reducing the possibility of playing interruption. Moreover, since it can be ensured that the dependent frame of the prediction frame has been decoded and is available, the video can be played more smoothly, and the phenomenon of lag caused by waiting for the dependent frame to be decoded is reduced. Meanwhile, by accurately calculating the second target time and determining the target key frame, the occupation of unnecessary data in the cache can be reduced, thereby reducing the consumption of system resources.

[0075] In a possible implementation, the method further includes: if the first target data frame is not a key frame, continuing to traverse the cache data until a determined data frame is a key frame, and taking the key frame as a target key frame.

[0076] When the first target data frame is not a key frame, it is indicated that the video stream data cannot be sent from the frame, and it is necessary to continue to traverse the cache data forward or backward from the frame until a first key frame is found.

[0077] As an example, the first target data frame is a P frame, which is not a key frame. Therefore, the system needs to continue to traverse the cache to find a key frame. The traversal process continues until an I frame is found, which is determined as a target key frame. This process ensures that the system can find and process a key frame even if the initially received frame is not a key frame.

[0078] It should be noted that when the second target data frame is not a key frame, the processing manner is consistent with that when the first target data frame is not a key frame, which will not be described in detail here.

[0079] The data sending method in a weak network scenario provided in the embodiment ensures that subsequent video frames can be correctly decoded based on the key frame if the first target data frame is not a key frame and the cache data is continued to be traversed until a determined data frame is a key frame. Meanwhile, if a non-key frame is directly used as a starting point for decoding, decoding failure or playback interruption can be caused. By ensuring the existence of the target key frame, the risk can be reduced, thereby maintaining the continuity of video playback.

[0080] In a possible implementation, the step S104 of sending the video stream to the client according to the target rate includes:

[0081] c1, detecting whether the current acknowledgement packet returned by the client is an acknowledgement packet corresponding to the current data packet sent to the client.

[0082] After sending a data packet, the server waits for an acknowledgement packet (ACK) returned by the client. The acknowledgement packet can include information such as a sequence number or a timestamp of the data packet to be acknowledged, so that the server can confirm which data packet is received by the client. Specifically, when the server sends a data packet, it needs to detect whether the acknowledgement packet corresponding to the data packet is returned to the server.

[0083] As an example, the server sends data packet A, data packet B, and data packet C in sequence; when data packet C is sent, the returned acknowledgement packet is the acknowledgement packet of data packet A, and then it is considered that data packet A is abnormal.

[0084] Step c2, detecting whether the target confirmation packet returned by the client is not received within a preset time length; wherein the target confirmation packet is the confirmation packet corresponding to the current data packet sent by the client.

[0085] The server can set a preset time length (timeout time) for waiting for the target confirmation packet (i.e. the confirmation packet for the current data packet) returned by the client. If the target confirmation packet is not received within the preset time length, the server considers that the current data packet may be lost or the client fails to process the data packet in time.

[0086] Step c3, if the current confirmation packet returned by the client is not the confirmation packet corresponding to the data packet sent by the client or the target confirmation packet returned by the client is not received within the preset time length, gradually advancing from the tail of the video stream to the front at a target proportion to discard predicted frames until the number of discarded predicted frames reaches a preset threshold, and sending the adjusted video stream to the client at a target rate.

[0087] If the target confirmation packet is not received within the preset time length, the server considers that the current data packet may be lost or the client fails to process the data packet in time or the current confirmation packet returned by the client is not the confirmation packet corresponding to the data packet sent by the client, then the server starts advancing from the tail of the video stream (i.e. the most recent data frame) to the front, gradually discarding predicted frames (such as P frames), and the number of discarded predicted frames is determined according to a target proportion. This proportion may dynamically adjust the discarding process based on network conditions, packet loss rate, client buffer capacity, etc. The discarding process continues until the number of discarded predicted frames reaches a preset threshold.

[0088] Then, after discarding the predicted frames, the server re-sends the adjusted video stream to the client at a target rate. This target rate may also be adjusted according to the network conditions to ensure smooth transmission of the video stream.

[0089] Please refer to Figure 4 , Figure 4 is a schematic diagram of the discarding strategy provided according to an embodiment of the application.

[0090] Detecting whether the nack signal is normally received, if the nack signal is not received, according to the received ACK proportion, discarding the corresponding P frames from the tail in the to-be-sent complete video frames according to the proportion, and retaining the I frames, B frames and audio frames, so as to reduce the transmission data amount and make the data quickly reach the end user.

[0091] The data sending method in the weak network scenario provided by the embodiment can ensure that the client correctly receives the data packet by detecting the acknowledgement packet. If the acknowledgement packet is not received or does not match, the system can timely discover and take corresponding measures, thereby avoiding data loss or transmission errors. When it is detected that the client fails to return the target acknowledgement packet within a preset time length, the system can start from the tail of the video stream and gradually push forward, discarding the predicted frame. This method helps to reduce the video lag or unsmooth playing phenomenon caused by network delay or packet loss, and improves the user experience.

[0092] In the embodiment, a data sending device in a weak network scenario is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described herein. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware is also possible and contemplated.

[0093] The embodiment provides a data sending device in a weak network scenario, as shown in Figure 5 The data sending device comprises:

[0094] The obtaining module 501 is configured to obtain the cache data and the latest frame in the cache data, wherein the latest frame is a data frame to be sent.

[0095] The determining module 502 is configured to determine a target key frame from the cache data according to the type of the latest frame.

[0096] The changing module 503 is configured to change the video timestamps between the target key frame and the latest frame to the video timestamp corresponding to the target key frame, to obtain a modified video frame.

[0097] The sending module 504 is configured to encapsulate the modified video frame into a video stream, and send the video stream to the client at a target rate.

[0098] In one possible implementation, the determining module 502 comprises: an obtaining unit configured to, if the type of the latest frame is a bidirectional predicted frame, obtain a preset cache time, a decoding time of the bidirectional predicted frame, and a display time of the decoded bidirectional predicted frame; a first determining unit configured to obtain a first target time according to the display time of the decoded bidirectional predicted frame, the decoding time of the bidirectional predicted frame, and the preset cache time; and a second determining unit configured to traverse the cache data to determine a first target data frame that is different from the latest frame by the first target time, wherein if the first target data frame is a key frame, the key frame is taken as the target key frame.

[0099] The further function description of the above-mentioned various modules and units is the same as that of the above-mentioned corresponding embodiments, which will not be described herein.

[0100] The data sending in the weak network scenario in the embodiment is presented in the form of a functional unit, which refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory executing one or more software or fixed programs, and / or other devices that can provide the above functions.

[0101] The embodiment of the application further provides a computer device having the above Figure 5 data sending apparatus in the weak network scenario.

[0102] Please refer to Figure 6 , Figure 6 is a structural schematic diagram of a computer device provided by an optional embodiment of the application, as Figure 6 shown, the computer device includes one or more processors 10, a memory 20, and an interface for connecting components, including a high-speed interface and a low-speed interface. Various components are communicatively connected to each other by different buses, and can be installed on a common mainboard or in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in the memory or on the memory to display graphical information of a GUI on an external input / output device, such as a display device coupled to the interface. In some optional embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memories, if necessary. Similarly, multiple computer devices can be connected, each providing part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 In the embodiment, the processor 10 is taken as an example.

[0103] The processor 10 can be a central processor, a network processor, or a combination thereof. The processor 10 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device can be a complex programmable logic device, a field programmable logic gate array, a generic array logic, or any combination thereof.

[0104] The memory 20 stores instructions executable by the at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0105] The memory 20 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required for at least one function, etc. The data storage area can store data created by the computer device, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-transitory memory such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid state memory device. In some alternative embodiments, the memory 20 can optionally include memory that is remotely located with respect to the processor 10, and which can be connected to the computer device through a network. Examples of such networks include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communications network, and combinations thereof.

[0106] The memory 20 can include a volatile memory, such as a random access memory, and / or can include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid state memory device. The memory 20 can also include an array of multi-state flash memory cells, which can be used to store data and / or instructions in multiple states.

[0107] The computer device also includes a communications interface 30 for communicating with other devices or communication networks.

[0108] The embodiments of the present application also provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or implemented as computer code to be originally stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that the computer, processor, microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the method shown in the above embodiments.

[0109] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, can invoke or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source files, executable files, installation package files and the like, and accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0110] Although the embodiments of the present application are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A data sending method in a weak network scenario, characterized in that, The method comprises: acquiring cache data and a latest frame in the cache data, wherein the latest frame is a data frame to be sent; determining a target key frame from the cache data according to a type of the latest frame; changing video time stamps between the target key frame and the latest frame into a video time stamp corresponding to the target key frame to obtain a modified video frame; encapsulating the modified video frame into a video stream and sending the video stream to a client at a target rate, comprising: detecting whether a current acknowledgement packet returned by the client is an acknowledgement packet corresponding to a current data packet sent to the client; detecting whether a target acknowledgement packet returned by the client is not received within a preset time length; wherein the target acknowledgement packet is an acknowledgement packet corresponding to a current data packet sent by the client; if the current acknowledgement packet returned by the client is not the acknowledgement packet corresponding to the data packet sent by the client or the target acknowledgement packet returned by the client is not received within the preset time length, gradually advancing forward from the tail of the video stream according to a target proportion to discard predicted frames until the number of discarded predicted frames reaches a preset threshold, and sending the adjusted video stream to the client at the target rate.

2. The data sending method in a weak network scenario according to claim 1, characterized in that, The determining of the target key frame from the cache data according to the type of the latest frame comprises: if the type of the latest frame is a bidirectional predicted frame, acquiring a preset cache time, a decoding time of the bidirectional predicted frame and a display time of the decoded bidirectional predicted frame; obtaining a first target time according to the display time of the decoded bidirectional predicted frame, the decoding time of the bidirectional predicted frame and the preset cache time; traversing the cache data to determine a first target data frame different from the latest frame by the first target time; wherein if the first target data frame is a key frame, the key frame is taken as the target key frame.

3. The data sending method in a weak network scenario according to claim 1, characterized in that, The determining of the target key frame from the cache data according to the type of the latest frame comprises: if the type of the latest frame is a predicted frame, determining a previous data frame of the predicted frame; acquiring a preset cache time, a display time of the decoded predicted frame and a display time of the decoded previous data frame of the predicted frame; determining a second target time according to the preset cache time, the display time of the decoded predicted frame and the display time of the decoded previous data frame of the predicted frame; traversing the cache data to determine a second target data frame different from the data frame by the second target time; wherein if the second target data frame is a key frame, the key frame is taken as the target key frame.

4. The data sending method in a weak network scenario according to claim 2, characterized in that, The method further comprises: if the first target data frame is not a key frame, continuing to traverse the cache data until a determined data frame is a key frame, and taking the key frame as the target key frame.

5. A data sending device in a weak network scenario, characterized in that, The device comprises: an acquisition module configured to acquire cache data and a latest frame in the cache data, wherein the latest frame is a data frame to be sent; a determination module configured to determine a target key frame from the cache data according to a type of the latest frame; a change module configured to change video time stamps between the target key frame and the latest frame into a video time stamp corresponding to the target key frame to obtain a modified video frame; The sending module is configured to encapsulate the modified video frame into a video stream, and send the video stream to the client at a target rate, including: detecting whether the current acknowledgement packet returned by the client is the acknowledgement packet corresponding to the current data packet sent to the client; detecting whether the target acknowledgement packet returned by the client is not received within a preset time length; wherein the target acknowledgement packet is the acknowledgement packet corresponding to the current data packet sent by the client; if the current acknowledgement packet returned by the client is not the acknowledgement packet corresponding to the data packet sent by the client or the target acknowledgement packet returned by the client is not received within the preset time length, gradually advancing from the tail of the video stream according to a target proportion, to discard the predicted frame until the number of discarded predicted frames reaches a preset threshold, and sending the adjusted video stream to the client at the target rate.

6. The data sending device in a weak network scenario according to claim 5, characterized in that, The determining module includes: The acquisition unit is configured to, if the type of the latest frame is a bidirectional predicted frame, acquire a preset cache time, a decoding time of the bidirectional predicted frame, and a display time of the decoded bidirectional predicted frame. The first determining unit is configured to obtain a first target time according to the display time of the decoded bidirectional predicted frame, the decoding time of the bidirectional predicted frame, and the preset cache time. The second determining unit is configured to traverse the cached data to determine a first target data frame that is different from the latest frame by the first target time; wherein, if the first target data frame is a key frame, the key frame is taken as a target key frame.

7. A computer device, characterized by The memory and the processor are communicatively connected, and the memory stores computer instructions. The processor executes the computer instructions to perform the data sending method in the weak network scenario according to any one of claims 1 to 4. The computer readable storage medium stores computer instructions. The computer instructions are used to make a computer execute the data sending method in the weak network scenario according to any one of claims 1 to 4.

8. A computer-readable storage medium, characterized in that, The computer instructions are used to make a computer execute the data sending method in the weak network scenario according to any one of claims 1 to 4.

9. A computer program product, characterised in that, ​

Citation Information

Patent Citations

  • Live data processing method and device, computer equipment, and storage medium

    CN108540819A

  • Method and apparatus for transmitting and receiving streaming data based on RTSP sessions

    EP2413564A1