Method and device for adjusting screen refresh rate and terminal equipment
By identifying the number and parameters of drawing controls for videos and bullet comments, and adjusting the screen refresh rate, the problem of the inability to recognize bullet comments in existing technologies has been solved, achieving a balance between power consumption and performance, and improving the user experience.
Patent Information
- Application Number
- CN202310814803.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-04
- Publication Date
- 2025-01-07
AI Technical Summary
Existing technologies cannot effectively identify the presence of bullet comments, leading to increased power consumption when electronic devices display videos at high refresh rates. Furthermore, they cannot adaptively adjust the refresh rate based on the presence or absence of bullet comments to balance power consumption and performance.
By recognizing the number of drawing controls and drawing command parameters of the video and bullet comments, it can determine whether there are bullet comments in the current display interface, and adjust the screen refresh rate according to the recognition results.
It enables dynamic adjustment of the screen refresh rate based on the presence or absence of bullet comments, thereby reducing power consumption, avoiding lag, and improving user experience.
Smart Images

Figure CN119277143A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a method, device and terminal equipment for adjusting screen refresh rate. Background Art
[0002] Nowadays, many online video playback platforms have a barrage function, which supports users to edit and send their comments on the currently playing video, i.e., barrage, while watching the video. Users watching the video can see the barrage sent by other users accordingly. In order to meet users' higher requirements for viewing experience, current electronic devices (mobile phones, tablets, etc.) generally support high refresh rates of 120Hz or 90Hz, but the frame rate of most video resources themselves cannot reach 120 frames or 90 frames. At this time, it is unnecessary to use a high refresh rate. While the high refresh rate brings users a smoother experience, it will also increase power consumption. In order to balance power consumption and performance, it can be determined whether to use a high refresh rate by identifying whether there is a barrage above the video when it is playing. When there is a barrage, a high refresh rate is used, and when there is no barrage, the refresh rate is reduced. Therefore, how electronic devices identify whether there is a barrage on the video display interface has become an urgent problem to be solved. Summary of the invention
[0003] The present application provides a method, apparatus and terminal device for adjusting the screen refresh rate, which can be used to determine whether barrage appears during video playback. The system evaluates whether to adjust the refresh rate of the electronic device (mobile phone, tablet, etc.) based on the judgment result to achieve a balance between user experience and power consumption.
[0004] In a first aspect, after starting the first video application, the first video is played; the bullet screen control of the first video application is set to be closed;
[0005] Obtain a first frame of data of the first video, count the first frame of data when the number of drawing controls in the first frame of data is less than a first preset value, and refresh the screen of the electronic device according to a first refresh rate when the count value of the first frame of data reaches a second preset value; after refreshing at the first refresh rate, receive a first operation of the user applied to the first video, the first operation is used to turn on the barrage control, obtain a second frame of data of the first video, count the second frame of data when the number of drawing controls in the second frame of data is equal to the first preset value, and refresh the screen according to a second refresh rate when the count value of the second frame of data reaches a third preset value; the second refresh rate is greater than the first refresh rate.
[0006] By adopting the above technical solution, when the electronic device displays the video played by the application, it can identify whether there is a bullet screen in the display interface, and the electronic device can adjust the refresh rate of the screen according to the identification result.
[0007] In a possible implementation, the parameter information of the drawing controls is the number of the drawing controls; and the screen refresh rate is adjusted according to the number of the drawing controls in the current frame.
[0008] Among them, the drawing controls of the video and the drawing controls of the bullet screen are both drawing controls of the TextureView type; whether the bullet screen is included in the current display interface is determined according to the number of TextureView drawing controls in the current frame.
[0009] Among them, when the number of TextureView drawing controls is 2, there is a TextureView drawing control for a video and a TextureView drawing control for a bullet comment in the current frame, and the bullet comment exists in the current frame.
[0010] Since there are many animation, motion effect and other controls in the video content, in order to ensure the accuracy of recognition, one judgment logic is whether there are 2 TextureView drawing controls in a certain number of frames within a certain frame range; if there are 2 TextureView drawing controls in a certain number of frames within a certain frame range, then the recognition result of "there is barrage" is obtained, and the recognition result is sent to the layer rendering and synthesis service; if there is not 2 TextureView drawing controls in a certain number of frames within a certain frame range, then only when there is no TextureView drawing control of 2 in a certain number of frames in a row, the recognition result of "no barrage" is sent to the layer rendering and synthesis service.
[0011] Optionally, the recognition result of "there is a bullet comment" is obtained only when the number of TextureView drawing controls in 8 frames out of 40 frames is 2.
[0012] Optionally, only when the number of TextureView drawing controls that does not exist is 2 in 200 consecutive frames, the recognition result of "no bullet screen" is sent to the layer rendering synthesis service.
[0013] Optionally, the recognition result of "there is a bullet comment" is obtained only when the number of TextureView drawing controls that appear in 4 frames in two consecutive 20 frames is 2.
[0014] In another possible implementation, the parameter information of the drawing control also includes the parameters of the drawing instruction; and according to the number of the drawing controls in the current frame and the parameters of the drawing instruction, it is determined whether there is a bullet screen in the current display interface.
[0015] Among them, the drawing control of the video is of TextureView type, and the drawing control of the bullet screen is of ImageView type; according to the parameters of the TextureView drawing control and the Bitmap drawing instruction in the current frame, it is determined whether the current display interface includes the bullet screen.
[0016] Among them, when the number of TextureView drawing controls in a certain number of frames within a certain frame range is 1 and there are Bitmap drawing instructions, the instruction analysis process is entered; if it is determined that the number of TextureView drawing controls in a certain number of frames within a certain frame range is not 1 and there are Bitmap drawing instructions, only when the number of TextureView drawing controls that do not exist in a certain number of frames in a row is 1 and there are Bitmap drawing instructions, the recognition result of "no barrage" is sent to the layer rendering and synthesis service.
[0017] Optionally, the instruction analysis process is entered only when the number of TextureView drawing controls is 1 in 3 frames out of 10 frames and there is a Bitmap drawing instruction.
[0018] Optionally, the recognition result of "no bullet screen" is sent to the layer rendering synthesis service only when the number of TextureView drawing controls that do not exist in 200 consecutive frames is 1 and there is no Bitmap drawing instruction.
[0019] Among them, in the analysis of the instruction process, only when the Bitmap drawing instruction parameters of the two frames before and after a certain number of frames meet the conditions that the length and width are equal, the horizontal coordinate of the upper left corner decreases, and the vertical coordinate remains unchanged, can the conclusion of "there is barrage" be drawn.
[0020] Optionally, the number of comparison frames is 10.
[0021] In a second aspect, an embodiment of the present application provides a bullet screen recognition device, which can be applied to an electronic device to implement the method in the first aspect above. The functions of the device can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, such as an acquisition module and a processing module.
[0022] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute any step described in the first aspect.
[0023] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described in the first aspect.
[0024] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes executable instructions. When the executable instructions are executed on a computer, the computer executes any one of the methods described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0026] Figure 1 A schematic diagram of the hardware system structure of an electronic device provided in an embodiment of the present application.
[0027] Figure 2 A schematic diagram of the software system structure of an electronic device provided in an embodiment of the present application.
[0028] Figure 3 A schematic diagram of an application scenario provided for an embodiment of the present application.
[0029] Figure 4 A schematic diagram of a process for performing barrage recognition and refresh rate adjustment provided in an embodiment of the present application.
[0030] Figure 5 Schematic diagram of the process of barrage recognition and refresh rate adjustment for this application.
[0031] Fig. 6A A schematic diagram of the first part of a bullet screen recognition process provided in an embodiment of the present application.
[0032] Figure 6B A schematic diagram of the second part of a bullet screen recognition process provided in an embodiment of the present application.
[0033] Fig. 7A A schematic diagram of the first part of another bullet comment recognition process provided in an embodiment of the present application.
[0034] Figure 7B A schematic diagram of the second part of another bullet screen recognition process provided in an embodiment of the present application.
[0035] Figure 7CA schematic diagram of the third part of another bullet comment recognition process provided in an embodiment of the present application.
[0036] Fig.7D A schematic diagram of the fourth part of another bullet screen recognition process provided in an embodiment of the present application.
[0037] Figure 8 A logical flow chart of the refresh rate adjustment provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] With the advancement of technology, the configuration and performance of electronic devices (such as mobile phones, tablets, etc.) are getting higher and higher, and various video and live broadcast applications that provide long video content, short video content, video live broadcast and other functions have developed rapidly. These applications can provide users with the function of sending barrage when playing videos. In order to provide users with personalized choices, these video applications and live broadcast applications can selectively turn on or off the display of barrage, expression effects, gift effects, etc. when playing videos.
[0039] At present, when electronic devices display videos played by video applications or live broadcast applications, they generally use the highest refresh rate supported by the display screen (for example, a 60Hz refresh rate for a general display screen, or a 90Hz refresh rate, a 120Hz refresh rate, etc. for some displays with higher refresh rates). However, the frame rate of most video resources (such as live videos, film and television videos, etc.) is basically 30 frames or lower. Therefore, in order to reduce the power consumption of electronic devices when displaying videos played by video applications or live broadcast applications, the electronic device can turn off the large core of the processor when displaying the video played by the application and the user has no operation input, thereby ensuring the normal playback of the video with low power consumption.
[0040] However, if the user turns on the display of barrage animation, the electronic device will also display the corresponding barrage animation when displaying the video. At this time, the electronic device will increase the amount of calculation due to the display of the barrage and turn off the large-core processor, making the computing power unable to meet the needs, resulting in the electronic device being stuck when displaying the video. Therefore, when an electronic device displays a video, if it is able to identify whether the barrage animation is also displayed, the electronic device can be adaptively optimized and adjusted according to whether content other than the barrage video is displayed, so that the electronic device can achieve a better balance between power consumption and performance, so that the electronic device can run at lower power consumption without freezing the display interface, thereby improving the user experience, or adjusting the performance of the electronic device according to the displayed barrage to improve the barrage display effect, etc.
[0041] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0042] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0043] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0044] A method for bullet screen recognition provided in an embodiment of the present application can be applied to an electronic device with a video playback function. The electronic device includes a terminal device, which can also be called a terminal, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), etc. The electronic device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with a wireless transceiver function, a virtual reality (VR) electronic device, an augmented reality (AR) electronic device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc. The embodiments of the present application do not limit the specific technology and specific device form adopted by the electronic device.
[0045] In order to better understand the embodiments of the present application, the structure of the electronic device in the embodiments of the present application is introduced below:
[0046] Figure 1 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention is provided, and the electronic device includes but is not limited to: a network module 1207, an audio circuit 1206, an input unit 1210, a sensor 1208, a display unit 1209, a user input unit 1202, an interface unit 1203, a memory 1204, a processor 1201, and a power supply 1205. Those skilled in the art will appreciate that Figure 1 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, and a wearable device.
[0047] In some embodiments, the processor 1201 may include one or more processing units, for example, the processor 1201 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0048] The processor 1201 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 1201 is a cache memory. The memory may store instructions or data that the processor 1201 has just used or cyclically used. If the processor 1201 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 1201, and thus improves the efficiency of the system.
[0049] In some embodiments, the processor 1201 may include one or more interfaces. For example, the processor 1201 may include at least one of the following interfaces: an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and a USB interface.
[0050] Exemplarily, in an embodiment of the present application, the bullet comment recognition method provided in the present application may be executed in the processor 1201.
[0051] Figure 1The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device. Optionally, the modules of the electronic device may also adopt a combination of multiple connection modes in the above embodiments.
[0052] The network module 1207 provides users with wireless broadband Internet access, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0053] The display unit 1209 is used to display information input by the user or information provided to the user. The display unit 1209 may include a display panel 12091. The display panel 12091 may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include 1 or N display screens, where N is a positive integer greater than 1.
[0054] The audio circuit 1206 may convert audio data received by the network module 1207 or the like or stored in the memory 1204 into an audio signal and output it as sound.
[0055] The input unit 1210 is used to receive audio or video signals. The input unit 1210 may include a graphics processing unit (GPU) and a microphone, and the graphics processor processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 1209. The image frame processed by the graphics processor can be stored in the memory 1204 (or other storage medium) or sent via the radio frequency unit or the network module 1207.
[0056] The user input unit 1202 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 1202 includes a touch panel 12021 and other input devices 12022. The touch panel 12021, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 12021 or near the touch panel 12021 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 12021 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 1201, receives the command sent by the processor 1201 and executes it. In addition, the touch panel 12021 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 12021, the user input unit 1202 may also include other input devices 12022. Specifically, other input devices 12022 may include but are not limited to physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which will not be repeated here.
[0057] Furthermore, the touch panel 12021 may be overlaid on the display panel 12091. When the touch panel 12021 detects a touch operation on or near it, it is transmitted to the processor 1201 to determine the type of touch event. Then, the processor 1201 provides corresponding visual output on the display panel 12091 according to the type of touch event. Figure 1 In the figure, the touch panel 12021 and the display panel 12091 are two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 12021 and the display panel 12091 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0058] The electronic device also includes at least one sensor 1208, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 12091 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 12091 and / or the backlight when the electronic device is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 1208 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0059] The interface unit 1203 is an interface for connecting an external device to the electronic device. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 1203 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements in the electronic device or may be used to transmit data between the electronic device and the external device.
[0060] The memory 1204 can be used to store software programs and various data. The memory 1204 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 1204 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0061] The processor 1201 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 1204 and calling data stored in the memory 1204, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 1201 may include one or more processing units; optionally, the processor 1201 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1201.
[0062] The electronic device may also include a power supply 1205 (such as a battery) for supplying power to various components. Optionally, the power supply 1205 may be logically connected to the processor 1201 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0063] In addition, the electronic device includes some functional modules not shown, which will not be described in detail here.
[0064] Optionally, an embodiment of the present invention further provides an electronic device, including a processor 1201, a memory 1204, and a computer program stored in the memory 1204 and executable on the processor 1201. When the computer program is executed by the processor 1201, each process of the above-mentioned barrage information recognition method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0065] like Figure 2 , which is a software structure block diagram of the electronic device according to an embodiment of the present application.
[0066] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, system library, and hardware abstraction layer.
[0067] The application layer consists of all applications running on Android devices, including pre-installed system applications and third-party applications installed by yourself. Most of them are written in Java and run in the Dalvik virtual machine, and the other part of the applications are local applications written in C++ / C. But no matter what programming language is used, the two types of applications run in the same security environment and run in the application sandbox. It can include a series of application packages, including short video playback applications such as Douyin, Kuaishou, Douyin, WeChat, Xigua Video, Huoshan Short Video, Haokan Video, etc.
[0068] The Application Framework layer is the core of Android application development. It provides developers with a basic API framework when developing applications, including View controls and Android graphics drawing interfaces. The framework layer consists of multiple system services. Android applications are composed of several components, and the communication between components is achieved through centralized scheduling and message delivery of services provided by the framework layer.
[0069] System library: Common local services and some link libraries are implemented in C and C++ languages, including modules such as HWUI and SurfaceFlinger. The Android platform displays some system library functions to applications through the application framework layer API.
[0070] The Hardware Abstract Layer (HAL) is located between the Android framework and the Linux kernel driver. It is an encapsulation of the Linux kernel driver and provides a standard interface to display device hardware functions to the higher-level Java API framework. The HAL contains multiple library modules, each of which implements an interface for a specific type of hardware component, such as a camera or Bluetooth module. When the framework API requires access to device hardware, the Android system will load the library module for that hardware component.
[0071] SurfaceFlinger service is layer rendering and synthesis service, which is a system service. It is mainly responsible for the establishment, control and management of layers. The SurfaceFlinger service includes the number of layers displayed by applications (such as video applications). The preview interface (SurfaceView) occupies a layer alone. SurfaceFlinger can adjust the refresh rate according to the current number of layers.
[0072] JNI, the full name of which is Java Native Interface, is a native interface in the Java language, not created by Android. Through JNI, Java and C / C++ can interact, that is, you can call C / C++ and other language codes in Java code or call Java code in C / C++ code.
[0073] MediaCodec is the codec component in Android, which is used to access the codec provided by the underlying layer. It is usually used with MediaExtractor, MediaSync, MediaMuxer, MediaCrypto, MediaDrm, Image, Surface, and AudioTrack. MediaCodec is almost the standard configuration for Android player hard decoding.
[0074] It is understandable that the Android graphics drawing interface is edited in Java language, and the hardware accelerated drawing module is edited in C++ language. To achieve communication and interaction between the Android graphics drawing interface and the hardware accelerated drawing module, JNI is needed to act as a bridge.
[0075] To facilitate understanding, some of the examples given are provided for reference to the description of concepts related to the embodiments of the present application.
[0076] A frame is a single picture that is the smallest unit in an interface display. A frame can be understood as a still picture. Displaying multiple connected frames in rapid succession can create the illusion of motion. Frame rate refers to the number of frames that refresh an image in 1 second. It can also be understood as the number of times the graphics processor in an electronic device refreshes the image per second. A high frame rate can produce smoother and more realistic animations. The more frames per second, the smoother the displayed motion will be.
[0077] Frame drawing refers to the picture drawing of the display interface. The display interface can be composed of one or more views, each view can be drawn by the visual control of the view system, each view is composed of subviews, and a subview corresponds to a widget in the view, for example, one of the subviews corresponds to a symbol in the picture view.
[0078] VSync is an event that the Android Linux kernel publishes regularly at fixed intervals, in which input processing, animation, and window drawing occur synchronously in a standard order. It enables the CPU, GPU, and Display to work at the same rhythm, so that there is no tearing when the screen is refreshed.
[0079] HWC (Hardware Composer) is a hardware hybrid renderer. HWC can generate VSync signals and pass VSync signals to SurfaceFlinger through callbacks.
[0080] DispSync is located in SurfaceFlinger, and can generate VSync-app based on the VSync signal for Choreographer to use. When VSync-app arrives, it will wake up Choreographer to perform the drawing operation of the App.
[0081] Choreographer is a Java class, a new mechanism added in Android 4.1, which is used to cooperate with the system's VSYNC interrupt signal. It can receive the system's VSYNC signal and uniformly manage the execution timing of application input, animation, drawing and other tasks.
[0082] RenderThread, or rendering thread, is responsible for taking on part of the rendering work of the main thread to reduce the burden of the main thread. The operations of other threads are completed in the form of Task or WorkItem posted to RenderThread.
[0083] DrawFrameTask is a special task in RenderThread, which is used to draw the entire interface and is triggered following Vync.
[0084] Surface, or layer, is a drawing buffer in memory, a handle to the native buffer managed by the screen display content synthesizer. That is, the native buffer and its contents can be obtained through Surface. Any View in the system is drawn on Surface.
[0085] SurfaceView, part of the control system provided by Android, is essentially a View. Unlike ordinary View, it has its own Surface, corresponding to a separate layer, and is drawn and rendered in an independent thread. SurfaceView cannot perform transformations such as translation and scaling. Compared with ordinary ImageView, it has higher performance, so it is often used in application scenarios with high requirements on drawing rate to solve the problem of frame drops caused by ordinary View due to drawing time delay, such as being used as a medium for camera preview and video playback.
[0086] TextureView is essentially a View. It can project content streams directly into the View. Unlike SurfaceView, it does not correspond to a separate layer, but is a normal View in the View hierachy (view hierarchy) and can be moved, rotated, scaled, etc. like other normal Views.
[0087] ImageView is essentially a View. Its main function is to display images. In fact, it can be used not only to display pictures, but any Drawable object can be displayed using ImageView.
[0088] Figure 3 A schematic diagram of an application scenario of an embodiment of the present application.
[0089] Figure 3 (a) is the mobile device interface. At this time, the refresh rate of the electronic device is the refresh rate corresponding to the display interface. The user clicks on the "Short Video" application and then enters Figure 3 (b) in .
[0090] It is understandable that electronic device manufacturers will configure an initial refresh rate based on different video applications. When the user clicks to enter the video application, the electronic device will refresh at this refresh rate.
[0091] Figure 3 (b) in the figure is the vertical screen mode of the "short video" application. At this time, the electronic device adjusts the refresh rate to the refresh rate corresponding to the video application according to the settings. Figure 3 The area encircled by the circle 301 in (b) is the "bullet screen switch" button, and the user can turn on and off the bullet screen by clicking the "bullet screen switch" button. Figure 3 (b) in the figure shows the situation where the “bullet screen switch” button is in the off state.
[0092] It is understandable that according to the system settings, under any user operation, the electronic device will first adjust the screen refresh rate of the electronic device in response to any user operation to ensure user experience. This solution requires a certain number of frames to be judged. Therefore, after the user no longer clicks, the electronic device adjusts the refresh rate according to the presence or absence of the bullet screen.
[0093] Figure 3 (c) in the figure is the situation where the "bullet screen switch" button is in the on state. The electronic device recognizes that there is a bullet screen on the current display interface and adjusts the refresh rate to the refresh rate under the bullet screen scenario. Figure 3 (d) in the figure is the case where the "bullet screen switch" button is in the off state. At this time, the electronic device recognizes that there is no bullet screen on the current display interface and adjusts the refresh rate to the refresh rate in the video playback scenario. Figure 3 (b) and Figure 3 302 in (c) is a "horizontal screen" switch button, and the user can enter the horizontal screen mode by clicking 302.
[0094] Figure 3 (e) is the main page of the electronic device. When the user exits from the video application interface, he enters Figure 3 The electronic device main page in (e) in FIG. 10 . At this time, the electronic device adjusts the refresh rate to the refresh rate corresponding to the main page set by the electronic device according to the setting.
[0095] Understandably, Figure 3The refresh rates of the figures are for illustrative purposes only and are not limited here. It is understandable that this embodiment does not limit the "horizontal screen" button. Some programs do not have a "horizontal screen" button, but automatically identify whether the user's mobile phone is in portrait or landscape mode, or switch between portrait and landscape modes in a system-following manner.
[0096] Understandably, Figure 3 The electronic device system switches the refresh rate in the illustrated scenarios of turning the bullet screen switch on and off, which is only an exemplary description of the system switching the refresh rate. When the electronic device adjusts the refresh rate, the presence or absence of bullet screen is only one of the considerations for switching the refresh rate.
[0097] It is understandable that the position of the bullet screen switch in this embodiment is located on the interface, which is only for the purpose of illustrating the technical solution, and does not limit the position of the bullet screen switch. The bullet screen switch can be located in the settings of the video application, or can be set by long pressing the video, or when the user clicks the bullet screen control here, it is only for posting bullet screens.
[0098] It is understandable that this embodiment does not limit the "short video" application, and any application that can play short videos can be the "short video" application of this embodiment. It is understandable that this application scheme does not limit the nature of the application, and it can be a "short video" application, or a "long video" and other applications and scenarios that can recognize barrage information in the display.
[0099] The prior art adopts a method of identifying the layer attributes (such as the number of layers, the identification of each layer, etc.) or elements (elements can be controls, graphics, pictures, etc. in the display interface) of the current display interface, and determines whether additional animations (such as barrage, expression animations, gift animations, etc.) are displayed in the current display interface based on the recognition results of the layer attributes. However, the prerequisite for the implementation of the prior art is that the barrage and the video are drawn on different layers respectively, which is common in some long videos. However, for the situation where the barrage and the video are drawn on the same layer, such as some short videos, the technology cannot be identified, and the device cannot identify whether the barrage exists, so the refresh rate of the device cannot be adjusted. The present application provides a barrage recognition method, for the situation where the barrage and the video are drawn on the same layer, by identifying whether the relevant features of the view to which the barrage belongs appear during the drawing process to determine whether the barrage exists.
[0100] Figure 4 A schematic diagram of a process for performing bullet screen recognition and refresh rate adjustment is shown. Figure 4 As shown, it mainly includes the following steps.
[0101] Step S101: Enter the video playback interface.
[0102] The electronic device receives a user operation, and in response to the user operation, starts a video application, presents a video playback interface, and starts playing the video.
[0103] Step S102: The video application creates a SurfaceView drawing control (video).
[0104] It can be understood that the SurfaceView drawing control can be used to draw video content, and can also be used to draw barrage content.
[0105] Step S103: The video application creates a SurfaceView drawing control (bullet screen).
[0106] Step S104: The application creates a Media Codec for decoding the video, and binds the Surface layer of the SurfaceView drawing control to the created Media Codec.
[0107] Step S105: The application calls Media Codec to decode the video.
[0108] Step S106: After receiving the decoding instruction, the Media Codec decodes the video content.
[0109] Step S107: Media Codec renders the decoding result onto Surface.
[0110] After decoding is completed, Media Codec renders the decoding result to the Surface layer, where the Surface is the Surface of SurfaceView in step S104.
[0111] Step S108: After the rendering content in the Surface is updated, the Surface layer will be submitted to the layer rendering synthesis service for layer synthesis.
[0112] Step S109: Identify the number of layers.
[0113] The electronic device recognizes the number of Surface layers.
[0114] Step S110: The layer rendering and synthesis service adjusts the refresh rate with reference to the number of layers currently involved in synthesis.
[0115] In the above Figure 4In the solution shown, since the Surfaceview drawing control itself has a Surface layer, when both the video and the bullet screen are Surfaceview drawing controls, the electronic device can identify whether there is a bullet screen layer based on the number of Surface layers, and then obtain whether there is a bullet screen Surfaceview drawing control, thereby deriving whether there is a bullet screen on the video display interface. This solution can only identify the case when both the video and the bullet screen are Surfaceview drawing controls. When the video and the bullet screen are not drawn using the Surfaceview drawing control, Figure 4 The technical solution shown cannot be identified.
[0116] Figure 5 The overall flow chart of the bullet screen recognition method provided in the embodiment of the present application is shown. Figure 2 The electronic device with the software structure shown in the figure can execute. This embodiment can identify whether there is a bullet screen in the current interface when the video and the bullet screen are in the same layer. Figure 5 As shown, it mainly includes the following steps.
[0117] Step S201: Enter the video playback interface.
[0118] The electronic device receives a user operation, and in response to the user operation, starts a video application, presents a video playback interface, and starts playing the video.
[0119] It is understandable that the "video" application is not limited here, and any application that can play short videos can be the "video" application here. It is understandable that the nature of the application is not limited here, and it can be a "short video" application or a "long video" application and scenario that can recognize barrage information in the display.
[0120] Step S202: the video application creates a TextureView drawing control for the video.
[0121] The video application creates a TextureView drawing control for the video. The application needs to create corresponding controls to draw the content to be displayed. It can be understood that both the TextureView drawing control and the SurfaceView drawing control can be used to draw the video content. When the video and the bullet screen are on the same layer, the video is mainly drawn using the TextureView drawing control. The control for drawing the bullet screen content can be a TextureView drawing control or other View-type drawing controls that can draw Bitmaps. It can be understood that this step creates a drawing control type and does not constitute a specific limitation on the drawing controls created by the application. In other embodiments, the application can create other drawing controls.
[0122] Step S203: The video application creates a TextureView drawing control for the bullet screen.
[0123] It is understandable that both the TextureView drawing control and the SurfaceView drawing control can be used to draw video content. When the video and the bullet comment are on the same layer, the video is mainly drawn using the TextureView drawing control. The control for drawing the bullet comment content can be a TextureView drawing control, or it can be other View-type drawing controls that can draw Bitmaps. Here, the drawing control for the bullet comment is of the TextureView type as an example. It is understandable that this step creates a drawing control type and does not constitute a specific limitation on the drawing controls created by the application. In other embodiments, the application can create other drawing controls.
[0124] Step S204: the application sends a refresh interface instruction to the framework layer.
[0125] After the control is created, when the interface content is updated, that is, the video content changes, or the bullet screen moves, the application sends the interface redraw instruction "Invalidate" function to the framework layer. The application notifies the framework layer to redraw by calling the "Invalidate" function.
[0126] Step S205: The framework layer requests the layer rendering synthesis service to receive a VSync signal.
[0127] If the current interface needs to be redrawn, the framework layer will request the received VSync signal from the layer rendering synthesis service through Choreographer.
[0128] Step S206: The hardware mixing renderer generates a hardware VSync signal.
[0129] The hardware VSync signal is issued by the Android kernel at regular intervals, and its generation is related to the refresh rate. The VSync signal is used to control the rendering, layer synthesis, and display rhythm of the display screen, so that the display screen can refresh the display according to the corresponding refresh rate.
[0130] Step S207: The hardware mixing renderer sends a hardware VSync signal to the layer rendering synthesis service.
[0131] After the hardware mixed renderer generates a hardware VSync signal, it passes the VSync signal to the layer rendering synthesis service through a callback function.
[0132] Step S208: The layer rendering and synthesis service generates a VSync-app signal.
[0133] After receiving the hardware VSync signal, the layer rendering and compositing service can generate a VSync-app signal according to the signal. The VSync-app signal is used to cooperate with the VSync signal to control the timing of the electronic device to perform drawing operations.
[0134] Step S209: The layer rendering and synthesis service sends a VSync-app signal to the framework layer.
[0135] After the layer rendering and compositing service generates the VSync-app signal, if the framework layer requests to receive the VSync signal (i.e., S204), the layer rendering and compositing service will send the VSync-app signal to the framework layer.
[0136] Step S210: the framework layer receives the VSync-app signal and drives the interface to refresh.
[0137] There will be many Views in the display interface. When the framework layer receives the VSync-app signal, the VSync-app signal will wake up the Choreographer to perform drawing operations, that is, to determine which view needs to be redrawn.
[0138] Step S211: the framework layer performs a drawing operation.
[0139] After Choreographer is awakened, it will trigger ViewRootImpl to traverse the entire current view tree. During the traversal, it will perform measure, layout, and draw. These three processes together constitute the entire drawing process. The draw process will call the onDraw function (action set, that is, the steps required for drawing) of each View to draw the View.
[0140] Step S212: the framework layer calls the drawing instruction in the drawing instruction set.
[0141] The drawing steps in the onDraw function call the drawing instructions in the drawing instruction set to perform the drawing operation.
[0142] Step S213: the drawing instruction set records the called drawing instruction.
[0143] The drawing instruction set records the called drawing instructions in the order of calling, which is the process of drawing instruction recording.
[0144] Step S214: Obtain the number of TextureView drawing controls of the frame data.
[0145] During the drawing instruction recording process, the drawing of the TextureView drawing control will call the drawTextureLayer drawing interface. The number of calls to the drawTextureLayer drawing interface is the number of TextureViews drawn in the current frame. By recording the number of times the TextureView drawing control calls the drawTextureLayer drawing instruction, the number of TextureView drawing controls in the current frame data can be obtained.
[0146] It is understandable that the hardware accelerated drawing module can set some variables to be accessible to both the drawing instruction set and the rendering thread and the bullet recognition module. The drawing instruction set obtains the number of TextureView drawing controls, and the hardware accelerated drawing module sets the number value to a variable that can be accessed by both the drawing instruction set and the rendering thread and the bullet recognition module.
[0147] Step S215: Notify the end of recording
[0148] After the drawing instruction set completes recording the drawing instruction, the drawing instruction set notifies the framework layer that the recording has ended.
[0149] Step S216: The framework layer sends a synchronization instruction to the rendering thread.
[0150] After the framework layer receives the notification that the drawing instruction set has completed recording the drawing instruction, the framework layer sends a synchronization instruction by calling a synchronization function in the rendering thread to trigger the rendering thread to start synchronously recording the drawing instruction set's recording of the drawing instruction call.
[0151] Step S217: The rendering thread synchronously records the recorded content.
[0152] After receiving the synchronization instruction from the framework layer, the rendering thread synchronously records the recording of the drawing instruction call by the drawing instruction set, that is, the rendering thread synchronously records the order of the drawing instruction calls.
[0153] Step S218: The rendering thread sends a recognition instruction to the bullet comment recognition module.
[0154] After the synchronization is completed, the rendering thread sends a recognition instruction to the bullet screen recognition module, triggering the bullet screen recognition module to perform bullet screen recognition. The bullet screen recognition module is an encapsulation of the bullet screen recognition logic.
[0155] When synchronously recording the recorded content, the rendering thread can access the number of TextureView drawing controls of the frame data recorded by the drawing instruction set in step S214 and set as a variable by the hardware accelerated drawing module, and perform statistics. When the rendering thread sends a recognition instruction to the bullet screen recognition module, the counted number will also be sent to the bullet screen recognition module.
[0156] It is understandable that when the barrage recognition module starts the barrage recognition process (after entering the instruction analysis process), it will notify the drawing instruction set to record the parameter information of the drawing instruction when recording the drawing instruction, and the hardware accelerated drawing module will set the parameter information to a variable that can be accessed by the drawing instruction set, rendering thread and barrage recognition module, so that the subsequent barrage recognition module can directly access it when performing barrage recognition; when the barrage recognition module completes the recognition, it will notify the drawing instruction set again to stop recording the parameter information of the drawing instruction. In this embodiment, the drawing control of the barrage image is of TextureView type, so the barrage recognition module will not notify the drawing instruction set to record the parameter information of the drawing instruction when recording the drawing instruction. When the drawing control of the barrage image is of image type, the barrage recognition module will notify the drawing instruction set to record the parameter information of the drawing instruction when recording the drawing instruction.
[0157] S201 to S218 are the overall process of an electronic device generating a bullet screen and triggering drawing and rendering. The embodiment of the present application identifies the bullet screen by analyzing the call record of the drawing instruction.
[0158] Step S219: The bullet screen recognition module recognizes the bullet screen.
[0159] When receiving the recognition instruction sent by the rendering thread, the bullet screen recognition module starts to recognize bullet screens, that is, according to Fig. 6A , Figure 6B , Fig. 7A , Figure 7B , Figure 7C , Fig.7D The bullet screen recognition judgment logic in the drawing control and drawing instruction information is processed. It can be understood that S219 is the main process of bullet screen recognition in the embodiment of the present application.
[0160] Step S220: The bullet screen recognition module obtains the number of TextureView drawing controls.
[0161] When the barrage recognition module performs the barrage recognition process, it accesses the number of TextureView drawing controls and identifies whether the barrage switch is turned on or off based on the number of TextureView drawing controls.
[0162] It is understandable that in this embodiment, the drawing control of the bullet screen image is of TextureView type, so the bullet screen recognition module will not access the parameters of the drawing instruction. When the drawing control of the bullet screen image is of image type, the bullet screen recognition module will access the parameters of the drawing instruction.
[0163] Step S221: The bullet screen recognition module sends the bullet screen recognition result to the layer rendering and synthesis service.
[0164] When the bullet comment recognition module obtains the recognition result after the recognition process, it will send the recognition result to the layer rendering and synthesis service.
[0165] Step S222: The layer rendering synthesis service adjusts the refresh rate based on the bullet screen recognition result.
[0166] It is understandable that the reference factor for the layer rendering and synthesis service to adjust the refresh rate is not only the recognition result of the barrage, but also needs to refer to other factors. Therefore, the barrage recognition result is only a reference factor for the layer rendering and synthesis service to adjust the refresh rate.
[0167] Fig. 6A , Figure 6B , Fig. 7A , Figure 7B , Figure 7C , Fig.7D for Figure 5 The specific judgment process of the bullet screen recognition module in step S219 to recognize the bullet screen. Fig. 6A , Figure 6B , Fig. 7A , Figure 7B , Figure 7C , Fig.7D right Figure 5 Step S219 in is described in detail.
[0168] Fig. 6A , Figure 6B This shows the case where both the video and bullet comments view types are TextureView drawing controls. When the "bullet comment switch" is turned off, only one TextureView drawing control (the video) is drawing; when the "bullet comment switch" is turned on, two TextureView drawing controls (the video and the bullet comment) are drawing. Fig. 6A , Figure 6B By identifying the number of TextureView drawing controls drawn within a period of time, the on and off of the "bullet screen switch" is judged; when the "bullet screen switch" is turned on, it is concluded that there is a bullet screen on the current interface; when the "bullet screen switch" is turned off, it is concluded that there is no bullet screen on the current interface. Fig. 6A The following describes the judgment process of identifying whether the "bullet screen switch" is turned on. Fig. 6AThe method of barrage recognition in the embodiment of the present application is introduced in detail. Fig. 6A The bullet screen recognition method shown can be executed by an electronic device. The above steps are described in detail below.
[0169] Step S301: Initialize the timing values of timer A and timer B, and the count value of the counter.
[0170] The initial value of timer A is a set value of 40, the initial value of timer B is a set value of 200, the initial value of the counter is 0, and the threshold of the counter is set to 8, that is, to determine whether there are 8 frames in 40 frames where the number of TextureView drawing controls drawn is 2. Timer B calculates whether the number of consecutive TextureView drawing controls in 200 frames is not 2, that is, to stably detect whether the number of TextureView drawing controls is less than 2. The judgment is made every frame in units of frames.
[0171] Step S302: Whether the number of TextureView drawing controls in the current frame is 2.
[0172] Determine whether the number of TextureView drawing controls in the current frame is 2; if it is determined to be "yes", proceed to step S303; if it is determined to be "no", proceed to step S310.
[0173] Step S303: Whether the count value of the counter is less than 8.
[0174] It is determined whether the count value of the counter is less than 8, that is, whether the counter has reached the set threshold. If the count value of the counter is less than 8, the process proceeds to step S304; if the count value of the counter is not less than 8, that is, equal to 8, the process proceeds to step S311.
[0175] Step S304: Add 1 to the count value of the counter.
[0176] Step S305: Whether the count value of the counter is 8.
[0177] Determine whether the count value of the counter is 8; if the count value of the counter is 8, it means that there are 8 frames in which the number of TextureView drawing controls is 2, and go to step S306; if the count value of the counter is not 8, it means that there are not 8 frames in which the number of TextureView drawing controls is 2, and go to step S307.
[0178] Step S306: Mark with barrage.
[0179] When there are 8 frames (within 40 frames) in which the number of TextureView drawing controls is 2, a judgment result of "there is a bullet comment" is obtained, and then the next frame is entered, and the process returns to step S302.
[0180] Step S307: The timing value of timer A is "minus 1", and then enters step S308.
[0181] The count value of the counter is not 8, which means that the number of TextureView drawing controls is 2 in the existing frames. The timing value of timer A is reduced by 1, and then the process goes to S308.
[0182] Step S308: Whether the timing value of timer A is equal to "0".
[0183] Determine whether the timing value of timer A is equal to "0". If the timing value of timer A is equal to "0", it means that 40 frames have been run, and the number of TextureView drawing controls is 2 in 8 frames, and the process goes to step S309. If the timing value of timer A is not equal to "0", it means that 40 frames have not been run, and the number of TextureView drawing controls is 2 in 8 frames, and the process goes to the next frame and goes back to step S302.
[0184] Step S309: Initialize the timing values of all timers and the counting values of counters.
[0185] The scenario at this time is that 40 frames have been run, and less than 8 frames in the 40 frames have bullet comments, so the timing values of all timers and the counting values of counters are initialized, that is, S301; then enter the next frame and return to S302.
[0186] Step S310: Whether the count value of the counter is 0 or 8.
[0187] Step S302 concludes that the number of TextureView drawing controls in the current frame is not 2, that is, there is no bullet comment in the current frame, and then proceeds to step S310. Step S310 determines whether the count value of the counter is 0 or 8, that is, whether the count has started, or the count value has reached the threshold. Only when the counter has not started counting, or the counter has reached the threshold, does it proceed to step S311, that is, Figure 6B If the counter is counting, that is, the value of the counter is between 1 and 8, proceed to step S307.
[0188] Figure 6B The following describes the judgment process of whether the "bullet screen switch" is turned off. Figure 6B The method of barrage recognition in the embodiment of the present application is introduced in detail. Figure 6B The bullet screen recognition method shown can be executed by an electronic device. The above steps are described in detail below.
[0189] Step S401: Check whether the number of TextureView drawing controls is less than 2.
[0190] Determine whether the number of TextureView drawing controls in the current frame is less than 2. If the number of TextureView drawing controls in the current frame is less than 2, proceed to step S402; if the number of TextureView drawing controls in the current frame is not less than 2, proceed to step S405.
[0191] Step S402: Subtract 1 from the timing value of timer B.
[0192] Step S403: Whether the timing value of timer B is equal to 0.
[0193] Step S402 updates the timing value of timer B, and step S403 determines whether the timing value of timer B is equal to 0. If the timing value of timer B is equal to 0, proceed to step S404; if the timing value of timer B is not equal to 0, proceed to the next frame determination and return to step S302.
[0194] Step S404: Mark as no bullet screen, and initialize the timing values of all timers and the counting values of counters.
[0195] It is determined that during the process of drawing 200 frames of images by the electronic device, the TextureView drawing control to which the bullet screen belongs has not been drawing, and the bullet screen is currently closed. The timing value of timer B, the timing value of timer A, and the count value of the counter are initialized (equivalent to S301), and the next frame is entered, returning to S302.
[0196] Step S405: Initialize the timing value of timer B.
[0197] Understandably, Fig. 6A Determine whether there are 8 frames in the 40 frames in which the number of TextureView drawing controls drawn is 2; if so, it can be concluded that the current interface "has bullet comments"; if not, continue to the next frame judgment. Figure 6BDetermine whether the number of TextureView drawing controls is not 2 for 200 consecutive frames, that is, stably detect whether the number of TextureView drawing controls is less than 2; if so, it can be concluded that the current interface has "no barrage"; if not, continue to enter the judgment of the next frame. It is understandable that, due to system power consumption considerations, not every 40 frames with 8 frames with 2 TextureView drawing controls will give the conclusion that the current interface "has barrage", such as S303 and S310, when the counter count value is 8, that is, 8 frames with 2 TextureView drawing controls in 40 frames have appeared, regardless of whether the number of TextureView drawing controls in the next frame is 2, it will enter the judgment. Figure 6B The judgment process in , that is, to judge whether there is a situation where the number of TextureView drawing controls drawn for 200 consecutive frames is not 2.
[0198] It is understandable that this embodiment does not limit the timing value of timer A, the timing value of timer B, and the threshold of the counter. In order to ensure the accuracy and predictability of method identification, in other embodiments, the values of the timer and counter can be selected according to the characteristics of the application; the initial timing value of timer A can be set to 20, and the threshold of the counter can be set to 4, that is, whether there are 4 frames of TextureView drawing controls drawn within two consecutive 20 frames is 2, that is, there are 4 frames with barrage. The initial timing value of timer A can also be set to 0, and the threshold of timer A can be set in the process. The same applies to timer B and counter.
[0199] It can be understood that the purpose of setting the number of TextureView drawing controls drawn with 2 to determine whether there is a certain amount of frame data within a certain range is to exclude the possibility that when the video turns off the barrage switch, if the user switches from one video to another, both videos may be refreshed briefly.
[0200] Fig. 7A , Figure 7B , Figure 7C , Fig.7DThe view type for displaying videos is a TextureView drawing control, and each bullet comment is a Bitmap image. When there is no bullet comment on the current interface, there is only a TextureView drawing control (for the video) drawing, and no drawing control for Bitmap; when there is a bullet comment on the current interface, there is not only a TextureView drawing control (for the video) drawing, but also a Bitmap drawing control. By comparing the parameters of the Bitmap drawing instructions in the previous and next frames within a certain frame number range to see if they meet the conditions of equal length and width, reduced horizontal coordinates in the upper left corner, and unchanged vertical coordinates, we can determine whether there is a bullet comment on the current interface. Fig. 7A The following describes the judgment process of entering "instruction analysis". Fig. 7A The method of barrage recognition in the embodiment of the present application is introduced in detail. Fig. 7A The bullet screen recognition method shown can be executed by an electronic device. The above steps are described in detail below.
[0201] Step S500: Initialize the timing values of timer A, timer B and timer C, and the count value of the counter.
[0202] The initial value of timer A is a set value of 10, the initial value of timer B is a set value of 200, the initial value of timer C is a set value of 10, the initial value of the counter is 0, and the threshold of the counter is set to 3, that is, to determine whether there are 3 frames in 10 frames where the TextureView drawing control is 1 and there are Bitmap drawing instructions. Timer B calculates whether there are no Bitmap drawing instructions for 200 consecutive frames. The judgment is made every frame in units of frames.
[0203] Step S501: Determine whether the number of drawn controls in the current frame is less than 2.
[0204] It is understandable that at this time, the video playback interface has been entered, and there is a TextureView drawing control in the video. At this time, it is determined whether there are other types of controls, which may include drawing controls for drawing bullet comments, or other types of drawing controls. If the judgment is "no", it goes to step S502, and if the judgment is "yes", it goes to step S511.
[0205] Step S502: Whether there is a Bitmap drawing instruction in the current frame.
[0206] It is determined whether there is a Bitmap drawing instruction in the current frame, that is, whether there may be a bullet comment in the current frame. If the judgment is "yes", it goes to step S503, and if the judgment is "no", it goes to step S512.
[0207] It is understandable that the presence of a Bitmap drawing instruction does not mean that there is a bullet comment at this time, and the parameters of the Bitmap drawing instruction must be compared.
[0208] Step S503: Whether the count value of the counter is less than 3.
[0209] It is determined whether the count value of the counter is less than 3, that is, whether the count value of the counter has reached the set threshold. If the count value of the counter is less than 3, the process proceeds to step S504; if the count value of the counter is not less than 3, that is, equal to 3, the process proceeds to step S513.
[0210] Step S504: Add 1 to the count value of the counter.
[0211] Step S505: Whether the count value of the counter is equal to 3.
[0212] Determine whether the count value of the counter is equal to 3; if the count value of the counter is 3, it means that there are 3 frames with Bitmap drawing instructions in the existing frames, and go to step S506; if the count value of the counter is not 3, it means that there are not 3 frames with Bitmap drawing instructions in the existing frames, and go to step S508.
[0213] Step S506: Start the analysis instruction flow, initialize the drawing instruction saver D, and initialize the valid comparison flag E to false
[0214] The analysis instruction flow is started, and the drawing instruction storage D is initialized, and the effective comparison flag E is initialized to false; then the process goes to step S507.
[0215] Step S507: Next frame enters Figure 7C The judgment process in .
[0216] Step S508: The timing value of timer A is reduced by 1.
[0217] The count value of the counter is not 3, which means that there are no 3 frames with Bitmap drawing instructions in the existing frames. The timing value of timer A is reduced by 1, and then the process goes to S509.
[0218] Step S509: Whether the timing value of timer A is equal to "0".
[0219] Determine whether the timing value of timer A is equal to "0". If the timing value of timer A is equal to "0", it means that 10 frames have been run and there are no 3 frames with Bitmap drawing instructions in the 10 frames, and go to step S510. If the timing value of timer A is not equal to "0", it means that 10 frames have not been run yet and there are no 3 frames with Bitmap drawing instructions in the existing frames, then go to the next frame and continue back to S501.
[0220] Step S510: Initialize the timing values of timer A and timer B, and the count value of the counter.
[0221] The scenario at this time is that 10 frames have been run, and less than 3 frames in the 10 frames have bullet comments. The timing values of all timers and the count values of counters are initialized, that is, S500, and then the next frame is entered, and then it returns to S501.
[0222] Step S511: Enter the next frame and return to S501.
[0223] When the number of TextureView drawing controls is not 1, it means that the interface is not playing a video, and no subsequent judgment is performed. The process directly enters the next frame and returns to S501.
[0224] Step S512: Whether the count value of the counter is 0 or 3.
[0225] S502 concludes that there is no Bitmap instruction in the current frame, and enters S512. The count value of the counter in S512 is 0, which means that there has been no Bitmap drawing instruction in a frame so far. The count value of the counter in S512 is 3, which means that the instruction filtering process has been completed and it has been concluded that there is a bullet comment; at this time, enter S513, that is, Figure 7B The judgment process is to determine whether there is no Bitmap drawing instruction for 200 consecutive frames.
[0226] Step S513: Enter Figure 7B judgment process.
[0227] Specifically, Fig. 7AThe judgment is whether there are 3 frames with TextureView drawing controls set to 1 and Bitmap drawing instructions in 10 frames. When entering the video playback interface and there is a bullet screen in the first frame, the number of TextureView drawing controls drawn is 1, and there is a Bitmap drawing instruction, so go to S503; the count value of the counter is 0 and go to S504, and the count value of the counter is "added by 1", so the count value of the counter is 1, so go to S505. At this time, the value of the counter is not equal to 3, so go to S508. At this time, the timing value of timer A is reduced by 1 and becomes 39, so go to S509. At this time, the value of timer A is 39, not 0, so go to the next frame and return to S501. When the value of timer A is 0, go to S510, and the timing value of timer A is initialized to 10, the timing value of timer B is initialized to 200, the value of the counter is initialized to 0 (equivalent to S500), and go to the next frame and return to S501.
[0228] Figure 7B The following describes the judgment process of identifying "no bullet comments". Figure 7B The method of barrage recognition in the embodiment of the present application is introduced in detail. Figure 7B The bullet screen recognition method shown can be executed by an electronic device. The above steps are described in detail below.
[0229] Step S601: Whether there is a Bitmap drawing instruction in the current frame.
[0230] Determine whether there is a Bitmap drawing instruction; if there is a Bitmap drawing instruction, go to S605; if there is no Bitmap drawing instruction, go to step S602.
[0231] Step S602: Subtract 1 from the timing value of timer B.
[0232] Step S603: Is the timing value of timer B 0?
[0233] Determine whether the timing value of timer B is 0; if the value of timer B is 0, proceed to step S604; if the value of timer B is not 0, proceed to the judgment of the next frame and return to step S501.
[0234] Step S604: Mark as no bullet screen, initialize the timing values of all timers and the count values of counters
[0235] Initialize the timing values of all timers and the count values of counters (equivalent to S501), and enter the judgment of the next frame, that is, S501.
[0236] Step S605: Initialize the timing value of timer B.
[0237] Specifically, Figure 7B Determine whether there are no Bitmap drawing instructions for 200 consecutive frames. It is understandable that, for the sake of system power consumption, not every 10 frames have 3 frames with 1 TextureView drawing control and a Bitmap drawing instruction, and all of them need to enter Figure 7C In the filtering analysis process in; such as S503 and S512, when the counter counts 3, that is, 3 frames in 10 frames have TextureView drawing controls with the number of 1 and Bitmap drawing instructions, and the instruction filtering process is completed, it is concluded that there is a bullet comment, regardless of whether the next frame has a Bitmap drawing instruction, it will enter Figure 7B The judgment process in is whether there is no Bitmap drawing instruction for 200 consecutive frames.
[0238] Figure 7C The judgment process of instruction analysis is described in detail. Figure 7C The instruction analysis process of the embodiment of the present application is introduced in detail. Figure 7C The bullet screen recognition method shown can be executed by an electronic device. The above steps are described in detail below.
[0239] Step S701: Subtract 1 from the timing value of timer C.
[0240] The initial value of timer C is 10, and after 10 is “subtracted by 1”, the process goes to step S702.
[0241] Step S702: Whether the timing value of timer C is less than 0.
[0242] Determine whether the timing value of timer C is less than 0; if the timing value of timer C is less than 0, go to step S707; if the timing value of timer C is not less than 0, go to step S703.
[0243] Step S703: Enter Fig.7D Instruction filtering process in
[0244] When it is determined in S702 that the timing value of timer C is not less than 0, enter Fig.7D The instruction filtering process in .
[0245] Step S704: Check whether the timing value of timer C is zero, D is not empty, and the valid comparison flag E is true.
[0246] go through Fig.7DAfter the instruction filtering process in, determine whether the timing value of timer C is zero, D is not empty, and the valid comparison flag E is true; if the timing value of timer C is zero, D is not empty, and the valid comparison flag E is true, enter S706; if the timing value of timer C is not zero, or D is empty, or the valid comparison flag E is false, as long as one of the conditions is met, enter S705.
[0247] Step S705: Enter the next frame and return to S701.
[0248] Step S706: The barrage is marked and the analysis process is completed.
[0249] Step S707: Initialize the timing values of all timers, the counting values of all counters, the storage devices, and the comparison flags.
[0250] Initialize the timing values of all timers and the counting values of counters (equivalent to S501), and enter S708.
[0251] Step S708: Enter the second frame, that is, continue back to S501.
[0252] It is understandable that if Figure 5 As described in step S217, when the bullet comment recognition module enters the instruction analysis process, it will notify the drawing instruction set to record the parameter information of the next frame of drawing instructions, otherwise it will not record.
[0253] Fig.7D The specific judgment process of instruction filtering is described in detail. Fig.7D The specific judgment process of the instruction filtering process of the embodiment of the present application is introduced in detail. Fig.7D The bullet screen recognition method shown can be executed by an electronic device. The above steps are described in detail below.
[0254] Step S801: Check whether the drawing instruction storage D is empty.
[0255] Determine whether the drawing instruction storage D is empty; if the drawing instruction storage D is empty, go to step S802; if the drawing instruction storage D is not empty, go to step S803.
[0256] Step S802: Save the drawing instruction of the current frame into D, and mark the valid comparison flag E as false.
[0257] It can be understood that the drawing instruction storage D stores relevant parameters of the drawing instructions, wherein the instructions include bullet screen instructions, icon instructions, etc.
[0258] Step S803: Check whether there is a drawing instruction in the current frame.
[0259] Determine whether there is a drawing instruction in the current frame; if there is a drawing instruction in the current frame, enter S804; if there is no drawing instruction in the current frame, enter S705, that is, the next frame, and return to S701. It can be understood that the judgment of S803 does not conflict with the judgment of S502. S803 is Fig. 7A On the premise that it has been determined that 3 of the 10 frames have Bitmap instructions, the subsequent frames are judged.
[0260] Step S804: Compare the drawing instructions stored in the drawing instruction storage D with all the drawing instructions of the current frame one by one
[0261] The parameters of the drawing instructions stored in the drawing instruction storage D are compared with the parameters of all the drawing instructions of the current frame, and then the process goes to step S805.
[0262] Step S805: whether there are drawing instruction parameters in the current frame and the drawing instruction parameters stored in the drawing instruction storage D that meet the conditions that the length and width are equal, the upper left corner horizontal coordinate decreases, and the vertical coordinate remains unchanged.
[0263] If the parameters of the drawing instruction in the current frame and the parameters of the drawing instruction specified in D satisfy the conditions that the length and width are equal, the upper left corner horizontal coordinate decreases, and the vertical coordinate remains unchanged, enter S806; if the parameters of the drawing instruction in the current frame and the parameters of the drawing instruction specified in D satisfy the conditions that the length and width are equal, the upper left corner horizontal coordinate decreases, and the vertical coordinate remains unchanged, enter S808. It can be understood that what is judged here is whether the bullet message moves from right to left; according to the direction of movement of the bullet message and whether the screen is horizontal or vertical, the judgment criteria of the drawing instruction parameters are inconsistent.
[0264] It can be understood that there are multiple instructions in one frame, and each instruction has multiple parameter items.
[0265] Step S806: retain the instructions that meet the conditions in the drawing instruction storage D, and mark the effective comparison flag E as true.
[0266] It can be understood that what is saved in S806 are the instructions in the current frame that meet the judgment condition in S805, and the instructions previously saved in the drawing instruction storage D are deleted.
[0267] Step S807: End the filtering process.
[0268] Step S808: discarding the instructions in the drawing instruction storage D that do not meet the conditions in S805.
[0269] The instructions in the drawing instruction storage D that do not meet the condition in S805 are discarded, and the process goes to S807. It is understandable that there are more than one instructions for a certain frame stored in the drawing instruction storage D, and the instructions in the drawing instruction storage D that do not meet the judgment condition in S805 are discarded at this time.
[0270] Fig. 7A Determine whether there are 3 frames in 10 frames with Bitmap drawing instructions; Figure 7B Determine whether there is no Bitmap drawing instruction for 200 consecutive frames; Figure 7C Under the premise of judging whether there are Bitmap drawing instructions in 3 frames out of 10 frames, start the analysis instruction process to enter Fig.7D . Fig.7D Determine whether there are two instructions in the previous and next frames in the 10 frames whose parameters meet the conditions that the length and width are equal, the horizontal coordinate of the upper left corner decreases, and the vertical coordinate remains unchanged.
[0271] Specifically, after detecting that there are 3 frames with Bitmap drawing instructions within 10 frames, that is, the value of the counter is 3 at this time, reaching the threshold, and entering step S506, starting the analysis instruction process, initializing the drawing instruction saver D, and initializing the valid comparison flag E to false; then entering the next frame (set to "Nth frame"), entering step S701; in step S701, the timing value of timer C becomes 9, which is greater than 0, and entering step S703, that is, Fig.7D In the instruction analysis process in, the drawing instruction storage D is empty at this time, and the process goes to step S802, saves the drawing instruction of the Nth frame to D, and marks the effective comparison mark E as false, and then goes to step S704; at this time, the effective comparison mark E is false, and the process goes to step S705, and returns to step S701; the process goes to the judgment of the next frame (set as "N+1th frame"). In step S701, the timing value of timer C becomes 8, which is greater than 0, and the process goes to step S703, that is, Fig.7DIn the instruction analysis process in, the drawing instructions of the Nth frame have been saved to D, and the drawing instruction saver D is not empty, and the process goes to step S803. Assume that there is a Bitmap drawing instruction in the Nth frame, which includes three drawing instructions, and its parameters can be "width, height, X-axis coordinate, Y-axis coordinate". The parameters of the first instruction are [50,50,100,100], the parameters of the second instruction are [50,50,120,90], and the parameters of the third instruction are [50,60,50,50]; Assume that there is also a Bitmap drawing instruction in the N+1th frame, and the parameters of the three drawing instructions of the N+1th frame are also "width, height, X-axis coordinate, Y-axis coordinate", the first instruction The parameters of the first instruction are [50,50,90,100], the parameters of the second instruction are [50,50,110,90], and the parameters of the third instruction are [50,60,50,50]; in step S804, the "parameters of the drawing instruction of the Nth frame" are compared with the "parameters of the drawing instruction of the N+1th frame", that is, the judgment in step S805 is performed to determine whether the "parameters of the drawing instruction in the N+1th frame" meet the conditions of equal length and width, reduced upper left corner horizontal coordinate, and unchanged vertical coordinate relative to the "parameters of the drawing instruction in the Nth frame". It can be seen that the first and second instructions in the Nth frame and the first and second instructions in the N+1th frame meet the above comparison criteria, while the third instruction in the Nth frame and the third instruction in the N+1th frame do not meet the above criteria.
[0272] Therefore, according to step S808, the third instruction saved in the drawing instruction holder D is discarded, and according to step S806, the instruction in the current frame that meets the judgment condition of step S805 replaces the instruction previously saved in the drawing instruction holder D and the valid comparison flag E is marked as true; at this time, the instructions saved in the drawing instruction holder D are: [50,50,90,100], [50,50,110,90]; then enters step S807.
[0273] It is understandable that if there is no Bitmap drawing instruction in the Nth frame, the content stored in the drawing instruction storage D is empty, and then the process goes to step S705, enters the judgment of the next frame, and returns to S701. If there is a Bitmap drawing instruction in the Nth frame, but there is no Bitmap drawing instruction in the N+1th frame, the process also goes to the judgment of the next frame and returns to S701.
[0274] It is understandable that this embodiment does not limit the timing value of timer A, the timing value of timer B, the timing value of timer C, and the threshold of the counter. In order to ensure the accuracy and expectation of method identification, in other embodiments, the values of the timer and the counter can be selected according to the characteristics of the application; the initial timing value of timer A can be set to 0, and the threshold of timer A can be set in the process, and the same can be applied to timer B, timer C, and counter.
[0275] It is understandable that the process illustrated in the embodiment of the present invention does not constitute a specific limitation on the process of bullet screen recognition. In other embodiments of the present application, the process of bullet screen recognition may include more or less than the illustrated process, or be combined with other processes, or split some processes, or the order of the processes may be different.
[0276] Figure 8 The matching process of the judgment logic is shown. Figure 8 As shown, it mainly includes the following steps:
[0277] Step S901: Enter the video playback interface.
[0278] The electronic device receives the user operation, responds to the user operation, starts the video application, presents the video playback interface, and starts playing the video. It is understandable that some video applications play the video immediately after starting, and some video applications require the user to click again after starting to play the video. This application is not limited to this.
[0279] Step S902: Identify the types of video and bullet screen drawing controls.
[0280] When entering the video playback interface, the electronic device identifies the Activity (ie, layer) of the video application, identifies the video application according to the Activity of the video application, and matches the judgment method according to the types of the video drawing control and the bullet screen drawing control of the video application.
[0281] It is understood that an Activity is a window that provides a drawing interface to an application. This window usually fills the screen and floats on other windows. Usually, an Activity implements a window in an application. For example, an Activity in an application implements the "Preferences" screen, while another Activity implements the "Select Photo" window. By identifying the Activity of an application, the application can be identified.
[0282] Step S903: Identify whether there is a bullet comment on the interface.
[0283] According to step S902, the category of the application is obtained, so that a bullet screen recognition method is selected according to the types of the video drawing control and the bullet screen drawing control of the application, and the bullet screen information of the current interface is recognized according to the bullet screen recognition method.
[0284] Step S904: Adjust the screen refresh rate.
[0285] The electronic device adjusts the refresh rate according to the recognized bullet message information. It is understandable that the bullet message information is only one consideration for the electronic device to adjust the refresh rate.
[0286] In a possible implementation, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, which is not specifically limited in the embodiments of the present application.
[0287] The refresh rate adjustment device provided in the embodiment of the present application is used to execute the method for adjusting the refresh rate in the above embodiment. The technical principle and technical effect are similar and will not be repeated here.
[0288] The present application embodiment provides an electronic device, the structure of which is shown in FIG. Figure 1 The memory of the electronic device can be used to store at least one program instruction, and the processor can be used to execute at least one program instruction to implement the technical solution of the above method embodiment. Its implementation principle and technical effect are similar to those of the above method related embodiments, and will not be repeated here.
[0289] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.
[0290] The embodiment of the present application provides a computer program product, when the computer program product is run on an electronic device, the electronic device executes the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.
[0291] The embodiment of the present application provides a computer-readable storage medium on which program instructions are stored. When the program instructions are executed by an electronic device, the electronic device executes the technical solution of the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.
[0292] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0293] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for adjusting a screen refresh rate, characterized in that: Applied to an electronic device, the electronic device is installed with a first video application, the method includes: After starting the first video application, playing the first video; the bullet screen control of the first video application is set to be closed; Acquire the first frame data of the first video, and when the number of drawing controls in the first frame data is less than a first preset value, count the first frame data, and when the count value of the first frame data reaches a second preset value, display it at a first refresh rate; After using the first refresh rate for display, receiving a first operation of the user on the first video application, the first operation is used to turn on the barrage control, obtaining second frame data of the first video, and when the number of drawn controls in the second frame data is not less than the first preset value, counting the second frame data, and when the count value of the second frame data reaches a third preset value, using the second refresh rate for display; the second refresh rate is greater than the first refresh rate.
2. The method for adjusting screen refresh rate according to claim 1, characterized in that: After the first video application is started, the method further includes: Identify the types of the video drawing control and the bullet screen drawing control of the first video application.
3. The method for adjusting screen refresh rate according to claim 2, characterized in that: The method further comprises: If the video drawing control and bullet screen drawing control of the first video application identified are both of TextureView type, when the number of drawing controls in the first frame data is less than a first preset value, the first frame data is counted, and when the count value of the first frame data reaches a second preset value, the first refresh rate is used for display.
4. The method for adjusting screen refresh rate according to claim 3, characterized in that: The method further comprises: When the number of drawing controls in the second frame data is not less than a first preset value, the second frame data is counted, and when the count value of the second frame data reaches a third preset value, the second refresh rate is used for display.
5. The method for adjusting screen refresh rate according to claim 2, characterized in that: The method further comprises: If the video of the first video application identified is drawn using a TextureView type drawing control and the barrage is drawn using a Bitmap type drawing instruction, when the number of drawing controls in the first frame data is less than a first preset value, the first frame data is counted, and when the count value of the first frame data reaches a second preset value, the first refresh rate is used for display.
6. The method for adjusting screen refresh rate according to claim 3, characterized in that: The method further comprises: When the number of drawing controls in the second frame data is not less than the first preset value, and the number of Bitmap type drawing instructions is greater than the fourth preset value, the second frame data is counted, and when the count value of the second frame data is equal to the fifth preset value, the count value of the second frame data is initialized; the second frame data of the first video is obtained, and when the number of drawing controls in the second frame data is not less than the first preset value, and the number of Bitmap type drawing instructions in the second frame data of the first video is greater than the fourth preset value, the second frame data is counted again, and the drawing instruction parameters in the second frame data are saved.
7. The method for adjusting screen refresh rate according to claim 6, characterized in that: When the count value of the second frame data is equal to a fifth preset value, the method further includes: Acquire the second frame data of the first video, identify that the number of drawing controls of the second frame data is not less than a first preset value, and the number of Bitmap type drawing instructions of the second frame data of the first video is greater than a fourth preset value, and when the parameters of the drawing instructions in the second frame data and the parameters of the drawing instructions in the saved second frame data meet the conditions that the length and width are equal, the horizontal coordinate of the upper left corner decreases, and the vertical coordinate remains unchanged, save the parameters of the drawing instructions that meet the conditions that the length and width are equal, the horizontal coordinate of the upper left corner decreases, and the vertical coordinate remains unchanged; and display at a second refresh rate.
8. The method for adjusting screen refresh rate according to claim 2, characterized in that: The method further comprises: If the video drawing controls and bullet screen drawing controls of the first video application identified are both of SurfaceView type, identify the number of layers of the first video application, and if the number of layers is the sixth preset value, use the first refresh rate for display; if the number of layers is the seventh preset value, use the second refresh rate for display.
9. The method for adjusting screen refresh rate according to claim 1, characterized in that: In the process of counting the first frame data, the method includes: If the second frame data in which the number of drawing controls is not less than the first preset value is acquired, the count value of the first frame data is initialized until the count value of the first frame data reaches the second preset value.
10. The method for adjusting screen refresh rate according to claim 1, characterized in that: In the process of acquiring the first frame data or the second frame data of the first video, the method further includes: When the sum of the count value of the first frame data of the first video and the count value of the second frame data reaches an eighth preset value, and the count value of the second frame data does not reach a third preset value, the third preset value and the eighth preset value are initialized.
11. The method for adjusting screen refresh rate according to claim 1, characterized in that: After the first video application is started, the method further includes: In response to a third operation by the user, the first video is played.
12. The method for adjusting screen refresh rate according to claim 1, characterized in that: The second operation is clicking on a bullet screen control included in the display interface; In response to the user's second operation, the bullet screen control is triggered to open.
13. The method for adjusting screen refresh rate according to claim 1, characterized in that: In response to a user clicking in the electronic device, the refresh rate of the display interface is adjusted to a third refresh rate, where the third refresh rate is different from the first refresh rate and the second refresh rate.
14. The method for adjusting screen refresh rate according to claim 1, characterized in that: After the first video application is started, the electronic device is adjusted to a fourth refresh rate according to the configuration, wherein the fourth refresh rate is different from the first refresh rate, the second refresh rate and the third refresh rate.
15. The method for adjusting screen refresh rate according to claim 13 or 14, characterized in that: The first refresh rate, the second refresh rate, the third refresh rate and the fourth refresh rate range from 0 Hz to 120 Hz.
16. An electronic device, characterized in that: When the computer readable code is executed in an electronic device, the electronic device is enabled to implement the method according to any one of claims 1 to 15.
17. A computer program product, characterized in that The invention comprises a computer readable code, and when the computer readable code is executed in an electronic device, the electronic device implements the method according to any one of claims 1 to 15.
18. A chip system, characterized in that: The chip system includes a processor, and the processor calls computer instructions to execute the following steps: Obtain first frame data of a first video, wherein the first video comes from a first video application, and when the number of drawing controls in the first frame data is less than a first preset value, count the first frame data, and when the count value of the first frame data reaches a second preset value, send a first display instruction without barrage; obtain second frame data of the first video, and when the number of drawing controls in the second frame data is not less than the first preset value, count the second frame data, and when the count value of the second frame data reaches a third preset value, send a second display instruction with barrage, and the refresh rate corresponding to the first display instruction is less than the refresh rate corresponding to the second display instruction.
19. The chip system according to claim 18, characterized in that: In response to a user clicking on the electronic device, a refresh rate adjustment instruction is sent.
20. The chip system according to claim 19, characterized in that: If the video drawing control and bullet screen drawing control of the first video application identified are both of TextureView type, then when the number of drawing controls in the first frame data is less than a first preset value, the first frame data is counted, and when the count value of the first frame data reaches a second preset value, a first display instruction without bullet screen is sent.
21. The chip system according to claim 20, characterized in that: When the number of drawing controls in the second frame data is equal to a first preset value, the second frame data is counted, and when the count value of the second frame data reaches a third preset value, a second display instruction with a bullet screen is sent.
22. The chip system according to claim 19, characterized in that: If the video of the first video application identified is drawn using a TextureView type drawing control and the barrage is drawn using a Bitmap type drawing instruction, when the number of drawing controls in the first frame data is less than a first preset value, the first frame data is counted, and when the count value of the first frame data reaches a second preset value, a first display instruction without barrage is sent.
23. The chip system according to claim 22, characterized in that: When the number of drawing controls in the second frame data is not less than the first preset value, and the number of Bitmap type drawing instructions is greater than the fourth preset value, counting the second frame data, and when the count value of the second frame data is equal to the fifth preset value, initializing the count value of the second frame data; Acquire the second frame data of the first video, and when the number of drawing controls of the second frame data is not less than a first preset value, and the number of Bitmap type drawing instructions of the second frame data of the first video is greater than a fourth preset value, count the second frame data again, and save the drawing instruction parameters in the second frame data; Obtain the second frame data of the first video, identify that the number of drawing controls of the second frame data is not less than a first preset value, and the number of Bitmap type drawing instructions of the second frame data of the first video is greater than a fourth preset value, when the parameters of the drawing instructions in the second frame data and the parameters of the drawing instructions in the saved second frame data meet the conditions that the length and width are equal, the horizontal coordinate of the upper left corner decreases, and the vertical coordinate remains unchanged, save the parameters of the drawing instructions in the second frame data that meet the conditions that the length and width are equal, the horizontal coordinate of the upper left corner decreases, and the vertical coordinate remains unchanged; and send a second display instruction with a barrage.
Citation Information
Patent Citations
Bullet screen rendering method and device, computer equipment and storage medium
CN111586489A
Refresh rate adjusting method and electronic equipment
CN113438552A
Refresh rate setting method and related equipment
CN114205673A
Refresh rate setting method and related equipment
CN114245208A