Wireless screen projection method and system for adaptive dynamic decoding, storage medium and computer equipment
By adaptively adjusting the encoding parameters and the number of decoding threads, the problems of encoding data redundancy and decoding latency in wireless screen projection technology are solved, improving projection efficiency and quality, and adapting to changes in different scenarios and devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-03-13
AI Technical Summary
Existing wireless screen projection technologies have shortcomings in terms of encoding parameter adjustment and decoding thread number management, resulting in redundant encoded data, wasted bandwidth, decoding latency and stuttering, and an inability to adapt to changes in different scenarios and devices.
By adaptively adjusting the encoding parameters of the projection end and the number of decoding threads on the display end, and dynamically adjusting the encoding rules and the number of decoding threads according to the differences between screen frames, the encoding efficiency is optimized, resource waste is reduced, and decoding real-time performance and system adaptability are improved.
It optimizes encoding efficiency, saves bandwidth resources, ensures clear display, reduces lag, enhances system stability and reliability, and adapts to changes in different scenarios and devices.
Smart Images

Figure CN121665058A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of wireless screen projection technology, and in particular to an adaptive dynamic decoding wireless screen projection method, system, storage medium, and computer device. Background Technology
[0002] In today's era of rapid digital information development, wireless screen mirroring technology has been widely used in many fields such as office, education, and entertainment due to its convenience and flexibility. Wireless screen mirroring technology breaks free from the constraints of traditional wired connections, allowing users to easily project content from projection devices (such as computers and mobile phones) onto display devices (such as projectors and smart TVs), greatly improving the efficiency of information sharing and display.
[0003] Currently, existing wireless screen mirroring technologies mainly revolve around establishing a stable wireless connection, capturing and encoding screen frames from the projection end, and then transmitting them to the display end for decoding and display. In terms of screen frame processing, most technologies use fixed encoding parameters. While this method is simple to implement, it has significant drawbacks. Because the content of screen frames varies greatly in different scenarios—for example, when playing static documents, the changes between adjacent screen frames are minimal; however, when playing dynamic videos or performing game operations, adjacent screen frames can change significantly—fixed encoding parameters cannot flexibly adjust according to the actual changes in screen frames. When processing screen frames with minimal changes, this results in redundant encoded data, wasting transmission bandwidth; when processing screen frames with significant changes, inappropriate encoding parameters may lead to a decrease in encoding quality, affecting the display effect of the projected content.
[0004] In the decoding stage at the display end, existing technologies typically employ a fixed number of decoding threads to decode received data packets. However, the data in the display end buffer is dynamically changing. When the buffer data volume is large, a fixed number of decoding threads may not be able to process the data in time, leading to decoding delays and causing stuttering in the display of projected content. Conversely, when the buffer data volume is small, some decoding threads may be idle, resulting in a waste of system resources.
[0005] Therefore, existing wireless screen projection technologies are inadequate in terms of adjusting encoding parameters and dynamically managing the number of decoding threads. There is an urgent need for a wireless screen projection method that can adaptively and dynamically adjust encoding parameters and the number of decoding threads to improve the efficiency and quality of screen projection. Summary of the Invention
[0006] In view of this, embodiments of this application provide an adaptive dynamic decoding wireless screen projection method, system, storage medium, and computer device. By adaptively adjusting the encoding parameters, the encoding efficiency is optimized, bandwidth resources are saved, and different content is clearly displayed. Dynamically adjusting the number of decoding threads improves the real-time performance of decoding, reduces lag, and enhances the system's adaptability to different scenarios and devices, thereby improving the stability and reliability of the screen projection system.
[0007] According to one aspect of this application, a wireless screen projection method adapted to dynamic decoding is provided, the method comprising: Establish a wireless connection between the projection device and the display device; The projection device captures screen frames and calculates the inter-frame differences between adjacent screen frames, and adjusts the encoding parameters of the projection device according to the inter-frame differences. The screen frame is encoded into a data packet based on the encoding parameters, and the data packet is sent to the display end. The display device stores the data packets as buffered data in a buffer, and uses a decoding thread to decode the data packets in the buffer. Based on the decoding result, the screen projection content is displayed. The number of decoding threads is dynamically adjusted based on the data information in the buffer.
[0008] Optionally, adjusting the encoding parameters of the projection end according to the inter-frame differences includes: Based on the inter-frame difference and the preset inter-frame difference threshold, the screen frame is determined to be either a static frame or a dynamic frame. If the screen frame is a static frame, the encoding parameters of the projection end are adjusted based on the static frame encoding rules, wherein the static frame encoding rules include a first encoding frame rate and a first key frame ratio. If the screen frame is a dynamic frame, the encoding parameters of the projection end are adjusted based on the dynamic frame encoding rules. The dynamic frame encoding rules include at least one second encoding frame rate and at least one second key frame ratio. Each second encoding frame rate is greater than the first encoding frame rate, and each second key frame ratio is greater than the first key frame ratio.
[0009] Optionally, the encoding parameters of the projection end are adjusted based on the dynamic frame encoding rules, including: Based on the inter-frame difference and multiple inter-frame difference ranges in the dynamic frame encoding rules, the target inter-frame difference range to which the inter-frame difference belongs is determined, and the encoding parameters of the projection end are adjusted according to the second encoding frame rate and the second key frame ratio corresponding to the target inter-frame difference range. The second encoding frame rate and the second key frame ratio are positively correlated with the magnitude of the inter-frame difference.
[0010] Optionally, the data packet includes a frame type identifier, which is used to distinguish whether the data frame in the data packet is a normal frame or a key frame; the method further includes: The display end identifies the number of data frames in the buffer and identifies key frames based on the frame type identifier; A decoding thread is added when any of the following conditions are met: the CPU idle time is greater than a first idle threshold and the number of decoding threads is less than the maximum number of decoding threads: the number of data frames in the buffer is greater than a first number threshold; or a keyframe is added to the data frames in the buffer. The number of decoding threads is reduced when any of the following conditions are met: the number of data frames in the buffer is less than the second idle threshold and the number of decoding threads is not 1: the number of data frames in the buffer is less than the second number threshold; or keyframes are removed from the buffer.
[0011] Optionally, the method further includes: The display terminal obtains the delay information of the data packets, and periodically counts the delay information of the data packets displayed in the current time period to determine the delay of the current time period, and reports the delay of the current time period to the projection terminal. The projection terminal determines the encoding parameter compensation signal based on the current time period delay and the compensation signal calculation formula, wherein the compensation signal calculation formula is as follows: Let u(t) represent the compensation signal for the current time period t, and e(t) = r(t) - y(t), where r(t) represents the target period delay for the current time period t, and y(t) represents the current time period delay. The time period length is represented by Kp, Ki, and Kd, which represent the first, second, and third coefficients, respectively. The encoding parameters of the projection end are compensated based on the encoding parameter compensation signal. When the encoding parameter compensation signal is greater than 0, the encoding parameters are adjusted by at least one of reducing the encoding frame rate, reducing the encoding bit rate, and reducing the key frame ratio. When the encoding parameter compensation signal is less than 0, the encoding parameters are adjusted by at least one of increasing the encoding frame rate, increasing the encoding bit rate, and increasing the key frame ratio.
[0012] Optionally, the method further includes: The display terminal monitors network latency in real time. If the network latency is greater than the first latency threshold, the buffer is expanded based on the network latency and the preset maximum buffer threshold. If the network latency is less than the second latency threshold, the buffer is reduced in size based on the network latency and the preset minimum buffer threshold.
[0013] Optionally, after establishing a wireless connection between the projection device and the display device, the method further includes: The projection terminal obtains the device parameters of the display terminal, determines the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate of the projection terminal based on the device parameters of the display terminal, and initializes the encoding parameters based on the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate.
[0014] According to another aspect of this application, an adaptive dynamic decoding wireless projection system is provided, the system comprising: The transmission protocol module is used to establish a wireless connection between the projection terminal and the display terminal; The transmitting end encoding module is used to collect screen frames at the projection end, calculate the inter-frame difference between adjacent screen frames, adjust the encoding parameters of the projection end according to the inter-frame difference, encode the screen frame into a data packet based on the encoding parameters, and send the data packet to the display end. The receiving end decoding module is used by the display end to store the data packet as buffered data in a buffer, and to use decoding threads to decode the data packet in the buffer, and to display the screen projection content based on the decoding result. The number of decoding threads is dynamically adjusted based on the data information in the buffer.
[0015] Optionally, the transmitting end encoding module is specifically used for: Based on the inter-frame difference and the preset inter-frame difference threshold, the screen frame is determined to be either a static frame or a dynamic frame. If the screen frame is a static frame, the encoding parameters of the projection end are adjusted based on the static frame encoding rules, wherein the static frame encoding rules include a first encoding frame rate and a first key frame ratio. If the screen frame is a dynamic frame, the encoding parameters of the projection end are adjusted based on the dynamic frame encoding rules. The dynamic frame encoding rules include at least one second encoding frame rate and at least one second key frame ratio. Each second encoding frame rate is greater than the first encoding frame rate, and each second key frame ratio is greater than the first key frame ratio.
[0016] Optionally, the transmitting end encoding module is specifically used for: Based on the inter-frame difference and multiple inter-frame difference ranges in the dynamic frame encoding rules, the target inter-frame difference range to which the inter-frame difference belongs is determined, and the encoding parameters of the projection end are adjusted according to the second encoding frame rate and the second key frame ratio corresponding to the target inter-frame difference range. The second encoding frame rate and the second key frame ratio are positively correlated with the magnitude of the inter-frame difference.
[0017] Optionally, the data packet includes a frame type identifier, which is used to distinguish whether the data frames in the data packet are ordinary frames or keyframes; the receiving end decoding module is further used to: The display end identifies the number of data frames in the buffer and identifies key frames based on the frame type identifier; A decoding thread is added when any of the following conditions are met: the CPU idle time is greater than a first idle threshold and the number of decoding threads is less than the maximum number of decoding threads: the number of data frames in the buffer is greater than a first number threshold; or a keyframe is added to the data frames in the buffer. The number of decoding threads is reduced when any of the following conditions are met: the number of data frames in the buffer is less than the second idle threshold and the number of decoding threads is not 1: the number of data frames in the buffer is less than the second number threshold; or keyframes are removed from the buffer.
[0018] Optionally, the receiving end decoding module is further configured to: obtain the delay information of the data packet at the display end, periodically count the delay information of the data packet displayed in the current time period, determine the delay of the current time period, and report the delay of the current time period to the projection end; The transmitting end encoding module is further configured to: determine the encoding parameter compensation signal based on the current time period delay and the compensation signal calculation formula at the projection end, wherein the compensation signal calculation formula is as follows: Let u(t) represent the compensation signal for the current time period t, and e(t) = r(t) - y(t), where r(t) represents the target period delay for the current time period t, and y(t) represents the current time period delay. The time period length is represented by Kp, Ki, and Kd, which represent the first, second, and third coefficients, respectively. The encoding parameters of the projection end are compensated based on the encoding parameter compensation signal. When the encoding parameter compensation signal is greater than 0, the encoding parameters are adjusted by at least one of reducing the encoding frame rate, reducing the encoding bit rate, and reducing the key frame ratio. When the encoding parameter compensation signal is less than 0, the encoding parameters are adjusted by at least one of increasing the encoding frame rate, increasing the encoding bit rate, and increasing the key frame ratio.
[0019] Optionally, the receiving end decoding module is further configured to: The display terminal monitors network latency in real time. If the network latency is greater than the first latency threshold, the buffer is expanded based on the network latency and the preset maximum buffer threshold. If the network latency is less than the second latency threshold, the buffer is reduced in size based on the network latency and the preset minimum buffer threshold.
[0020] Optionally, the transmitting end encoding module is further configured to: The projection terminal obtains the device parameters of the display terminal, determines the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate of the projection terminal based on the device parameters of the display terminal, and initializes the encoding parameters based on the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate.
[0021] According to another aspect of this application, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the above-described adaptive dynamic decoding wireless screen projection method.
[0022] According to another aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described adaptive dynamic decoding wireless screen projection method.
[0023] By employing the above technical solutions, this application provides an adaptive dynamic decoding wireless screen projection method, system, storage medium, and computer device. First, a wireless connection is established between the projection end and the display end. The projection end collects screen frames and dynamically adjusts encoding parameters based on the differences between adjacent frames. After encoding, it sends data packets to the display end. The display end stores the data packets in a buffer and dynamically adjusts the number of decoding threads based on the buffer data information to decode and display the content. This application optimizes encoding efficiency and saves bandwidth resources by adaptively adjusting encoding parameters, ensuring clear display of different content. Dynamically adjusting the number of decoding threads improves decoding real-time performance, reduces lag, and enhances the system's adaptability to different scenarios and devices, thereby improving the stability and reliability of the screen projection system.
[0024] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0025] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating an adaptive dynamic decoding wireless screen projection method provided in an embodiment of this application is shown. Figure 2 A schematic diagram of the structure of an adaptive dynamic decoding wireless projection system provided in an embodiment of this application is shown. Detailed Implementation
[0026] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0027] This embodiment provides an adaptive dynamic decoding wireless screen projection method, such as... Figure 1 As shown, the method includes: Step 101: Establish a wireless connection between the projection device and the display device.
[0028] This application provides an adaptive dynamic decoding wireless screen projection method, which aims to achieve adaptive dynamic adjustment of encoding parameters and the number of decoding threads during the screen projection process, so as to improve the efficiency and quality of wireless screen projection. The specific steps are as follows: First, a stable connection channel is established between the projection end (such as mobile phone, computer, etc.) and the display end (such as projector, smart TV, etc.) through wireless communication technology (such as Wi-Fi, Bluetooth, etc.) to prepare for subsequent data transmission.
[0029] Step 102: The projection terminal collects screen frames and calculates the inter-frame differences between adjacent screen frames, and adjusts the encoding parameters of the projection terminal according to the inter-frame differences.
[0030] Secondly, the projection device continuously captures its own screen frames, which contain all the content information currently displayed. It calculates the inter-frame differences between adjacent screen frames, reflecting the degree of change in screen content. For example, when playing static images, the differences between adjacent frames are minimal; however, when playing dynamic videos or performing rapid operations, the differences are significant. Based on the calculated inter-frame differences, the projection device's encoding parameters are dynamically adjusted. For instance, when the inter-frame differences are small, the encoding parameters are appropriately reduced to decrease the amount of encoded data, saving transmission bandwidth; when the inter-frame differences are large, the encoding parameters are increased to ensure encoding quality, enabling the display device to clearly and accurately display the content. By calculating the inter-frame differences between adjacent screen frames and dynamically adjusting the encoding parameters, the appropriate encoding method can be flexibly selected according to changes in screen content. When processing screen frames with minimal changes, reducing the encoding parameters decreases the amount of data, effectively saving wireless transmission bandwidth and improving bandwidth utilization; when processing screen frames with significant changes, increasing the encoding parameters ensures encoding quality, ensuring the display device can clearly display the content, thus improving the visual effect of the projection.
[0031] Step 103: Encode the screen frame into a data packet based on the encoding parameters, and send the data packet to the display end.
[0032] Next, based on the adjusted encoding parameters, the captured screen frames are encoded into data packets. The encoding process involves compressing and converting the digital information of the screen frames according to specific encoding rules for more efficient transmission over the wireless channel. After encoding, the generated data packets are sent to the display device via the established wireless connection.
[0033] Step 104: The display end stores the data packet as buffered data in the buffer, and uses the decoding thread to decode the data packet in the buffer. Based on the decoding result, the screen projection content is displayed. The number of decoding threads is dynamically adjusted based on the data information in the buffer.
[0034] After receiving a data packet, the display terminal stores it as buffered data in a buffer. The buffer acts as a data cache, balancing differences in data transmission and processing rates and preventing problems caused by unstable data transmission or inconsistent processing speeds. Decoding threads are then used to decode the data packets in the buffer. Decoding is the reverse process of encoding, restoring the compressed and encoded data packets back to the original screen frame information. Furthermore, in this embodiment, the number of decoding threads is not fixed but dynamically adjusted based on the data information in the buffer (such as data size and data arrival rate). For example, when the buffer data volume is large or the data arrival rate is fast, the number of decoding threads is increased to speed up decoding and prevent data backlog leading to display stuttering; when the buffer data volume is small or the data arrival rate is slow, the number of decoding threads is reduced to avoid wasting system resources. Finally, the content to be projected is displayed based on the decoding results, presenting the restored screen frame information on the display terminal's screen. This optimizes encoding efficiency and saves bandwidth resources; improves decoding real-time performance and reduces stuttering; the display terminal dynamically adjusts the number of decoding threads based on the buffer data information, better adapting to changes in data transmission and processing. When dealing with large amounts of data, increasing the number of decoding threads can speed up decoding, process data in the buffer promptly, and prevent display stuttering caused by data backlog. When dealing with small amounts of data, reducing the number of decoding threads can avoid wasting system resources and improve the overall system efficiency. This dynamic adjustment mechanism makes the decoding process more real-time and smooth, providing users with a better screen mirroring experience.
[0035] By applying the technical solution of this embodiment, a wireless connection is first established between the projection end and the display end. The projection end collects screen frames and dynamically adjusts the encoding parameters according to the differences between adjacent frames. After encoding, it sends data packets to the display end. The display end stores the data packets in a buffer and dynamically adjusts the number of decoding threads according to the buffer data information to decode and display the content. This embodiment optimizes encoding efficiency and saves bandwidth resources by adaptively adjusting the encoding parameters, ensuring clear display of different content. Dynamically adjusting the number of decoding threads improves decoding real-time performance, reduces lag, and enhances the system's adaptability to different scenarios and devices, thereby improving the stability and reliability of the projection system.
[0036] In this embodiment of the application, optionally, adjusting the encoding parameters of the projection terminal according to the inter-frame difference includes: determining whether the screen frame belongs to a static frame or a dynamic frame based on the inter-frame difference and a preset inter-frame difference threshold; if the screen frame belongs to a static frame, adjusting the encoding parameters of the projection terminal based on static frame encoding rules, wherein the static frame encoding rules include a first encoding frame rate and a first keyframe ratio; if the screen frame belongs to a dynamic frame, adjusting the encoding parameters of the projection terminal based on dynamic frame encoding rules, wherein the dynamic frame encoding rules include at least one second encoding frame rate and at least one second keyframe ratio, each second encoding frame rate being greater than the first encoding frame rate, and each second keyframe ratio being greater than the first keyframe ratio.
[0037] In this embodiment, the calculated inter-frame difference is first compared with a preset inter-frame difference threshold. This preset threshold serves as a dividing line; by comparing the actual calculated inter-frame difference with it, the system determines whether a screen frame is a static or dynamic frame. For example, when wirelessly projecting a static document using a mobile phone, the changes between adjacent screen frames are minimal, and the calculated inter-frame difference will be much smaller than the preset threshold. In this case, the system will determine that the screen frame is a static frame. Once determined to be a static frame, the encoding parameters are adjusted according to static frame encoding rules. Static frame encoding rules include a specific first encoding frame rate and a first keyframe ratio. The first encoding frame rate is relatively low, for example, set to 5 frames per second, and the first keyframe ratio is also small, for example, keyframes account for 10% of the total encoded frames. By using such parameter settings, the amount of encoded data can be significantly reduced while ensuring clear display of static content. Because static content does not require frequent screen updates, a lower encoding frame rate and keyframe ratio can effectively save the bandwidth required for wireless transmission, avoid unnecessary resource waste, and make data transmission more efficient. For example, when wirelessly projecting a computer screen to play an action movie or an intense game, the screen changes rapidly, and the differences between adjacent frames are significant. The calculated inter-frame difference will far exceed the preset inter-frame difference threshold, and the system will then classify the frame as a dynamic frame. For dynamic frames, the encoding parameters are adjusted according to dynamic frame encoding rules. Dynamic frame encoding rules have at least one second encoding frame rate and at least one second keyframe ratio, and each second encoding frame rate is higher than the first encoding frame rate, and each second keyframe ratio is larger than the first keyframe ratio. For example, the second encoding frame rate might be set to 30 frames per second or even higher, and the second keyframe ratio to 30% or even higher. A higher encoding frame rate ensures smooth playback even during rapid changes, preventing stuttering; a higher keyframe ratio provides clearer and more complete image information when key scenes appear, ensuring the clarity and quality of dynamic images.
[0038] In this embodiment of the application, optionally, the encoding parameters of the projection terminal are adjusted based on the dynamic frame encoding rules, including: determining the target inter-frame difference range to which the inter-frame difference belongs based on the inter-frame difference and multiple inter-frame difference ranges in the dynamic frame encoding rules, and adjusting the encoding parameters of the projection terminal according to the second encoding frame rate and the second key frame ratio corresponding to the target inter-frame difference range, wherein the second encoding frame rate and the second key frame ratio are positively correlated with the magnitude of the inter-frame difference.
[0039] In this embodiment, the dynamic frame encoding rule can adapt the encoding parameters through multi-level inter-frame difference ranges. Specifically, the calculated inter-frame difference is first matched with multiple preset dynamic inter-frame difference ranges, each range corresponding to a specific combination of second encoding frame rate and second keyframe ratio. For example, suppose the dynamic frame encoding rule sets three difference ranges: low difference range (inter-frame difference ≤ 20%), medium difference range (20% < inter-frame difference ≤ 50%), and high difference range (inter-frame difference > 50%). When playing a slightly dynamic PPT animation, the inter-frame difference may fall into the low difference range. In this case, a lower second encoding frame rate (e.g., 20 frames / second) and a medium second keyframe ratio (e.g., 25%) are selected to ensure smoothness while avoiding excessive bandwidth consumption. However, when playing a live broadcast of a fast-moving sports event, the inter-frame difference may enter the high difference range. In this case, the system automatically switches to a higher second encoding frame rate (e.g., 60 frames / second) and a larger second keyframe ratio (e.g., 40%) to ensure that the details of fast-moving images are clear and free of ghosting. This multi-level parameter adjustment mechanism based on the difference range avoids bandwidth waste in static scenes and solves the problem of image quality loss in high dynamic scenes. It achieves the matching of encoding parameters with the dynamic characteristics of the screen, and ultimately maximizes transmission efficiency and resource utilization while ensuring the quality of screen projection.
[0040] Optionally, in this embodiment, the data packet includes a frame type identifier, which is used to distinguish whether the data frame in the data packet is a normal frame or a key frame; the method further includes: the display end identifies the number of data frames in the buffer and identifies key frames based on the frame type identifier; adding decoding threads when any of the following conditions are met, and the CPU idle time is greater than a first idle threshold and the number of decoding threads is less than the maximum number of decoding threads: the number of data frames in the buffer is greater than the first number threshold; key frames have been added to the data frames in the buffer; reducing decoding threads when any of the following conditions are met, and the CPU idle time is less than a second idle threshold and the number of decoding threads is not 1: the number of data frames in the buffer is less than the second number threshold; key frames have been removed from the buffer.
[0041] In this embodiment, the frame type identifier embedded in the data packet clearly distinguishes between ordinary frames and keyframes, enabling the display to accurately identify the addition or removal of keyframes. The dynamic adjustment of decoding threads follows a two-dimensional triggering logic. Expansion condition: When the number of data frames in the buffer exceeds a first threshold or a new keyframe is detected, if the CPU idle rate is higher than a preset threshold and the current number of threads has not reached its limit, decoding threads are automatically increased to ensure timely processing of high-load scenarios (such as fast-moving scenes). Reduction condition: When the number of data frames falls below a second threshold or a keyframe is removed, if the CPU idle rate is lower than the threshold and the number of threads is greater than 1, the system reduces the number of threads to avoid resource waste. Through the linkage between keyframe identifiers and buffer status, "on-demand allocation" of decoding threads is achieved. For example, when playing high-definition videos, the dense appearance of keyframes triggers thread expansion to ensure smooth decoding of high frame rate scenes; while when projecting static documents, the number of threads is automatically reduced to lower CPU usage. The coordinated control of the first / second threshold and the CPU idle threshold avoids both system resource contention caused by too many threads and decoding delays caused by insufficient threads. During live sports broadcasts, sudden bursts of high-dynamic-range frames quickly fill the buffer and trigger thread increases to ensure a smooth, ghosting-free viewing experience; while during idle periods, thread reduction saves energy. This mechanism automatically adapts to diverse projection scenarios, from static documents to high-speed dynamic videos, achieving an optimal balance between image quality, smoothness, and resource efficiency without manual intervention, significantly improving user experience and system stability.
[0042] Optionally, in this embodiment of the application, the method further includes: The display terminal obtains the delay information of the data packets, and periodically counts the delay information of the data packets displayed in the current time period to determine the delay of the current time period, and reports the delay of the current time period to the projection terminal. The projection terminal determines the encoding parameter compensation signal based on the current time period delay and the compensation signal calculation formula, wherein the compensation signal calculation formula is as follows: Let u(t) represent the compensation signal for the current time period t, and e(t) = r(t) - y(t), where r(t) represents the target period delay for the current time period t, and y(t) represents the current time period delay. The time period length is represented by Kp, Ki, and Kd, which represent the first, second, and third coefficients, respectively. The encoding parameters of the projection end are compensated based on the encoding parameter compensation signal. When the encoding parameter compensation signal is greater than 0, the encoding parameters are adjusted by at least one of reducing the encoding frame rate, reducing the encoding bit rate, and reducing the key frame ratio. When the encoding parameter compensation signal is less than 0, the encoding parameters are adjusted by at least one of increasing the encoding frame rate, increasing the encoding bit rate, and increasing the key frame ratio.
[0043] In this embodiment, the display terminal first acquires the data packet delay information and periodically counts the delay of the displayed data packets within the current time period to determine the delay value for the current time period. Then, it reports this delay information to the projection terminal. The projection terminal calculates the delay based on the current time period delay and the compensation signal using the formula u(t)=Kp. e(t)+Ki e(t)Δt+Kd The encoding parameter compensation signal is calculated using e(t) / dt. Where e(t) = r(t) y(t) and r(t) are the target period delay of the current time period t, y(t) is the current time period delay, Δt is the time period length, and Kp, Ki, and Kd are the first, second, and third coefficients, respectively. Finally, the projection end adjusts the encoding parameters according to the calculated compensation signal: if the compensation signal is greater than 0, it adjusts by reducing the encoding frame rate, reducing the encoding bit rate, or reducing the keyframe ratio; if the compensation signal is less than 0, it adjusts by increasing the encoding frame rate, increasing the encoding bit rate, or increasing the keyframe ratio. Through the display end's statistics and reporting of data packet delay information, and the projection end's dynamic adjustment of encoding parameters based on the compensation signal calculation formula, accurate response and adaptive optimization of network latency during wireless projection are achieved. It can adjust encoding parameters in a timely manner according to the actual latency, reasonably reducing encoding requirements to ensure data transmission stability when the latency is large, and improving encoding quality to enhance the display effect of the projected image when the latency is small, effectively balancing transmission efficiency and image quality, and improving the overall performance and user experience of wireless projection.
[0044] Optionally, in this embodiment of the application, the method further includes: real-time detection of network latency at the display end; if the network latency is greater than a first latency threshold, expanding the buffer based on the network latency and a preset maximum buffer threshold; if the network latency is less than a second latency threshold, shrinking the buffer based on the network latency and a preset minimum buffer threshold.
[0045] In this embodiment, the buffer can also be dynamically adjusted. Specifically, the display device continuously monitors network latency in real time. When the detected network latency exceeds a preset first latency threshold, the display device expands the buffer based on the current network latency value and a preset maximum buffer threshold. This means that when network conditions are poor and latency is high, increasing the buffer size provides more space for data packet storage and buffering, addressing potential data backlog and preventing data loss or display stuttering. Conversely, when the network latency is less than a second latency threshold, the display device shrinks the buffer based on the network latency and a preset minimum buffer threshold, reducing the buffer's space usage and freeing up system resources. By monitoring network latency in real time and dynamically adjusting the buffer size, the wireless projection system can better adapt to different network environments. When network latency is high, expanding the buffer effectively buffers data, ensuring data integrity and continuity, reducing projection stuttering or screen flickering caused by network fluctuations, and improving projection stability. Conversely, when network latency is low, shrinking the buffer reasonably releases system resources, improves resource utilization efficiency, avoids resource waste, and makes the system operate more efficiently. Overall, this dynamic adjustment mechanism enhances the wireless screen projection system's adaptability to network changes and optimizes projection effects and system performance.
[0046] Optionally, after establishing a wireless connection between the projection terminal and the display terminal, the method further includes: the projection terminal obtaining device parameters of the display terminal, determining the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate of the projection terminal based on the device parameters of the display terminal, and initializing encoding parameters based on the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate.
[0047] In this embodiment, after successfully establishing a wireless connection between the projection device and the display device, an encoding parameter initialization operation is further performed. Specifically, the projection device actively acquires relevant device parameters from the display device. These parameters may include information such as the display device's resolution, screen size, and hardware performance. Based on the acquired display device parameters, the projection device performs comprehensive analysis to determine the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate. Subsequently, the projection device initializes the encoding parameters based on these three initial parameters, preparing for subsequent screen frame encoding. By acquiring the display device parameters to determine and initialize the encoding parameters, the projection device's encoding settings can be more closely aligned with the actual capabilities and needs of the display device. For example, if the display device has a high resolution, the projection device can set a higher initial encoding bitrate and a suitable initial encoding frame rate to ensure that the projected content is presented clearly and smoothly on the display device; if the display device's hardware performance is limited, the projection device can reasonably adjust parameters such as the initial keyframe ratio to avoid decoding difficulties on the display device due to excessively high encoding parameters. This method of initializing encoding parameters based on the characteristics of the display device effectively improves the compatibility and adaptability of wireless screen projection, laying a solid foundation for high-quality and stable screen projection display in the future, and optimizing the user's screen projection experience.
[0048] Furthermore, as Figure 1 In terms of specific implementation, this application provides an adaptive dynamic decoding wireless screen projection system, such as... Figure 2 As shown, the system includes: The transmission protocol module is used to establish a wireless connection between the projection terminal and the display terminal; The transmitting end encoding module is used to collect screen frames at the projection end, calculate the inter-frame difference between adjacent screen frames, adjust the encoding parameters of the projection end according to the inter-frame difference, encode the screen frame into a data packet based on the encoding parameters, and send the data packet to the display end. The receiving end decoding module is used by the display end to store the data packet as buffered data in a buffer, and to use decoding threads to decode the data packet in the buffer, and to display the screen projection content based on the decoding result. The number of decoding threads is dynamically adjusted based on the data information in the buffer.
[0049] Optionally, the transmitting end encoding module is specifically used for: Based on the inter-frame difference and the preset inter-frame difference threshold, the screen frame is determined to be either a static frame or a dynamic frame. If the screen frame is a static frame, the encoding parameters of the projection end are adjusted based on the static frame encoding rules, wherein the static frame encoding rules include a first encoding frame rate and a first key frame ratio. If the screen frame is a dynamic frame, the encoding parameters of the projection end are adjusted based on the dynamic frame encoding rules. The dynamic frame encoding rules include at least one second encoding frame rate and at least one second key frame ratio. Each second encoding frame rate is greater than the first encoding frame rate, and each second key frame ratio is greater than the first key frame ratio.
[0050] Optionally, the transmitting end encoding module is specifically used for: Based on the inter-frame difference and multiple inter-frame difference ranges in the dynamic frame encoding rules, the target inter-frame difference range to which the inter-frame difference belongs is determined, and the encoding parameters of the projection end are adjusted according to the second encoding frame rate and the second key frame ratio corresponding to the target inter-frame difference range. The second encoding frame rate and the second key frame ratio are positively correlated with the magnitude of the inter-frame difference.
[0051] Optionally, the data packet includes a frame type identifier, which is used to distinguish whether the data frames in the data packet are ordinary frames or keyframes; the receiving end decoding module is further used to: The display end identifies the number of data frames in the buffer and identifies key frames based on the frame type identifier; A decoding thread is added when any of the following conditions are met: the CPU idle time is greater than a first idle threshold and the number of decoding threads is less than the maximum number of decoding threads: the number of data frames in the buffer is greater than a first number threshold; or a keyframe is added to the data frames in the buffer. The number of decoding threads is reduced when any of the following conditions are met: the number of data frames in the buffer is less than the second idle threshold and the number of decoding threads is not 1: the number of data frames in the buffer is less than the second number threshold; or keyframes are removed from the buffer.
[0052] Optionally, the receiving end decoding module is further configured to: obtain the delay information of the data packet at the display end, periodically count the delay information of the data packet displayed in the current time period, determine the delay of the current time period, and report the delay of the current time period to the projection end; The transmitting end encoding module is further configured to: determine the encoding parameter compensation signal based on the current time period delay and the compensation signal calculation formula at the projection end, wherein the compensation signal calculation formula is as follows: Let u(t) represent the compensation signal for the current time period t, and e(t) = r(t) - y(t), where r(t) represents the target period delay for the current time period t, and y(t) represents the current time period delay. The time period length is represented by Kp, Ki, and Kd, which represent the first, second, and third coefficients, respectively. The encoding parameters of the projection end are compensated based on the encoding parameter compensation signal. When the encoding parameter compensation signal is greater than 0, the encoding parameters are adjusted by at least one of reducing the encoding frame rate, reducing the encoding bit rate, and reducing the key frame ratio. When the encoding parameter compensation signal is less than 0, the encoding parameters are adjusted by at least one of increasing the encoding frame rate, increasing the encoding bit rate, and increasing the key frame ratio.
[0053] Optionally, the receiving end decoding module is further configured to: The display terminal monitors network latency in real time. If the network latency is greater than the first latency threshold, the buffer is expanded based on the network latency and the preset maximum buffer threshold. If the network latency is less than the second latency threshold, the buffer is reduced in size based on the network latency and the preset minimum buffer threshold.
[0054] Optionally, the transmitting end encoding module is further configured to: The projection terminal obtains the device parameters of the display terminal, determines the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate of the projection terminal based on the device parameters of the display terminal, and initializes the encoding parameters based on the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate.
[0055] It should be noted that other corresponding descriptions of the functional units involved in the adaptive dynamic decoding wireless projection system provided in this application embodiment can be found in the following references. Figure 1 The corresponding descriptions in the method will not be repeated here.
[0056] This application also provides a computer device, specifically a personal computer, server, network device, etc. The computer device includes a bus, processor, memory, and communication interface, and may also include input / output interfaces and a display device. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores location information. The network interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.
[0057] Those skilled in the art will understand that the structure of the computer device described above is only a partial structure related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. A specific computer device may include more or fewer components, or combine certain components, or have different component arrangements.
[0058] In one embodiment, a computer-readable storage medium is provided, which may be non-volatile or volatile, having stored thereon a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0059] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0060] It should be noted that the user personal information involved in the embodiments of this application is all authorized (with the knowledge and consent) by the relevant parties or fully authorized by all parties, and the executing entity can obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with the relevant laws and regulations of the relevant countries and regions, and do not violate public order and good morals. It should be noted that if any software tools or components other than those of this company appear in the embodiments of this application, they are merely illustrative examples and do not represent actual use.
[0061] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0062] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0063] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A wireless screen projection method with adaptive dynamic decoding, characterized in that, The method includes: Establish a wireless connection between the projection device and the display device; The projection device captures screen frames and calculates the inter-frame differences between adjacent screen frames, and adjusts the encoding parameters of the projection device according to the inter-frame differences. The screen frame is encoded into a data packet based on the encoding parameters, and the data packet is sent to the display end. The display device stores the data packets as buffered data in a buffer, and uses a decoding thread to decode the data packets in the buffer. Based on the decoding result, the screen projection content is displayed. The number of decoding threads is dynamically adjusted based on the data information in the buffer.
2. The method according to claim 1, characterized in that, Adjusting the encoding parameters of the projection terminal based on the inter-frame differences includes: Based on the inter-frame difference and the preset inter-frame difference threshold, the screen frame is determined to be either a static frame or a dynamic frame. If the screen frame is a static frame, the encoding parameters of the projection end are adjusted based on the static frame encoding rules, wherein the static frame encoding rules include a first encoding frame rate and a first key frame ratio. If the screen frame is a dynamic frame, the encoding parameters of the projection end are adjusted based on the dynamic frame encoding rules. The dynamic frame encoding rules include at least one second encoding frame rate and at least one second key frame ratio. Each second encoding frame rate is greater than the first encoding frame rate, and each second key frame ratio is greater than the first key frame ratio.
3. The method according to claim 2, characterized in that, The encoding parameters of the projection terminal are adjusted based on the dynamic frame encoding rules, including: Based on the inter-frame difference and multiple inter-frame difference ranges in the dynamic frame encoding rules, the target inter-frame difference range to which the inter-frame difference belongs is determined, and the encoding parameters of the projection end are adjusted according to the second encoding frame rate and the second key frame ratio corresponding to the target inter-frame difference range. The second encoding frame rate and the second key frame ratio are positively correlated with the magnitude of the inter-frame difference.
4. The method according to any one of claims 1 to 3, characterized in that, The data packet includes a frame type identifier, which is used to distinguish whether the data frame in the data packet is a normal frame or a key frame; the method further includes: The display end identifies the number of data frames in the buffer and identifies key frames based on the frame type identifier; A decoding thread is added when any of the following conditions are met: the CPU idle time is greater than a first idle threshold and the number of decoding threads is less than the maximum number of decoding threads: the number of data frames in the buffer is greater than a first number threshold; or a keyframe is added to the data frames in the buffer. The number of decoding threads is reduced when any of the following conditions are met: the number of data frames in the buffer is less than the second idle threshold and the number of decoding threads is not 1: the number of data frames in the buffer is less than the second number threshold; or keyframes are removed from the buffer.
5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The display terminal obtains the delay information of the data packets, and periodically counts the delay information of the data packets displayed in the current time period to determine the delay of the current time period, and reports the delay of the current time period to the projection terminal. The projection terminal determines the encoding parameter compensation signal based on the current time period delay and the compensation signal calculation formula, wherein the compensation signal calculation formula is as follows: Let u(t) represent the compensation signal for the current time period t, and e(t) = r(t) - y(t), where r(t) represents the target period delay for the current time period t, and y(t) represents the current time period delay. The time period length is represented by Kp, Ki, and Kd, which represent the first, second, and third coefficients, respectively. The encoding parameters of the projection end are compensated based on the encoding parameter compensation signal. When the encoding parameter compensation signal is greater than 0, the encoding parameters are adjusted by at least one of reducing the encoding frame rate, reducing the encoding bit rate, and reducing the key frame ratio. When the encoding parameter compensation signal is less than 0, the encoding parameters are adjusted by at least one of increasing the encoding frame rate, increasing the encoding bit rate, and increasing the key frame ratio.
6. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The display terminal monitors network latency in real time. If the network latency is greater than the first latency threshold, the buffer is expanded based on the network latency and the preset maximum buffer threshold. If the network latency is less than the second latency threshold, the buffer is reduced in size based on the network latency and the preset minimum buffer threshold.
7. The method according to any one of claims 1 to 3, characterized in that, After establishing a wireless connection between the projection device and the display device, the method further includes: The projection terminal obtains the device parameters of the display terminal, determines the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate of the projection terminal based on the device parameters of the display terminal, and initializes the encoding parameters based on the initial encoding frame rate, initial keyframe ratio, and initial encoding bitrate.
8. A wireless projection system with adaptive dynamic decoding, characterized in that, The system includes: The transmission protocol module is used to establish a wireless connection between the projection terminal and the display terminal; The transmitting end encoding module is used to collect screen frames at the projection end, calculate the inter-frame difference between adjacent screen frames, adjust the encoding parameters of the projection end according to the inter-frame difference, encode the screen frame into a data packet based on the encoding parameters, and send the data packet to the display end. The receiving end decoding module is used by the display end to store the data packet as buffered data in a buffer, and to use decoding threads to decode the data packet in the buffer, and to display the screen projection content based on the decoding result. The number of decoding threads is dynamically adjusted based on the data information in the buffer.
9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.
10. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.