WO2021244666A1 - 视频播放的控制方法、装置、计算机设备和存储介质 - Google Patents

视频播放的控制方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2021244666A1
WO2021244666A1 PCT/CN2021/102067 CN2021102067W WO2021244666A1 WO 2021244666 A1 WO2021244666 A1 WO 2021244666A1 CN 2021102067 W CN2021102067 W CN 2021102067W WO 2021244666 A1 WO2021244666 A1 WO 2021244666A1
Authority
WO
WIPO (PCT)
Prior art keywords
synchronization signal
screen refresh
screen
current
application process
Prior art date
Application number
PCT/CN2021/102067
Other languages
English (en)
French (fr)
Inventor
黄南燕
Original Assignee
深圳市万普拉斯科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市万普拉斯科技有限公司 filed Critical 深圳市万普拉斯科技有限公司
Priority to US17/407,189 priority Critical patent/US20220060607A1/en
Publication of WO2021244666A1 publication Critical patent/WO2021244666A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/04Synchronising
    • H04N5/06Generation of synchronising signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/443OS processes, e.g. booting an STB, implementing a Java virtual machine in an STB or power management in an STB
    • H04N21/4436Power management, e.g. shutting down unused components of the receiver
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/414Specialised client platforms, e.g. receiver in car or embedded in a mobile appliance
    • H04N21/41407Specialised client platforms, e.g. receiver in car or embedded in a mobile appliance embedded in a portable device, e.g. video client on a mobile phone, PDA, laptop
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440281Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the temporal resolution, e.g. by frame skipping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44213Monitoring of end-user related data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/458Scheduling content for creating a personalised stream, e.g. by combining a locally stored advertisement with an incoming stream; Updating operations, e.g. for OS modules ; time-related management operations
    • H04N21/4586Content update operation triggered locally, e.g. by comparing the version of software modules in a DVB carousel to the version stored locally
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/47217End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for controlling playback functions for recorded or on-demand content, e.g. using progress bars, mode or play-point indicators or bookmarks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application relates to the field of computer technology, and in particular to a method, device, computer equipment, and storage medium for controlling video playback.
  • a method for controlling video playback includes:
  • the main thread is triggered to refresh the current video screen.
  • the dynamically adjusting the signal receiving frequency of the application program and receiving the screen refresh synchronization signal distributed by the hardware layer according to the signal receiving frequency includes:
  • the frame function is called to send a message to the main thread, and the main thread is triggered to render the current video screen.
  • the method further includes:
  • the application program is allowed to receive the screen refresh synchronization signal distributed by the hardware layer.
  • the judging whether to allow the application program to receive the screen refresh synchronization signal distributed by the hardware layer according to the changed state of the preset flag bit includes:
  • the method further includes:
  • the detecting that there is a barrage message in the current application process includes:
  • the screen refresh rate corresponding to the current application process is calculated
  • the screen refresh rate it is determined whether to add the delay time to refresh the barrage message in the current video screen.
  • the method further includes:
  • the screen refresh synchronization signal is filtered according to the preset configuration parameters to obtain the screen refresh synchronization signal after the screening;
  • the frame function is called to send a message to the main thread, and the main thread is triggered to refresh the current barrage message.
  • a video playback control device includes:
  • the monitoring module is used to monitor the status of the current application process when the application is playing a video
  • the obtaining module is used to obtain the state of the current application process, including the presence and absence of a trigger event state;
  • the detection module is used to dynamically adjust the signal receiving frequency of the application program when it is detected that there is no trigger event in the current application process, and receive the screen refresh synchronization signal distributed by the hardware layer according to the signal receiving frequency; When there is a trigger event in the current application process, resume the application to receive the screen refresh synchronization signal distributed by the hardware layer at the original frequency;
  • the refresh module is used to trigger the main thread to refresh the current video screen according to the received screen refresh synchronization signal.
  • a computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when the computer program is executed:
  • the main thread is triggered to refresh the current video screen.
  • the main thread is triggered to refresh the current video screen.
  • the above-mentioned video playback control method, device, computer equipment and storage medium monitor the current status of the application process when the application program plays the video.
  • the current application process status is obtained, including the trigger event status and the non-existent trigger event status.
  • the signal receiving frequency of the application program is dynamically adjusted, and the screen refresh synchronization signal distributed by the hardware layer is received according to the adjusted signal receiving frequency. According to the received screen refresh synchronization signal, the main thread is triggered to refresh the current video screen.
  • the recovery application receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, and according to the received screen refresh synchronization signal, triggers the main thread to refresh the current video screen.
  • the corresponding signal receiving frequency is dynamically adjusted; when a trigger event is detected in the current application process, the application is resumed
  • the program receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, that is, by dynamically adjusting the software refresh rate, it effectively solves the power consumption problem of maintaining the high refresh rate of the screen hardware in the traditional way, and can ensure the smoothness of the operation interface. It can effectively reduce power consumption.
  • FIG. 1 is a schematic flowchart of a method for controlling video playback in an embodiment
  • FIG. 2 is a schematic flowchart of a step of dynamically adjusting the signal receiving frequency of an application program in an embodiment
  • FIG. 3 is a schematic flowchart of a step of triggering a state change of a preset flag bit in an embodiment
  • FIG. 4 is a schematic flow chart of the steps of calling a function program to calculate the delay time corresponding to the barrage message in an embodiment
  • Figure 5 is a structural block diagram of a video playback control device in an embodiment
  • Fig. 6 is an internal structure diagram of a computer device in an embodiment.
  • a method for controlling video playback uses this method to be applied to a terminal as an example.
  • the terminal can be, but not limited to, various personal computers, notebook computers, and smart Mobile phones, tablets and portable wearable devices. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server.
  • the method includes the following steps:
  • Step 102 When the application program plays a video, monitor the state of the current application process.
  • Mobile terminals are a type of embedded computer system equipment, and the software structure can be divided into system software and application software.
  • the system software is mainly operating system and middleware.
  • Common mobile terminal operating systems include Apple's IOS, Google's Android, HP's WebOS, open source MeeGo, and Microsoft Windows. Users of mobile terminals with different operating systems can download multiple types of video playback applications through the application market interface in the mobile terminal.
  • current common video playback applications include but are not limited to Bilibili animation, Douyu live broadcast, Both Huya Live and iQiyi support the function of barrage messages.
  • the user can click on a specific video playback application in the main interface of the mobile terminal device to start the application and enter the page corresponding to the video playback application.
  • the aforementioned application process establishes a connection with the system service program (SurfaceFlinger) through a socket (socket) during the startup process.
  • Socket (socket) is an abstraction layer through which applications can send or receive data.
  • the mobile terminal monitors the status of the current application process through a screen hardware driver or a button driver. That is, the real-time status of the current application process is monitored through the screen hardware driver or the button driver, and reported to the corresponding listener (InputReader in the Android system).
  • Step 104 Obtain the current status of the application process, including the presence and absence of a trigger event state.
  • the status of the current application process is monitored in real time through the screen hardware driver or the button driver.
  • the mobile terminal obtains the corresponding state when the current application is playing the video, including the state where the trigger event exists and the state where the trigger event does not exist.
  • the user clicks on a specific video playback application in the main interface of the mobile terminal device starts the application, and enters the page corresponding to the application.
  • the user can perform a series of menu operations on the currently played video. For example, the user can control the progress of the current video playback screen by clicking the fast forward or pause button in the current video playback interface.
  • the user can also control the brightness and volume of the current video playback screen by sliding the brightness adjustment and sound adjustment icons in the current video playback interface. That is, when the application program plays a video, the mobile terminal monitors the current application process status through the screen hardware driver or the button driver. When the mobile terminal detects that the user touches the screen or presses a physical button, it recognizes that the current application process is in a trigger event state, and reports the trigger event to the corresponding listener, so that the system service program can meet the different requirements of the trigger event Distributed to the corresponding process.
  • the trigger event in the mobile terminal can include a click event (click event), touch event (touch type event), touch event (tap type event), and sliding event (swipe type event) And so on, that is, the user can perform a series of menu operations on the video currently played by the application, such as adjusting the video playback speed, sending real-time barrage messages, and so on.
  • Step 106 When it is detected that there is no trigger event in the current application process, the signal receiving frequency of the application program is dynamically adjusted, and the screen refresh synchronization signal distributed by the hardware layer is received according to the signal receiving frequency.
  • the status of the current application process is monitored in real time through the screen hardware driver or the button driver.
  • the mobile terminal detects that there is no trigger event in the current application process through the screen hardware driver or the button driver, it monitors whether the current application process receives the input event through the DynamicVsyncHelper control in the Android system.
  • the terminal dynamically adjusts the signal receiving frequency of the current application program, and receives the screen refresh synchronization signal distributed by the hardware layer according to the adjusted signal receiving frequency, that is, the terminal has a policy to restrict the current application program reception
  • the number of screen refresh synchronization signals distributed by the hardware layer thereby limiting the software screen refresh rate corresponding to the application.
  • GPU is the image processing chip, also known as the display core, visual processor, and display chip. GPU usually has a mechanism called vertical synchronization (V-Sync). When the vertical synchronization is turned on, the GPU will wait for the Vsync signal of the display to be sent. , A new frame rendering and buffer update are performed.
  • the screen refresh process is from left to right (line refresh, horizontal refresh, Horizontal Scanning) and top to bottom (screen refresh, vertical refresh, Vertical Scanning) for each row.
  • the V in the Vsync signal refers to the vertical /Vertical in the vertical refresh
  • the screen refresh synchronization signal is the Vsync signal.
  • the terminal limits the signal reception frequency of the current application program, and receives the screen refresh synchronization signal distributed by the hardware layer according to the restricted signal reception frequency, so that The terminal can change the refresh rate of the current software screen by adjusting the number of times it receives the screen refresh synchronization signal (Vsync signal) per frame.
  • the video frame rate is determined by the interval of the synchronization signal (Vsync signal) of the software screen refresh.
  • the above-mentioned application receives the software Vsync signal from the system service (SurfaceFlinger) through the socket interface (socket), that is, the screen refreshes. Sync signal.
  • the clock signal of the hardware screen is generated by the hardware screen, processed by HWComposer, and distributed to SurfaceFlinger, and finally distributed to the application.
  • the screen refresh rate (FPS Frames Per Second) is the number of frames transmitted per second of the screen, which is generally the number of frames of animation or video.
  • FPS is a measure of the amount of information used to save and display dynamic videos. The more frames per second, the smoother the displayed action will be.
  • the software screen refresh rate that is, the number of times the software is drawn per second, that is, the number of times the Vsync signal is received.
  • the terminal can dynamically adjust the application to receive the screen refresh synchronization signal distributed by the hardware layer, that is, the terminal can adjust the signal receiving frequency of the application, that is, adjust the application to receive the screen refresh
  • the number of synchronization signals for example, the terminal can set interception in the configuration file in advance or skip the screen refresh synchronization signal (Vsync signal) every other frame, then the refresh rate corresponding to the current software screen can be changed, and the current software screen refresh rate can be limited Refresh the screen within the preset value range.
  • the Vsync signal can be dropped every other frame by pre-setting the flag in the configuration file, and the terminal adjusts the above application
  • the signal receiving frequency is 60Hz, that is, the number of times the terminal receives the screen refresh synchronization signal according to the above signal receiving frequency is 60 video screen refreshes per second, that is, the current software screen refresh rate is adjusted from 120Hz to 60Hz.
  • the application process establishes a connection with the system service program (SurfaceFlinger) through the abstract layer Socket during the startup process, and the system service program distributes the Vsync signal to the application process through the abstract layer Socket.
  • the application process uses the DynamicVsyncHelper control to determine whether there is an Input event according to the current state of the application, so as to decide whether to ignore the Vsync signal.
  • the mobile terminal detects that there is no trigger event in the current application process through the DynamicVsyncHelper control, the terminal ignores this Vsync signal and waits to receive the next Vsync signal.
  • the mobile terminal can trigger the main thread to refresh the current video screen according to the next Vsync signal received.
  • Step 108 When a trigger event is detected in the current application process, the recovery application program receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency.
  • the status of the current application process is monitored in real time through the screen hardware driver or the button driver.
  • the mobile terminal detects that there is a trigger event in the current application process through the screen hardware driver or the button driver, it monitors whether the current application process receives the input event through the DynamicVsyncHelper control in the Android system.
  • the terminal When there is an input event, that is, the user is currently in When an operation is performed in the application program interface, the terminal resumes that the current application program receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, that is, the terminal stops limiting the number of times the application program receives the screen refresh synchronization signal distributed by the hardware layer, thereby restoring the original
  • the software screen refresh rate allows the current application to receive all screen refresh synchronization signals distributed by the hardware layer at the original frequency.
  • Step 110 Trigger the main thread to refresh the current video screen according to the received screen refresh synchronization signal.
  • the status of the current application process is monitored in real time through the screen hardware driver or the button driver.
  • the mobile terminal detects that there is no trigger event in the current application process through the screen hardware driver or the button driver, it monitors whether the current application process receives the input event through the DynamicVsyncHelper control in the Android system.
  • the terminal dynamically adjusts the signal reception frequency of the current application program, and receives the screen refresh synchronization signal distributed by the hardware layer according to the adjusted signal reception frequency, and the terminal according to the received screen refresh synchronization signal , Trigger the main thread to refresh the current video screen.
  • the mobile terminal When the mobile terminal detects that there is a trigger event in the current application process through the screen hardware driver or the button driver, that is, when the input event in the current application process is monitored through the DynamicVsyncHelper control in the Android system, that is, the user is currently performing in the application program interface
  • the terminal resumes that the current application program receives all screen refresh synchronization signals distributed by the hardware layer at the original frequency, that is, the terminal stops limiting the number of times the application program receives the screen refresh synchronization signals distributed by the hardware layer, and restores the original software screen refresh rate. Allow the current application to receive all screen refresh synchronization signals distributed by the hardware layer at the original frequency.
  • the terminal triggers the main thread to refresh the current video screen according to the received screen refresh synchronization signal.
  • the application process establishes a connection with the system service program (SurfaceFlinger) through the abstraction layer Socket during the startup process.
  • the system service program receives the Vsync signal sent from the hardware layer and performs the above Vsync signal. After encapsulation, it is distributed to the application process through the abstract layer Socket. After the application process receives the signal, the application process uses the pre-registered FrameDisplayEventReceiver interface to call back to trigger the drawing of the next frame.
  • the application main thread starts to perform the drawing-related operations of measure, layout, and draw.
  • the application program plays a video
  • the status of the current application process is monitored.
  • the current application process status is obtained, including the trigger event status and the non-existent trigger event status.
  • the signal receiving frequency of the application is dynamically adjusted
  • the screen refresh synchronization signal distributed by the hardware layer is received according to the adjusted signal receiving frequency
  • the screen refresh synchronization signal is triggered according to the received screen refresh synchronization signal.
  • the main thread refreshes the current video screen.
  • the recovery application receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, and according to the received screen refresh synchronization signal, triggers the main thread to refresh the current video screen.
  • the corresponding signal receiving frequency is dynamically adjusted; when a trigger event is detected in the current application process, the application is resumed
  • the program receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, that is, by dynamically adjusting the software refresh rate, it effectively solves the power consumption problem of maintaining the high refresh rate of the screen hardware in the traditional way, and can ensure the smoothness of the operation interface. It can effectively reduce power consumption.
  • the step of dynamically adjusting the signal receiving frequency of the application program includes:
  • step 202 the screen refresh synchronization signal is filtered according to the preset configuration parameters to obtain the screen refresh synchronization signal after the reduction.
  • Step 204 According to the screen refresh synchronization signal after the reduction, the frame function is called to send a message to the main thread, and the main thread is triggered to render the current video screen.
  • the status of the current application process is monitored in real time through the screen hardware driver or the button driver.
  • the terminal dynamically adjusts the signal receiving frequency of the current application program, and receives the screen refresh synchronization signal distributed by the hardware layer according to the adjusted signal receiving frequency .
  • the mobile terminal screens the screen refresh synchronization signal according to the preset configuration parameters, and obtains the screen refresh synchronization signal after the screening. .
  • the mobile terminal calls the frame function to send a message to the main thread according to the screen refresh synchronization signal after the screen is reduced, and triggers the main thread to render the current video screen.
  • the mobile terminal monitors the status of the current application process through the DynamicVsyncHelper control, and at the same time obtains the current interval of receiving the Vsync signal, that is, the refresh rate of the current software screen.
  • the mobile terminal screens the screen refresh synchronization signal according to the preset configuration parameters, and obtains the screen refresh synchronization signal after the screening.
  • the mobile terminal can set a flag bit in the configuration parameters in advance. Assuming that the refresh rate of the current software screen is 120Hz, the screen refresh synchronization signal is filtered through the change of the flag bit status to obtain the screen refresh synchronization after the screen reduction. Signal, that is, after filtering, the refresh rate of the current software screen can be adjusted from 120Hz to 60Hz. Further, the mobile terminal calls the pre-registered FrameDisplayEventReceiver function interface to call back to trigger the drawing of the next frame according to the screen refresh synchronization signal after the screen is reduced, and triggers the main thread to perform drawing-related operations on the current video image. This makes it possible to reduce the number of screen rendering and refreshes as much as possible while ensuring the fluency of the operation interface while ensuring the smoothness of the operation interface when the application is playing video, thereby effectively reducing power consumption and solving excessive power consumption. Big problem.
  • the method further includes the step of triggering the state change of the preset flag bit, which specifically includes:
  • Step 302 When the screen refresh synchronization signal sent by the hardware layer is received through the abstract layer interface, trigger a state change of the preset flag bit.
  • Step 304 Determine whether the application program is allowed to receive the screen refresh synchronization signal distributed by the hardware layer according to the state after the preset flag changes.
  • the application program When the application program receives the screen refresh synchronization signal distributed by the system service program (SurfaceFlinger) through the abstraction layer (Socket), it triggers the state change of the preset flag bit.
  • the mobile terminal determines whether the application program is allowed to receive the screen refresh synchronization signal distributed by the hardware layer next time according to the state after the preset flag changes. Specifically, when the application program receives the screen refresh synchronization signal distributed by the system service program (SurfaceFlinger) through the abstraction layer (Socket), it triggers the state change of the preset flag bit.
  • the step of judging whether to allow the application to receive the screen refresh synchronization signal distributed by the hardware layer according to the state after the preset flag is changed includes:
  • the application program When the application program receives the screen refresh synchronization signal distributed by the system service program (SurfaceFlinger) through the abstraction layer (Socket), it triggers the state change of the preset flag bit.
  • the screen refresh synchronization signal Vsync signal
  • the terminal When the state after the preset flag changes is zero, the terminal allows the application to receive the screen refresh synchronization signal distributed by the current hardware layer.
  • the screen refresh synchronization signal distributed by the current hardware layer is skipped, that is, the terminal intercepts the application program to receive the screen refresh synchronization signal distributed by the current hardware layer. For example, when the state after the preset flag changes is zero, the terminal allows the application program to receive the screen refresh synchronization signal distributed by the current hardware layer.
  • the terminal When the application is waiting to receive the next frame of screen refresh synchronization signal, when the terminal detects that the state after the preset flag is changed is not zero, assuming that when the terminal detects that the state after the preset flag changes is 1, the terminal passes The DynamicVsyncHelper control intercepts the screen refresh synchronization signal distributed by the current system service program, that is, skips the screen refresh synchronization signal. Only when the state of the flag bit meets the preset conditions, the flag bit will become true, allowing the application to receive the current hardware The screen refresh synchronization signal distributed by the layer.
  • the method when a trigger event is detected in the current application process, after the recovery application receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, the method further includes calling a function program to calculate The steps for the delay time corresponding to the barrage message specifically include:
  • Step 402 When it is detected that there is a barrage message in the current application process, the function program is called to calculate the delay time corresponding to the barrage message.
  • Step 404 Add a delay time every time the frame function is called back to trigger the main thread to refresh the barrage message in the current video screen.
  • the status of the current application process is monitored in real time through the screen hardware driver or the button driver.
  • the terminal detects that there is a trigger event in the current application process through the screen hardware driver or the key driver, the terminal resumes the application to receive the screen refresh synchronization signal distributed by the hardware layer at the original frequency.
  • the user can send a barrage message in real time to participate in the interaction.
  • the function program is called to calculate the delay time corresponding to the barrage message.
  • adding a delay time triggers the main thread to refresh the barrage message in the current video screen.
  • the speed of the barrage message is determined by the displacement distance of the barrage message after each refresh relative to the previous refresh.
  • the software refresh rate is not adjusted, it is assumed that the mobile terminal obtains the current software refresh rate of 120 Hz, that is, the movement distance of barrage messages per second is 120 unit distances.
  • the mobile terminal dynamically adjusts the software refresh rate to 60 Hz, the movement distance of the barrage per second is 60 unit distances, so that when the software refresh rate is dynamically adjusted, the speed of the barrage messages will be inconsistent.
  • the function program is called to calculate the delay time corresponding to the barrage message.
  • the mobile terminal gets the refresh rate of the last frame of screen at 120Hz.
  • the mobile terminal detects that there is a trigger event in the current application process, it will resume the application to receive all screen refresh synchronization signals distributed by the hardware layer at the original frequency, that is, mobile
  • the refresh rate of the current screen acquired by the terminal is 60 Hz.
  • the function program When the refresh rate is limited to 60Hz, call the function program to calculate the corresponding barrage period of 16.6ms per frame, when the refresh rate is restored to 120Hz, call the function program to calculate the corresponding barrage period of 8.3ms per frame, between the two
  • the cycle time difference is 8.3ms, that is, the delay time corresponding to the barrage message is calculated to be 8.3ms.
  • the barrage message is realized by registering the callback of FrameCallback with Choreographer every frame.
  • adding the above delay time triggers the main thread to refresh the barrage message in the current video screen. This makes it possible to dynamically choose whether to limit the barrage callback according to the current video playback frame rate.
  • By adding an appropriate delay time to each callback the problem of inconsistent barrage speed can be solved, even when the software refresh rate is dynamically adjusted. , It can also ensure the consistency and fluency of bullet screen messages.
  • the steps when it is detected that there is a barrage message in the current application process, the steps include:
  • the screen refresh rate corresponding to the current application process is calculated.
  • the screen refresh rate determine whether to add a delay time to refresh the barrage message in the current video screen.
  • the mobile terminal can obtain the time interval for the current application process to receive the screen refresh synchronization signal, that is, obtain the corresponding period of the current barrage message.
  • the mobile terminal can calculate the screen refresh rate corresponding to the current application process according to the time interval of the screen refresh synchronization signal.
  • the mobile terminal determines whether to add a delay time to refresh the barrage message in the current video screen according to the screen refresh rate corresponding to the current application process.
  • the mobile terminal determines that there is no need to add a delay time, and can directly control the pop-up in the current video screen.
  • the screen message is refreshed.
  • the mobile terminal determines that a delay time needs to be added to refresh the barrage message in the current video screen.
  • the refresh rate can ensure the consistency and fluency of the bullet screen message and the playback screen.
  • the method when a trigger event is detected in the current application process, after the recovery application receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency, the method further includes the step of refreshing the current barrage message, Specifically:
  • the screen refresh synchronization signal is filtered according to the preset configuration parameters, and the screen refresh synchronization signal after the filtering is obtained.
  • the frame function is called to send a message to the main thread, and the main thread is triggered to refresh the current barrage message.
  • the mobile terminal can also filter the screen refresh synchronization signal according to the preset configuration parameters to obtain The screen refreshes the sync signal after screening.
  • the mobile terminal calls the frame function to send a message to the main thread according to the screen refresh synchronization signal after the screen is reduced, and triggers the main thread to refresh the current barrage message. That is, by dynamically adjusting the refresh rate corresponding to the barrage messages to solve the problem of inconsistent barrage speeds, even in the case of dynamically adjusting the software refresh rate, the refresh rate corresponding to the barrage messages can be dynamically adjusted at the same time, so as to ensure the barrage Consistency and fluency of news.
  • a video playback control device including: a monitoring module 502, an acquisition module 504, a detection module 506, and a refresh module 508, wherein:
  • the monitoring module 502 is used to monitor the state of the current application process when the application program plays a video.
  • the obtaining module 504 is used to obtain the current status of the application process, including the presence of a trigger event state and the absence of a trigger event state.
  • the detection module 506 is used to dynamically adjust the signal receiving frequency of the application program when it is detected that there is no trigger event in the current application process, and receive the screen refresh synchronization signal distributed by the hardware layer according to the signal receiving frequency; when the current application process is detected When there is a trigger event in the system, the recovery application receives the screen refresh synchronization signal distributed by the hardware layer at the original frequency.
  • the refresh module 508 is configured to trigger the main thread to refresh the current video image according to the received screen refresh synchronization signal.
  • the device further includes: a screening module and a calling module.
  • the screening module is used for screening the screen refresh synchronization signal according to the preset configuration parameters to obtain the screen refresh synchronization signal after screening.
  • the calling module is used to call the frame function to send a message to the main thread according to the screen refresh synchronization signal after the reduction, and trigger the main thread to render the current video screen.
  • the device further includes: a trigger module and a judgment module.
  • the trigger module is used to trigger the state change of the preset flag bit when the screen refresh synchronization signal sent by the hardware layer is received through the abstract layer interface.
  • the judgment module is used to judge whether the application program is allowed to receive the screen refresh synchronization signal distributed by the hardware layer according to the state after the preset flag bit changes.
  • the judging module is also used to receive the screen refresh synchronization signal distributed by the current hardware layer when the state after the preset flag changes is zero; when the state after the preset flag changes is not zero, The screen refresh synchronization signal distributed by the current hardware layer is skipped.
  • the calling module is also used to call a function program to calculate the delay time corresponding to the barrage message when it is detected that there is a barrage message in the current application process.
  • the refresh module is also used to add a delay time to trigger the main thread to refresh the barrage message in the current video screen every time the frame function is called back.
  • the acquiring module is also used to acquire the time interval at which the current application process receives the screen refresh synchronization signal.
  • the device also includes a calculation module, which is used to calculate the screen refresh rate corresponding to the current application process according to the time interval of the screen refresh synchronization signal.
  • the judgment module is also used to judge whether to add a delay time to refresh the barrage message in the current video screen according to the screen refresh rate.
  • the detection module is further configured to filter the screen refresh synchronization signal according to preset configuration parameters when it is detected that there is a barrage message in the application process, to obtain the screen refresh synchronization signal after the screening.
  • the calling module is also used to call the frame function to send a message to the main thread according to the screen refresh synchronization signal after the reduction, and trigger the main thread to refresh the current barrage message.
  • the various modules in the above-mentioned video playback control device can be implemented in whole or in part by software, hardware and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a terminal, and its internal structure diagram may be as shown in FIG. 6.
  • the computer equipment includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and a computer program.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, an operator's network, NFC (near field communication) or other technologies.
  • the computer program is executed by the processor to realize a video playback control method.
  • the display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, or it can be a button, trackball or touchpad set on the housing of the computer equipment , It can also be an external keyboard, touchpad, or mouse.
  • FIG. 6 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
  • a computer device which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the steps of the foregoing method embodiments when the computer program is executed.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, or optical storage.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM may be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Health & Medical Sciences (AREA)
  • Social Psychology (AREA)
  • Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本申请涉及一种视频播放的控制方法、装置、计算机设备和存储介质。所述方法包括:当应用程序播放视频时,对当前应用进程的状态进行监测;获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。采用本方法能够在视频播放时保证操作界面流畅性同时又能有效降低功耗。

Description

视频播放的控制方法、装置、计算机设备和存储介质 技术领域
本申请涉及计算机技术领域,特别是涉及一种视频播放的控制方法、装置、计算机设备和存储介质。
背景技术
随着计算机技术的发展,各种类型的视频播放应用程序越来越多,当用户利用不同应用程序进行高清视频播放时,还可以实时对当前正在播放的视频发送弹幕消息参与互动。传统的方式中,为了保证视频播放的画质和操作界面的流畅性通常采用的方式是维持屏幕硬件高刷新率进行视频播放。
然而,在目前常用的视频播放方式中,如果一直维持屏幕硬件高刷新率则会相当耗电,导致功耗过大的问题,如果采用直接将屏幕硬件刷新率降低的方式,那么在播放视频时又会影响操作界面的流畅性。
发明内容
基于此,有必要针对上述技术问题,提供一种能够保证操作界面流畅性同时又能够有效降低功耗的视频播放的控制方法、装置、计算机设备和存储介质。
一种视频播放的控制方法,所述方法包括:
当应用程序播放视频时,对当前应用进程的状态进行监测;
获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
在其中一个实施例中,所述动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号包括:
根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕 刷新同步信号;
根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。
在其中一个实施例中,所述方法还包括:
当通过抽象层接口接收到硬件层发送的屏幕刷新同步信号时,触发预设标志位的状态变化;
根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号。
在其中一个实施例中,所述根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号包括:
当所述预设标志位变化后的状态为零时,则接收当前硬件层分发的屏幕刷新同步信号;
当所述预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号。
在其中一个实施例中,所述当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,所述方法还包括:
当检测到所述当前应用进程中存在弹幕消息时,调用函数程序计算所述弹幕消息对应的延迟时间;
在每次回调框架函数时,添加所述延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。
在其中一个实施例中,所述当检测到所述当前应用进程中存在弹幕消息时包括:
获取当前应用进程接收屏幕刷新同步信号的时间间隔;
根据所述屏幕刷新同步信号的时间间隔,计算得到所述当前应用进程对应的屏幕刷新率;
根据所述屏幕刷新率,判断是否添加所述延迟时间对当前视频画面中的弹幕消息进行刷新。
在其中一个实施例中,所述当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,所述方法还包括:
当检测到所述应用进程中存在弹幕消息时,根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号;
根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前弹幕消息进行刷新。
一种视频播放的控制装置,所述装置包括:
监测模块,用于当应用程序播放视频时,对当前应用进程的状态进行监测;
获取模块,用于获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
检测模块,用于当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
刷新模块,用于根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
当应用程序播放视频时,对当前应用进程的状态进行监测;
获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:
当应用程序播放视频时,对当前应用进程的状态进行监测;
获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程 序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
上述视频播放的控制方法、装置、计算机设备和存储介质,当应用程序播放视频时,对当前应用进程的状态进行监测。相对于传统的视频播放方式,通过获取当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态。当检测到当前应用进程中不存在触发事件时,则动态调节应用程序的信号接收频率,按照调节后的信号接收频率接收硬件层分发的屏幕刷新同步信号。根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号,根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。由此使得通过对当前应用进程的状态进行监测,当检测到当前应用进程中不存在触发事件时,则动态调节对应的信号接收频率;当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号,即通过动态调节软件刷新率,有效的解决了传统方式中一直维持屏幕硬件高刷新率的耗电问题,能够保证操作界面的流畅性,同时又能够有效降低功耗。
附图说明
图1为一个实施例中视频播放的控制方法的流程示意图;
图2为一个实施例中动态调节应用程序的信号接收频率步骤的流程示意图;
图3为一个实施例中触发预设标志位的状态变化步骤的流程示意图;
图4为一个实施例中调用函数程序计算弹幕消息对应的延迟时间步骤的流程示意图;
图5为一个实施例中视频播放的控制装置的结构框图;
图6为一个实施例中计算机设备的内部结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实 施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
在一个实施例中,如图1所示,提供了一种视频播放的控制方法,本实施例以该方法应用于终端进行举例说明,终端可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。可以理解的是,该方法也可以应用于服务器,还可以应用于包括终端和服务器的系统,并通过终端和服务器的交互实现。本实施例中,该方法包括以下步骤:
步骤102,当应用程序播放视频时,对当前应用进程的状态进行监测。
移动终端是一类嵌入式计算机系统设备,软件结构可以分为系统软件和应用软件。在移动终端的软件结构中,系统软件主要是操作系统和中间件,常见的移动终端操作系统有苹果的IOS、谷歌的Android、惠普的WebOS、开源的MeeGo及微软Windows等。使用不同操作系统移动终端的用户均可以通过移动终端中的应用市场界面下载多种类型的视频播放应用程序,例如目前常见的视频播放应用程序包括但不限于哔哩哔哩动画、斗鱼直播、虎牙直播和爱奇艺等均支持弹幕消息的功能。具体的,以Android操作系统为例,用户可以通过点选移动终端设备主界面中的某个特定的视频播放应用程序,启动该应用程序进入与该视频播放应用程序对应的页面中。上述应用进程(App Process)在启动过程中通过套接字(socket)与系统服务程序(SurfaceFlinger)建立连接。套接字(socket)是一个抽象层,应用程序可以通过它发送或接收数据。用户通过该应用程序播放视频时,即在Android操作系统中该应用程序播放视频时,移动终端通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行监测。即通过屏幕硬件驱动或按键驱动对当前应用进程的实时状态进行监测,并上报给对应的监听者(在Android系统中为InputReader)。
步骤104,获取当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态。
用户通过上述应用程序播放视频时,通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行实时监测。移动终端获取当前应用程序播放视频时对应的状态,包括存在触发事件状态和不存在触发事件状态。具体的,用户通过点选移动终端设备主界面中的某个特定的视频播放应用程序,启动该应用程序进入与该应用程序对应的页面中。用户通过该应用程序播放视频时,用户可以对当前播放的视频进行一系列菜单操作,例如用户可以通过点击当前视频播放界面 中的快进或者暂停按钮,控制当前视频播放画面的进度。用户也可以通过滑动当前视频播放界面中的亮度调节、声音调节图标,控制当前视频播放画面的亮度和音量。即当应用程序播放视频时,移动终端通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行监测。当移动终端检测到用户触摸屏幕或者按压物理按键时,则识别当前应用进程的状态为存在触发事件状态,并将上述触发事件上报给对应的监听者,从而使得系统服务程序按照触发事件的不同需求分发给对应的进程。其中,移动终端中的触发事件即屏幕输入事件(Input事件)可以包括单击事件(click事件)、触摸事件(touch类事件)、触碰事件(tap类事件)、滑动事件(swipe类事件)等,也就是用户可以对应用程序当前播放的视频进行一系列的菜单操作,例如调节视频播放速度、发送实时弹幕消息等。
步骤106,当检测到当前应用进程中不存在触发事件时,则动态调节应用程序的信号接收频率,按照该信号接收频率接收硬件层分发的屏幕刷新同步信号。
用户通过上述应用程序播放视频时,通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行实时监测。当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中不存在触发事件时,即通过Android系统中的DynamicVsyncHelper控件监听当前应用进程是否收到input事件,当不存在input事件时,也就是用户当前没有在该应用程序界面中进行操作,则终端动态调节当前应用程序的信号接收频率,按照调节后的信号接收频率接收硬件层分发的屏幕刷新同步信号,即终端有策略的限制当前应用程序接收硬件层分发的屏幕刷新同步信号的次数,从而限制该应用程序对应的软件画面刷新率。其中,GPU即图像处理芯片,又称显示核心、视觉处理器、显示芯片,GPU通常有一个机制叫做垂直同步(简写V-Sync),当开启垂直同步后,GPU会等待显示器的Vsync信号发出后,才进行新的一帧渲染和缓冲区更新。屏幕的刷新过程是每一行从左到右(行刷新,水平刷新,Horizontal Scanning),从上到下(屏幕刷新,垂直刷新,Vertical Scanning)。当整个屏幕刷新完毕,即一个垂直刷新周期完成,会有短暂的空白期,此时发出Vsync信号。所以,Vsync信号中的V指的是垂直刷新中的垂直/Vertical,屏幕刷新同步信号即Vsync信号。具体的,当Android系统中的DynamicVsyncHelper控件检测到当前应用进程中没有触发事件时,则终端限制当前应用程序的信号接收频率,按照限制后的信号接收频率接收硬件层分发的屏幕刷新同步信号,使得终端可以通过调节每帧接收屏幕刷新同步信号(Vsync信号)的次数,从而改变当前软件画面的刷新率。在Android系统中, 视频帧率是由软件屏幕刷新的同步信号(Vsync信号)间隔决定的,上述应用程序通过套接字接口(socket)接收来自系统服务(SurfaceFlinger)的软件Vsync信号,即屏幕刷新同步信号。其中,硬件屏端的时钟信号,由硬件屏幕产生经过HWComposer处理分给SurfaceFlinger,最终分发给应用。屏幕刷新率(FPS每秒传输帧数Frames Per Second)是画面每秒传输帧数,通俗来讲就是动画或视频的画面数。FPS是测量用于保存、显示动态视频的信息数量。每秒钟帧数越多,所显示的动作就会越流畅。本申请中可以指软件画面刷新率,即每秒内软件的绘制次数,即收到Vsync信号的次数。当终端检测到当前应用进程中不存在触发事件时,则终端可以动态调节应用程序接收硬件层分发的屏幕刷新同步信号,即终端可以通过调节应用程序的信号接收频率,即调节应用程序接收屏幕刷新同步信号的次数,例如终端可以预先在配置文件中设置拦截或者每隔一帧跳过一次屏幕刷新同步信号(Vsync信号),即可改变当前软件画面对应的刷新率,将当前软件画面刷新率限制在预设的数值范围内进行画面刷新。例如,终端获取到当前软件画面刷新率为120Hz,即每秒视频画面刷新120次,可以通过在配置文件中预先设置标志位的方式,每隔一帧丢掉一次Vsync信号,则终端调节上述应用程序的信号接收频率为60Hz,即终端按照上述信号接收频率接收屏幕刷新同步信号的次数为每秒视频画面刷新60次,也就是当前软件画面刷新率从120Hz调节为60Hz。具体的,在Android系统中,应用进程(App Process)在启动过程中通过抽象层Socket与系统服务程序(SurfaceFlinger)建立连接,系统服务程序将Vsync信号通过抽象层Socket分发给应用进程。应用进程收到该信号之后,通过DynamicVsyncHelper控件根据应用当前状态,即判断是否存在Input事件,从而决定是否忽略此次Vsync信号。当移动终端通过DynamicVsyncHelper控件检测到当前应用进程中不存在触发事件时,则终端忽略此次Vsync信号,等待接收下一次Vsync信号。移动终端可以根据接收到的下一次的Vsync信号,触发主线程对当前视频画面进行刷新。
步骤108,当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号。
用户通过上述应用程序播放视频时,通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行实时监测。当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中存在触发事件时,即通过Android系统中的DynamicVsyncHelper控件监听当前应用进程是否收到input事件,当存在input 事件时,也就是用户当前在该应用程序界面中进行操作时,则终端恢复当前应用程序以原始频率接收硬件层分发的屏幕刷新同步信号,即终端停止限制该应用程序接收硬件层分发的屏幕刷新同步信号的次数,从而恢复原始的软件画面刷新率,允许当前应用程序以原始频率接收硬件层分发的全部屏幕刷新同步信号。
步骤110,根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
用户通过上述应用程序播放视频时,通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行实时监测。当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中不存在触发事件时,即通过Android系统中的DynamicVsyncHelper控件监听当前应用进程是否收到input事件,当不存在input事件时,也就是用户当前没有在该应用程序界面中进行操作,则终端动态调节当前应用程序的信号接收频率,按照调节后的信号接收频率接收硬件层分发的屏幕刷新同步信号,终端根据上述接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中存在触发事件时,即通过Android系统中的DynamicVsyncHelper控件监听当前应用进程中存在input事件时,也就是用户当前在该应用程序界面中进行操作时,则终端恢复当前应用程序以原始频率接收硬件层分发的全部屏幕刷新同步信号,即终端停止限制该应用程序接收硬件层分发的屏幕刷新同步信号的次数,恢复原始的软件画面刷新率,允许当前应用程序以原始频率接收硬件层分发的全部屏幕刷新同步信号。终端根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。具体的,在Android系统中,应用进程(App Process)在启动过程中通过抽象层Socket与系统服务程序(SurfaceFlinger)建立连接,系统服务程序接收到从硬件层发送的Vsync信号,对上述Vsync信号进行封装后通过抽象层Socket分发给应用进程。应用进程收到信号之后,应用进程使用预先注册好的FrameDisplayEventReceiver接口回调触发下一帧的画面绘制。当满足条件时,应用主线程即开始执行measure、layout以及draw的绘制相关操作。
本实施例中,当应用程序播放视频时,对当前应用进程的状态进行监测。相对于传统的视频播放方式,通过获取当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态。当检测到当前应用进程中不存在触发事件时, 则动态调节应用程序的信号接收频率,按照调节后的信号接收频率接收硬件层分发的屏幕刷新同步信号,根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号,根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。由此使得通过对当前应用进程的状态进行监测,当检测到当前应用进程中不存在触发事件时,则动态调节对应的信号接收频率;当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号,即通过动态调节软件刷新率,有效的解决了传统方式中一直维持屏幕硬件高刷新率的耗电问题,能够保证操作界面的流畅性,同时又能够有效降低功耗。
在一个实施例中,如图2所示,动态调节应用程序的信号接收频率的步骤包括:
步骤202,根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。
步骤204,根据筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。
用户通过上述应用程序播放视频时,通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行实时监测。当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中不存在触发事件时,则终端动态调节当前应用程序的信号接收频率,按照调节后的信号接收频率接收硬件层分发的屏幕刷新同步信号。具体的,当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中不存在触发事件时,移动终端根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。移动终端根据筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。在Android系统中,应用进程收到Vsync信号之后,移动终端通过DynamicVsyncHelper控件监测当前应用进程的状态,同时获取当前接收到Vsync信号的时间间隔,即获取到当前软件画面的刷新率。当通过DynamicVsyncHelper控件检测到当前应用进程中不存在触发事件时,移动终端根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。例如,移动终端可以预先在配置参数中设置一个标志位,假设获取到当前软件画面的刷新率为120Hz,通过标志位状态的变化对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信 号,即筛减后可以将当前软件画面的刷新率从120Hz调节为60Hz。进一步的,移动终端根据筛减后的屏幕刷新同步信号,调用预先注册好的FrameDisplayEventReceiver函数接口回调触发下一帧的画面绘制,触发主线程对当前视频画面进行绘制相关的操作。由此使得在应用程序播放视频时,在保证操作界面流畅性的同时又能够通过调节软件画面刷新率,尽可能的减少画面渲染和刷新次数,从而有效的降低了功耗,解决了功耗过大的问题。
在一个实施例中,如图3所示,该方法还包括触发预设标志位的状态变化的步骤,具体包括:
步骤302,当通过抽象层接口接收到硬件层发送的屏幕刷新同步信号时,触发预设标志位的状态变化。
步骤304,根据预设标志位变化后的状态,判断是否允许应用程序接收硬件层分发的屏幕刷新同步信号。
当应用程序通过抽象层(Socket)接收到系统服务程序(SurfaceFlinger)分发的屏幕刷新同步信号时,触发预设标志位的状态变化。移动终端根据预设标志位变化后的状态,判断是否允许应用程序接收下一次硬件层分发的屏幕刷新同步信号。具体的,当应用程序通过抽象层(Socket)接收到系统服务程序(SurfaceFlinger)分发的屏幕刷新同步信号时,触发预设标志位的状态变化。可以通过预先在配置文件中设置每隔一帧画面丢掉一次屏幕刷新同步信号(Vsync信号),即可以预先设置当应用程序每接收到一次屏幕刷新同步信号时(Vsync信号)改变对应的标志位状态。进一步的,终端根据预设标志位变化后的状态,判断是否允许应用程序接收下一次硬件层分发的屏幕刷新同步信号。
在其中一个实施例中,根据预设标志位变化后的状态,判断是否允许应用程序接收硬件层分发的屏幕刷新同步信号的步骤包括:
当预设标志位变化后的状态为零时,则接收当前硬件层分发的屏幕刷新同步信号。
当预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号。
当应用程序通过抽象层(Socket)接收到系统服务程序(SurfaceFlinger)分发的屏幕刷新同步信号时,触发预设标志位的状态变化。可以通过预先在配置文件中设置每隔一帧画面丢掉一次屏幕刷新同步信号(Vsync信号),即设置当应用程序每接收到一次屏幕刷新同步信号时(Vsync信号)改变对应的标志位状 态。当预设标志位变化后的状态为零时,则终端允许应用程序接收当前硬件层分发的屏幕刷新同步信号。当预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号,即终端拦截应用程序接收当前硬件层分发的屏幕刷新同步信号。例如,当预设标志位变化后的状态为零时,则终端允许应用程序接收当前硬件层分发的屏幕刷新同步信号。当应用程序等待接收下一帧屏幕刷新同步信号时,终端检测到预设标志位变化后的状态不为零时,假设当终端检测到预设标志位变化后的状态为1时,则终端通过DynamicVsyncHelper控件拦截当前系统服务程序分发的屏幕刷新同步信号,即跳过此次屏幕刷新同步信号,只有当标志位的状态符合预设条件时,标志位才会变成true,允许应用程序接收当前硬件层分发的屏幕刷新同步信号。由此使得通过预设标志位的方式,实现动态调节应用程序接收屏幕刷新同步信号的次数,无需终端设备一直维持屏幕硬件的高刷新率,通过动态调节软件画面刷新率,减少画面渲染和刷新次数,从而有效的降低了终端设备的功耗。
在一个实施例中,如图4所示,当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,该方法还包括调用函数程序计算弹幕消息对应的延迟时间的步骤,具体包括:
步骤402,当检测到当前应用进程中存在弹幕消息时,调用函数程序计算弹幕消息对应的延迟时间。
步骤404,在每次回调框架函数时,添加延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。
用户通过上述应用程序播放视频时,通过屏幕硬件驱动或按键驱动对当前应用进程的状态进行实时监测。当移动终端通过屏幕硬件驱动或按键驱动检测到当前应用进程中存在触发事件时,则终端恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号。在上述应用程序播放视频时,用户可以实时发送弹幕消息参与互动。当移动终端检测到当前应用进程中存在弹幕消息时,调用函数程序计算弹幕消息对应的延迟时间。当移动终端每次回调框架函数时,添加延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。其中,弹幕消息的速度是每次刷新后弹幕消息相对上一次刷新时的位移距离决定的。每次刷新的位移距离是固定值,假设这个位移距离为单位距离,根据下述公式:弹幕速度=位移距离/时间,即弹幕速度是由软件刷新的时间间隔决定。在没有调节软件刷新率时,假设移动终端获取到当前软件刷新率为120Hz,也就是每秒弹幕消 息移动距离为120个单位距离。移动终端通过动态调节软件刷新率至60Hz后,弹幕每秒的移动距离就为60个单位距离,由此使得在动态调节软件刷新率时,会导致弹幕消息的速度不一致的问题。因此当移动终端检测到当前应用进程中存在弹幕消息时,调用函数程序计算弹幕消息对应的延迟时间。可以预先在函数程序中设置对应的计算公式,即周期T=1/频率f,终端根据不同的频率即可计算出对应的周期时间,两个不同频率之间的时间差值,即为延迟时间。例如,移动终端获取到上一帧画面的刷新率为120Hz,当移动终端检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的全部屏幕刷新同步信号,即移动终端获取到当前画面的刷新率为60Hz。当刷新率限制为60Hz时,调用函数程序计算对应的弹幕周期为每帧16.6ms,当刷新率恢复为120Hz时,调用函数程序计算对应的弹幕周期为每帧8.3ms,两者之间周期时间差值为8.3ms,即计算得到弹幕消息对应的延迟时间为8.3ms。其中,在Android系统中,弹幕消息是通过每帧都向Choreographer注册FrameCallback的回调实现的。当移动终端每次执行回调FrameCallback时,添加上述延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。由此使得可以根据当前视频播放画面帧率动态选择是否限制弹幕回调,通过对每一次的回调添加合适的延迟时间,以解决弹幕速度不一致的问题,即使在动态调节软件刷新率的情况下,也能够保证弹幕消息的一致性和流畅性。
在其中一个实施例中,当检测到当前应用进程中存在弹幕消息时的步骤包括:
获取当前应用进程接收屏幕刷新同步信号的时间间隔。
根据屏幕刷新同步信号的时间间隔,计算得到当前应用进程对应的屏幕刷新率。
根据屏幕刷新率,判断是否添加延迟时间对当前视频画面中的弹幕消息进行刷新。
当移动终端检测到当前应用进程中存在弹幕消息时,移动终端可以获取当前应用进程接收屏幕刷新同步信号的时间间隔,即获取当前弹幕消息对应周期。移动终端可以根据屏幕刷新同步信号的时间间隔,计算得到当前应用进程对应的屏幕刷新率。移动终端根据当前应用进程对应的屏幕刷新率,判断是否添加延迟时间对当前视频画面中的弹幕消息进行刷新。例如,移动终端可以获取当前应用进程接收屏幕刷新同步信号的时间间隔为8.3ms,即当前弹幕消息对应周 期为8.3ms,终端根据预先在函数程序中设置对应的计算公式,即周期T=1/频率f,终端根据不同的周期即可计算出对应的频率,即频率f为120Hz。进一步的,移动终端根据当前应用进程对应的屏幕刷新率,判断是否添加延迟时间对当前视频画面中的弹幕消息进行刷新。例如,当移动终端获取到当前应用进程对应的屏幕刷新率也为120Hz,即与弹幕消息的频率f相同时,则移动终端判断当前无需添加延迟时间,即可直接对当前视频画面中的弹幕消息进行刷新。当移动终端获取到当前应用进程对应的屏幕刷新率与弹幕消息的频率f不相同时,则移动终端判断需要添加延迟时间对当前视频画面中的弹幕消息进行刷新。由此使得终端可以根据当前应用程序对应的屏幕刷新率,判断是否添加延迟时间对当前视频画面中的弹幕消息进行刷新,以解决弹幕速度不一致的问题,同时也可以动态调节弹幕消息对应的刷新率,从而能够保证弹幕消息与播放画面的一致性和流畅性。
在一个实施例中,当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,该方法还包括对当前弹幕消息进行刷新的步骤,具体包括:
当检测到应用进程中存在弹幕消息时,根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。
根据筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前弹幕消息进行刷新。
当检测到当前应用进程中存在弹幕消息时,除了可以通过对每次的回调添加对应的延迟时间的方式之外,移动终端也可以根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。移动终端根据筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前弹幕消息进行刷新。即通过动态调节弹幕消息对应的刷新率,以解决弹幕速度不一致的问题,即使在动态调节软件刷新率的情况下,也可以同时动态调节弹幕消息对应的刷新率,从而能够保证弹幕消息的一致性和流畅性。
应该理解的是,虽然图1-4的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1-4中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行, 这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
在一个实施例中,如图5所示,提供了一种视频播放的控制装置,包括:监测模块502、获取模块504、检测模块506和刷新模块508,其中:
监测模块502,用于当应用程序播放视频时,对当前应用进程的状态进行监测。
获取模块504,用于获取当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态。
检测模块506,用于当检测到当前应用进程中不存在触发事件时,则动态调节应用程序的信号接收频率,按照该信号接收频率接收硬件层分发的屏幕刷新同步信号;当检测到当前应用进程中存在触发事件时,则恢复应用程序以原始频率接收硬件层分发的屏幕刷新同步信号。
刷新模块508,用于根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
在一个实施例中,该装置还包括:筛减模块和调用模块。
筛减模块用于根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。调用模块用于根据筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。
在一个实施例中,该装置还包括:触发模块和判断模块。
触发模块用于当通过抽象层接口接收到硬件层发送的屏幕刷新同步信号时,触发预设标志位的状态变化。判断模块用于根据预设标志位变化后的状态,判断是否允许应用程序接收硬件层分发的屏幕刷新同步信号。
在一个实施例中,判断模块还用于当预设标志位变化后的状态为零时,则接收当前硬件层分发的屏幕刷新同步信号;当预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号。
在一个实施例中,调用模块还用于当检测到当前应用进程中存在弹幕消息时,调用函数程序计算弹幕消息对应的延迟时间。刷新模块还用于在每次回调框架函数时,添加延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。
在一个实施例中,获取模块还用于获取当前应用进程接收屏幕刷新同步信号的时间间隔。该装置还包括:计算模块,计算模块用于根据屏幕刷新同步信号的时间间隔,计算得到当前应用进程对应的屏幕刷新率。判断模块还用于根 据屏幕刷新率,判断是否添加延迟时间对当前视频画面中的弹幕消息进行刷新。
在一个实施例中,检测模块还用于当检测到应用进程中存在弹幕消息时,根据预设配置参数对屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号。调用模块还用于根据筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前弹幕消息进行刷新。
关于视频播放的控制装置的具体限定可以参见上文中对于视频播放的控制方法的限定,在此不再赘述。上述视频播放的控制装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图6所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、运营商网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种视频播放的控制方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。
本领域技术人员可以理解,图6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述各个方法实施例的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于 一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种视频播放的控制方法,所述方法包括:
    当应用程序播放视频时,对当前应用进程的状态进行监测;
    获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
    当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
    当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
    根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
  2. 根据权利要求1所述的方法,其特征在于,所述动态调节所述应用程序的信号接收频率包括:
    根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号;
    根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    当通过抽象层接口接收到硬件层发送的屏幕刷新同步信号时,触发预设标志位的状态变化;
    根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号。
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号包括:
    当所述预设标志位变化后的状态为零时,则接收当前硬件层分发的屏幕刷新同步信号;
    当所述预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号。
  5. 根据权利要求1所述的方法,其特征在于,所述当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,所述方法还包括:
    当检测到所述当前应用进程中存在弹幕消息时,调用函数程序计算所述弹幕消息对应的延迟时间;
    在每次回调框架函数时,添加所述延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。
  6. 根据权利要求5所述的方法,其特征在于,所述当检测到所述当前应用进程中存在弹幕消息时包括:
    获取当前应用进程接收屏幕刷新同步信号的时间间隔;
    根据所述屏幕刷新同步信号的时间间隔,计算得到所述当前应用进程对应的屏幕刷新率;
    根据所述屏幕刷新率,判断是否添加所述延迟时间对当前视频画面中的弹幕消息进行刷新。
  7. 根据权利要求1所述的方法,其特征在于,所述当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,所述方法还包括:
    当检测到所述应用进程中存在弹幕消息时,根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号;
    根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前弹幕消息进行刷新。
  8. 一种视频播放的控制装置,其特征在于,所述装置包括:
    监测模块,用于当应用程序播放视频时,对当前应用进程的状态进行监测;
    获取模块,用于获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
    检测模块,用于当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
    当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
    刷新模块,用于根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
  9. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序以实现以下步骤:
    当应用程序播放视频时,对当前应用进程的状态进行监测;
    获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
    当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
    当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号;
    根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
  10. 根据权利要求9所述的计算机设备,其特征在于,在执行动态调节所述应用程序的信号接收频率时,所述处理器执行所述计算机程序以实现以下步骤:
    根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号;
    根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。
  11. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机程序以进一步实现以下步骤:
    当通过抽象层接口接收到硬件层发送的屏幕刷新同步信号时,触发预设标志位的状态变化;
    根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号。
  12. 根据权利要求11所述的计算机设备,其特征在于,在执行根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号时,所述处理器执行所述计算机程序以实现以下步骤:
    当所述预设标志位变化后的状态为零时,则接收当前硬件层分发的屏幕刷新同步信号;
    当所述预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号。
  13. 根据权利要求9所述的计算机设备,其特征在于,在执行当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件 层分发的屏幕刷新同步信号之后,所述处理器执行所述计算机程序以实现以下步骤:
    当检测到所述当前应用进程中存在弹幕消息时,调用函数程序计算所述弹幕消息对应的延迟时间;
    在每次回调框架函数时,添加所述延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。
  14. 根据权利要求13所述的计算机设备,其特征在于,在执行当检测到所述当前应用进程中存在弹幕消息时,所述处理器执行所述计算机程序以实现以下步骤:
    获取当前应用进程接收屏幕刷新同步信号的时间间隔;
    根据所述屏幕刷新同步信号的时间间隔,计算得到所述当前应用进程对应的屏幕刷新率;
    根据所述屏幕刷新率,判断是否添加所述延迟时间对当前视频画面中的弹幕消息进行刷新。
  15. 根据权利要求9所述的计算机设备,其特征在于,在执行当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,所述处理器执行所述计算机程序以实现以下步骤::
    当检测到所述应用进程中存在弹幕消息时,根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号;
    根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前弹幕消息进行刷新。
  16. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行以实现以下步骤:
    当应用程序播放视频时,对当前应用进程的状态进行监测;
    获取所述当前应用进程的状态,包括存在触发事件状态和不存在触发事件状态;
    当检测到所述当前应用进程中不存在触发事件时,则动态调节所述应用程序的信号接收频率,按照所述信号接收频率接收硬件层分发的屏幕刷新同步信号;
    当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原 始频率接收硬件层分发的屏幕刷新同步信号;
    根据接收到的屏幕刷新同步信号,触发主线程对当前视频画面进行刷新。
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,在执行动态调节所述应用程序的信号接收频率时,所述计算机程序被处理器执行以实现以下步骤:
    根据预设配置参数对所述屏幕刷新同步信号进行筛减,得到筛减后的屏幕刷新同步信号;
    根据所述筛减后的屏幕刷新同步信号,调用框架函数发送消息到主线程,触发主线程对当前视频画面进行渲染。
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述计算机程序被处理器执行以进一步实现以下步骤:
    当通过抽象层接口接收到硬件层发送的屏幕刷新同步信号时,触发预设标志位的状态变化;
    根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号。
  19. 根据权利要求18所述的计算机可读存储介质,其特征在于,在执行根据所述预设标志位变化后的状态,判断是否允许所述应用程序接收硬件层分发的屏幕刷新同步信号时,所述计算机程序被处理器执行以进一步实现以下步骤:
    当所述预设标志位变化后的状态为零时,则接收当前硬件层分发的屏幕刷新同步信号;
    当所述预设标志位变化后的状态不为零时,则跳过当前硬件层分发的屏幕刷新同步信号。
  20. 根据权利要求16所述的计算机可读存储介质,其特征在于,在执行当检测到所述当前应用进程中存在触发事件时,则恢复所述应用程序以原始频率接收硬件层分发的屏幕刷新同步信号之后,所述计算机程序被处理器执行以进一步实现以下步骤:
    当检测到所述当前应用进程中存在弹幕消息时,调用函数程序计算所述弹幕消息对应的延迟时间;
    在每次回调框架函数时,添加所述延迟时间触发主线程对当前视频画面中的弹幕消息进行刷新。
PCT/CN2021/102067 2020-06-02 2021-06-24 视频播放的控制方法、装置、计算机设备和存储介质 WO2021244666A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/407,189 US20220060607A1 (en) 2020-06-02 2021-08-20 Method for controlling video playing, computer device and storage medium thereof

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010489106.8 2020-06-02
CN202010489106.8A CN113766324B (zh) 2020-06-02 2020-06-02 视频播放的控制方法、装置、计算机设备和存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/407,189 Continuation US20220060607A1 (en) 2020-06-02 2021-08-20 Method for controlling video playing, computer device and storage medium thereof

Publications (1)

Publication Number Publication Date
WO2021244666A1 true WO2021244666A1 (zh) 2021-12-09

Family

ID=78782700

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/102067 WO2021244666A1 (zh) 2020-06-02 2021-06-24 视频播放的控制方法、装置、计算机设备和存储介质

Country Status (3)

Country Link
US (1) US20220060607A1 (zh)
CN (1) CN113766324B (zh)
WO (1) WO2021244666A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114245208A (zh) * 2021-12-16 2022-03-25 荣耀终端有限公司 刷新率的设置方法及相关设备
CN114205673A (zh) * 2021-12-16 2022-03-18 荣耀终端有限公司 刷新率的设置方法及相关设备
CN114390333B (zh) * 2022-02-09 2024-04-02 百果园技术(新加坡)有限公司 界面内容显示方法、装置、设备和存储介质
CN114501054B (zh) * 2022-02-11 2023-04-21 腾讯科技(深圳)有限公司 直播互动方法、装置、设备及计算机可读存储介质
CN117850727A (zh) * 2022-09-30 2024-04-09 荣耀终端有限公司 Vsync信号的控制方法、电子设备、存储介质及芯片

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100013759A1 (en) * 2008-07-21 2010-01-21 June-On Co., Ltd. Kvm switch with separate on-screen display and control channels
JP2013020020A (ja) * 2011-07-08 2013-01-31 Kyocera Corp 2画面携帯端末装置
CN104347049A (zh) * 2014-09-24 2015-02-11 广东欧珀移动通信有限公司 一种调整屏幕刷新频率的方法及装置
CN105872701A (zh) * 2015-12-03 2016-08-17 乐视致新电子科技(天津)有限公司 一种实现视频播放控制的方法及移动终端
CN108885852A (zh) * 2016-06-29 2018-11-23 苹果公司 用于在电子显示器中控制可变帧持续时间的系统和方法
CN110928396A (zh) * 2019-11-18 2020-03-27 Oppo(重庆)智能科技有限公司 屏幕刷新方法及相关设备
CN111031376A (zh) * 2019-11-25 2020-04-17 上海哔哩哔哩科技有限公司 基于微信小程序的弹幕处理方法和系统

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9830880B1 (en) * 2009-07-22 2017-11-28 Nvidia Corporation Method and system for adjusting the refresh rate of a display device based on a video content rate
TWI442365B (zh) * 2011-07-13 2014-06-21 Innolux Corp 顯示系統
US9135602B2 (en) * 2012-07-25 2015-09-15 E-Plan, Inc. Management of building plan documents utilizing comments and a correction list
WO2015188753A1 (en) * 2014-06-13 2015-12-17 Tencent Technology (Shenzhen) Company Limited Interaction method based on multimedia programs and terminal device
US9635131B2 (en) * 2015-02-05 2017-04-25 Qwire Inc. Media player distribution and collaborative editing
US10070118B2 (en) * 2015-09-17 2018-09-04 Lumii, Inc. Multi-view displays and associated systems and methods
CN105867576A (zh) * 2015-11-24 2016-08-17 乐视移动智能信息技术(北京)有限公司 一种延长终端设备续航时间的方法和终端设备
CN106210853B (zh) * 2016-07-08 2019-04-09 上海幻电信息科技有限公司 弹幕显示系统及其cpu消耗控制方法
CN106652919A (zh) * 2016-09-09 2017-05-10 青岛海信电器股份有限公司 一种图像显示方法及显示装置
US20180330756A1 (en) * 2016-11-19 2018-11-15 James MacDonald Method and apparatus for creating and automating new video works
CN106933587B (zh) * 2017-03-10 2019-12-31 Oppo广东移动通信有限公司 一种图层绘制控制方法、装置及移动终端
CN106933526B (zh) * 2017-03-10 2019-03-15 Oppo广东移动通信有限公司 一种动态调节屏幕刷新率的方法、装置及移动终端
CN106686257B (zh) * 2017-03-10 2019-07-16 Oppo广东移动通信有限公司 一种移动终端的控制方法、装置及移动终端
CN106919402B (zh) * 2017-03-10 2020-08-28 Oppo广东移动通信有限公司 一种移动终端的控制方法、装置及移动终端
US10674112B2 (en) * 2018-09-18 2020-06-02 Samsung Electronics Co., Ltd. Display driver circuit for adjusting framerate to reduce power consumption
CN110494828B (zh) * 2019-07-02 2023-08-25 深圳市汇顶科技股份有限公司 信号处理系统、芯片和主动笔
CN110706675A (zh) * 2019-09-29 2020-01-17 Oppo广东移动通信有限公司 信息显示方法和装置
KR20230067740A (ko) * 2021-11-08 2023-05-17 삼성디스플레이 주식회사 표시 장치

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100013759A1 (en) * 2008-07-21 2010-01-21 June-On Co., Ltd. Kvm switch with separate on-screen display and control channels
JP2013020020A (ja) * 2011-07-08 2013-01-31 Kyocera Corp 2画面携帯端末装置
CN104347049A (zh) * 2014-09-24 2015-02-11 广东欧珀移动通信有限公司 一种调整屏幕刷新频率的方法及装置
CN105872701A (zh) * 2015-12-03 2016-08-17 乐视致新电子科技(天津)有限公司 一种实现视频播放控制的方法及移动终端
CN108885852A (zh) * 2016-06-29 2018-11-23 苹果公司 用于在电子显示器中控制可变帧持续时间的系统和方法
CN110928396A (zh) * 2019-11-18 2020-03-27 Oppo(重庆)智能科技有限公司 屏幕刷新方法及相关设备
CN111031376A (zh) * 2019-11-25 2020-04-17 上海哔哩哔哩科技有限公司 基于微信小程序的弹幕处理方法和系统

Also Published As

Publication number Publication date
CN113766324A (zh) 2021-12-07
US20220060607A1 (en) 2022-02-24
CN113766324B (zh) 2022-11-04

Similar Documents

Publication Publication Date Title
WO2021244666A1 (zh) 视频播放的控制方法、装置、计算机设备和存储介质
WO2020207251A1 (zh) 图像更新方法、装置、终端及存储介质
US20180261143A1 (en) Method, device and non-transitory computer-readable storage medium for controlling frame rate of mobile terminal
JP6404368B2 (ja) 動的フレームレートサポートを用いる電力最適化
WO2020207250A1 (zh) 垂直同步方法、装置、终端及存储介质
WO2018161957A1 (zh) 图层绘制控制方法、装置及移动终端
US11568588B2 (en) Controlling display performance using display statistics and feedback
WO2021008424A1 (zh) 图像合成方法、装置、电子设备及存储介质
JP2014512551A (ja) 電子デバイス上での静止画像の検出およびリソースの使用の低減
WO2021136158A1 (zh) 一种视频窗口画面显示方法及装置
CN106658064B (zh) 虚拟礼物展示方法及装置
CN107846617B (zh) 一种智能终端和智能电视的互动方法
US9319468B2 (en) Information processing apparatus and information processing method
US20190089927A1 (en) Block-based power efficient timing engine for smart display panels
WO2022171054A1 (zh) 一种刷新显示的方法、装置和电子设备
WO2023061096A1 (zh) 显示屏刷新帧率的调整方法、装置、处理器、芯片和终端
CN106484348B (zh) 一种基于同步信号的动画绘制方法及系统
CN115100993A (zh) 显示帧率的调整方法、装置、应用处理器及电子设备
US20190087144A1 (en) Frame-based power efficient timing engine for smart display panels
EP4124051A1 (en) Method for controlling video playing, apparatus, and computer device thereof
US20230074876A1 (en) Delaying dsi clock change based on frame update to provide smoother user interface experience
WO2023160240A1 (zh) 投屏控制方法、装置、电子设备和计算机可读存储介质
US20190303083A1 (en) Power saving on smart display panels during wireless display sessions
TW201409350A (zh) 影像外接裝置的處理方法以及影像外接裝置
WO2024032126A1 (zh) 基于3d显示技术的背光控制方法、装置、介质及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21817650

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13/03/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21817650

Country of ref document: EP

Kind code of ref document: A1