CN116761032A - Video playing method, readable medium and electronic device - Google Patents

Video playing method, readable medium and electronic device Download PDF

Info

Publication number
CN116761032A
CN116761032A CN202311046469.4A CN202311046469A CN116761032A CN 116761032 A CN116761032 A CN 116761032A CN 202311046469 A CN202311046469 A CN 202311046469A CN 116761032 A CN116761032 A CN 116761032A
Authority
CN
China
Prior art keywords
video
hard decoding
image data
electronic equipment
management service
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202311046469.4A
Other languages
Chinese (zh)
Other versions
CN116761032B (en
Inventor
王小品
任书源
刘鹏程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202311046469.4A priority Critical patent/CN116761032B/en
Priority claimed from CN202311046469.4A external-priority patent/CN116761032B/en
Publication of CN116761032A publication Critical patent/CN116761032A/en
Application granted granted Critical
Publication of CN116761032B publication Critical patent/CN116761032B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4333Processing operations in response to a pause request
    • 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/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations
    • 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/439Processing of audio elementary streams
    • 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, rendering scenes according to MPEG-4 scene graphs
    • H04N21/44012Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving rendering scenes according to scene graphs, e.g. MPEG-4 scene graphs
    • 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, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • 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
    • 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/4438Window management, e.g. event handling following interaction with the user interface
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/81Monomedia components thereof
    • H04N21/8166Monomedia components thereof involving executable data, e.g. software
    • H04N21/8173End-user applications, e.g. Web browser, game

Abstract

The application relates to the technical field of computers, and discloses a video playing method, a readable medium and electronic equipment. According to the video playing method provided by the embodiment of the application, after the situation that the user does not pay attention to the video playing picture is detected, the processing process of the image data is paused, and after a recovery event (the picture of the video is re-focused by the user) is detected, the processing process of the image data in the electronic equipment is recovered, so that the power consumption of the electronic equipment is reduced, and the endurance time of the electronic equipment is further prolonged.

Description

Video playing method, readable medium and electronic device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a video playing method, a readable medium, and an electronic device.
Background
When the electronic device plays the video, if the user does not pay attention to the video playing picture, for example, the user does not precede the electronic device or the user performs operations such as minimizing the video playing window, because the user does not pause playing the video, the electronic device still continues playing the audio data and decoding and rendering the image data, thereby increasing the power consumption of the electronic device.
Disclosure of Invention
The application aims to provide a video playing method, a readable medium and electronic equipment.
The first aspect of the present application provides a video playing method, applied to an electronic device, including: playing a first video through a first application; in the playing process of the first video, detecting that the playing condition of the first video meets a stop condition; and stopping decoding the image data to be played in the first video.
In the embodiment of the present application, the first application may be video playing software; the first video may be a video to be played; the stop condition may be that the user is not paying attention to the video play screen. The electronic device pauses the processing process of the image data after detecting that the user is not paying attention to the video playing picture.
It can be appreciated that, by the video playing method provided by the embodiment of the application, after detecting that the user does not pay attention to the video playing picture, the processing process of the image data is paused, so that the power consumption of the electronic equipment is reduced, and the endurance time of the electronic equipment is further improved.
In a possible implementation of the first aspect, the stop condition includes at least one of: the play window of the first video is minimized; the user is not detected within a preset range of the electronic device within the first time interval.
In the embodiment of the present application, the situation that the user does not pay attention to the video playing picture may be that the user is not in front of the electronic device, for example, the user is not in a detection range of a camera of the electronic device, the preset range may be a detection range of a front camera of the electronic device, or the user may minimize a video playing window, etc.
In one possible implementation of the first aspect, the first application is a browser, and stopping decoding the image data to be played in the first video includes: the image processing process of the browser is suspended.
In the embodiment of the application, the browser can be a browser based on a chrome kernel, and the image processing process of the browser can be a browser GPU process.
In a possible implementation of the first aspect, suspending an image processing process of the browser includes: the video management service of the electronic equipment sends a suspension instruction to an image processing process of a browser of the electronic equipment through a hard decoding control module of the electronic equipment; the image processing process of the browser performs a suspension operation.
In the embodiment of the present application, after receiving the window minimizing event, the video management service 20 sends a suspension instruction to the browser GPU process 40 to freeze the browser GPU process, so that after receiving the window minimizing event, hard decoding processing of the image data is suspended; upon receiving the suspend instruction, the browser GPU process 40 freezes the hard decoding process, e.g., calls the suspend process interface function ntsuspend process to suspend the hard decoding process, i.e., to suspend the hard decoding process on the image data.
In a possible implementation of the first aspect, the detecting of the play situation of the first video is implemented by: the video management service of the electronic equipment sends a window hook injection function to a message hook injection module of the electronic equipment; the message hook injection module of the electronic equipment injects a video management service message hook in a browser main process of the electronic equipment, so that the video management service detects the playing condition of the first video through the video management service message hook.
In the embodiment of the application, the video management service sends the window hook injection function to the message hook injection module, and after the message hook injection module receives the window hook injection function, the window hook injection function is sent to the browser main process, and the video management service message hook is injected, so that the video management service detects a window minimization event/recovery event through the video management service message hook. In one possible implementation of the first aspect, the first application is video playing software based on video hard decoding, and stopping decoding image data to be played in the first video, including: replacing an initial callback function in a hard decoding process of the video playing software with a target callback function, wherein when the initial callback function is called, sending image data to be played to a video processing unit in the hard decoding process of the video playing software; and calling a target callback function, and stopping sending the image data to be played to a video processing unit in the hard decoding process of the video playing software.
In one possible implementation of the first aspect, the first application is video playing software based on video hard decoding, and stopping decoding image data to be played in the first video includes: replacing an initial callback function in a hard decoding process of the video playing software with a target callback function, wherein when the initial callback function is called, sending image data to be played to a video processing unit in the hard decoding process of the video playing software; and calling a target callback function, and stopping sending the image data to be played to a video processing unit in the hard decoding process of the video playing software.
In the embodiment of the application, the electronic equipment replaces an initial callback function in the video playing process with a target callback function; corresponding to the hook function acquiring and blocking the trigger event (e.g., the minimized event of the video play window), invoking the target callback function, and controlling the target callback function to stop sending the hard decoding and rendering instructions of the image data and the image data to the video processing unit (e.g., GPU).
In one possible implementation manner of the first aspect, replacing an initial callback function in a hard decoding process of video playing software with a target callback function includes: the video management service of the electronic equipment sends a hooking instruction to a remote calling module of the electronic equipment; the remote calling module sends a hooking instruction to a hard decoding process of the video playing software; and the hard decoding process of the video playing software executes hooking operation, and replaces the initial callback function with the target callback function.
In the embodiment of the application, the video management service sends the hooking instruction to the remote calling module, and after the remote calling module receives the hooking instruction, the video playing software hard decoding process sends the hooking instruction to enable the video playing software hard decoding process to execute hooking operation, and the initial callback function is replaced by the target callback function.
In one possible implementation manner of the first aspect, the invoking the target callback function stops sending the image data to be played to the video processing unit in the hard decoding process of the video playing software, where the invoking the target callback function includes: the video management service of the electronic equipment sends an instruction for stopping hard decoding to a remote call module of the electronic equipment; the remote calling module sends an instruction for stopping hard decoding to a hard decoding process of the video playing software; the hard decoding process of the video playing software calls the target callback function, and the image data to be played is stopped from being sent to the video processing unit in the hard decoding process of the video playing software.
In the embodiment of the application, the video management service sends an instruction for stopping hard decoding to the remote calling module, and the remote calling module sends the instruction for stopping hard decoding to the video playing software hard decoding process after receiving the instruction for stopping hard decoding, so that when the target callback function is called, the target callback function is controlled to stop forwarding the content of the initial callback function to the universal media drive, and then the hard decoding process is stopped/the hard decoding process is restored.
In a possible implementation of the first aspect, the detecting of the play situation of the first video is implemented by: the video management service of the electronic equipment sends a window hook injection function to a message hook injection module of the electronic equipment; the message hook injection module of the electronic equipment injects a video management service message hook in a video playing software main process of the electronic equipment, so that the video management service detects the playing condition of the first video through the video management service message hook.
In the embodiment of the application, the video management service sends the window hook injection function to the message hook injection module, and after the message hook injection module receives the window hook injection function, the window hook injection function is sent to the video playing software main process, and the video management service message hook is injected into the video playing software main process, so that the video management service can detect the window minimization event/recovery event through the video management service message hook.
In a possible implementation of the first aspect, the method further includes: after stopping decoding the image data to be played in the first video, detecting that the playing condition of the first video meets the recovery condition; and restoring and decoding the image data to be played in the first video.
In the embodiment of the present application, the restoration condition may be that the user pays attention to the picture of the video again. After detecting a restoration event (the user refocuses the picture of the video), the processing of the image data in the electronic device is restored.
In a possible implementation of the first aspect, the recovery condition includes at least one of: the play window of the first video is restored; and detecting the user in a preset range of the electronic equipment in the first time interval.
In the embodiment of the present application, the recovery event may be a recovery event of the video playing window, or may be that a user reappears before the electronic device is detected, for example, the user is in a detection range of a camera of the electronic device, and the preset range may be a detection range of a front camera of the electronic device, etc.
In one possible implementation of the first aspect, the first application is a browser, and the recovering the image data to be played in the decoded first video includes: restoring the image processing process of the browser; acquiring a first time when the playing condition of a first video meets a recovery condition; and decoding the image data to be played from the independent frame data corresponding to the first time in the image data to be played.
In the embodiment of the application, the electronic equipment acquires the time of the audio data corresponding to the current recovery event (or the time corresponding to the current recovery event), and performs hard decoding and rendering processing on the image frame data corresponding to the time, wherein the image frame data corresponding to the time is independent frame data.
In one possible implementation of the first aspect, the restoring the image processing procedure of the browser is implemented by: the video management service of the electronic equipment sends a recovery instruction to an image processing process of a browser of the electronic equipment through a hard decoding control module of the electronic equipment; the image processing process of the browser performs a recovery operation.
In the embodiment of the present application, after receiving the window restoration event, the video management service 20 sends a restoration instruction to the browser GPU process 40 to defrost the browser GPU process, so that after receiving the window restoration event, the hard decoding process of the image data is restored (restarted); after the browser GPU process 40 receives the resume instruction, the hard decoding process is thawed, for example, invoking a resume process interface function NtResumeProcess to resume the hard decoding process, i.e., resume the hard decoding process on the image data.
In one possible implementation of the first aspect, the first application is video playing software based on video hard decoding, and restoring decoding image data to be played in the first video includes: calling a target callback function, and sending image data to be played to a video processing unit in a hard decoding process of video playing software; acquiring second time when the playing condition of the first video meets the recovery condition; and decoding the image data to be played from the independent frame data corresponding to the second time in the image data to be played.
In the embodiment of the application, the electronic equipment acquires the time of the audio data corresponding to the current recovery event (or the time corresponding to the current recovery event), and performs hard decoding and rendering processing on the image frame data corresponding to the time, wherein the image frame data corresponding to the time is independent frame data.
In a possible implementation manner of the first aspect, the calling a target callback function, and sending image data to be played to a video processing unit in a hard decoding process of video playing software includes: the video management service of the electronic equipment sends an instruction for recovering hard decoding to a remote calling module of the electronic equipment; the remote calling module sends an instruction for recovering hard decoding to a hard decoding process of the video playing software; the hard decoding process of the video playing software calls a target callback function and sends image data to be played to a video processing unit in the hard decoding process of the video playing software.
In the embodiment of the application, the video management service sends the instruction for recovering the hard decoding to the remote calling module, and the remote calling module sends the instruction for recovering the hard decoding to the video playing software hard decoding process after receiving the instruction for recovering the hard decoding, so that when the target callback function is called, the target callback function is controlled to recover and forward the content of the initial callback function to the universal media drive, and then the hard decoding process/the recovering hard decoding process is stopped.
A second aspect of the application provides a readable medium having stored thereon instructions which, when executed on an electronic device, cause the electronic device to perform any of the methods of the first aspect described above.
A third aspect of the application provides an electronic device comprising a memory for storing instructions for execution by one or more processors of the electronic device, and the processor being one of the processors of the electronic device for performing any one of the methods of the first aspect described above.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a user interface for video playing software to play video according to an embodiment of the present application;
FIG. 1b shows a schematic diagram of a corresponding user interface after a window minimization operation, in accordance with an embodiment of the present application;
FIG. 2 shows a video playback flow diagram in accordance with an embodiment of the present application;
FIG. 3 is a schematic diagram showing interaction of software modules of an electronic device when video playback software is a browser, according to an embodiment of the present application;
FIG. 4 is a schematic diagram showing an interaction flow of a video playing method when the video playing software is a browser according to an embodiment of the present application;
FIG. 5 is a diagram illustrating interaction of a browser process tree with a video management service, according to an embodiment of the present application;
FIG. 6 is a diagram showing the interaction of software modules of an electronic device when the video playback software is video playback software based on video hard decoding, according to an embodiment of the present application;
FIG. 7 is a schematic diagram showing an interaction flow of a video playing method when the video playing software is video playing software based on video hard decoding according to an embodiment of the present application;
FIG. 8 is a schematic diagram illustrating interaction of a video playback software process with a video management service according to an embodiment of the present application;
FIG. 9 is a schematic flow chart of a video playing method when the video playing software is video playing software based on video hard decoding according to the embodiment of the application;
fig. 10 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Illustrative embodiments of the application include, but are not limited to, a video playback method, a readable medium, and an electronic device.
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the embodiments of the present application will be clearly and thoroughly described with reference to the accompanying drawings.
As described above, when the electronic device plays the video, after detecting that the user is not paying attention to the video playing frame, the electronic device still continues to play the audio data and decode and render the image data.
It may be understood that a scene where the user does not pay attention to the video playing picture may be that the user is not in front of the electronic device, for example, the user is not in a detection range of a camera of the electronic device, where the preset range may be a detection range of a front camera of the electronic device; or the user can perform operations such as minimizing the video playing window, etc., which is not limited by the application.
Reference is illustratively made to the changing schematic diagrams of the user interface shown in fig. 1a to 1 b. As shown in fig. 1a, the user interface 10a of the notebook computer 10 includes a minimize control 101, a zoom control 102, an exit control 103, a cursor 104, and controls such as a display area and a progress bar of video content currently being played by the notebook computer 10.
In response to a user's minimizing operation of the video play window, i.e., a clicking operation of the minimizing control 101 by the cursor 104, the notebook computer 10 displays a user interface 10b as shown in fig. 1b, the user interface 10b including: a desktop 105 and a taskbar 106. The desktop 105 comprises a video application, an application icon of a browser application, a cursor 104 and the like; the taskbar 106 includes controls such as a video application icon 1061 and a power supply, and the video application icon 1061 is in a selected state, i.e., the video application is in a window minimizing state in response to a user minimizing a video playing window.
It can be understood that, in the above scenario where the user performs the minimizing operation on the video playing window, after the video playing window is minimized, that is, as shown in the user interface in fig. 1b, the user does not pay attention to the video playing frame, and if the image data is still decoded and rendered, the power consumption of the electronic device is increased, so as to further reduce the endurance time of the electronic device.
In view of this, the embodiment of the present application provides a video playing method, which can suspend the processing process of image data after detecting that the user does not pay attention to the video playing picture, and resume the processing process of image data in the electronic device after detecting a resume event (the user pays attention again to the picture of the video). Therefore, the power consumption of the electronic equipment is reduced, and the endurance time of the electronic equipment is further improved. For example, in the video playing process, the image data in the video needs to undergo multiple stages such as capturing the image data, framing the image data, storing the image data, hard decoding the image data, and rendering the image data after hard decoding, etc. before playing, in some embodiments of the present application, after detecting that the user is not paying attention to the video playing frame, the stage of hard decoding the image data may be paused, and it may be understood that the subsequent stage of rendering the image data after hard decoding is paused.
It may be appreciated that the screen of the user re-focusing on the video may be that the user reappears in front of the electronic device, for example, the user is in a detection range of a camera of the electronic device, where the preset range may be a detection range of a front camera of the electronic device; the method and the device can also be used for performing operations such as restoration and the like on the video playing window by a user, and the application is not limited to the operations.
It will be appreciated that in some embodiments of the present application, whether the user is focused on the playing frame of the video may be detected by detecting whether the cursor of the electronic device 100 clicks the minimizing control; whether the user focuses on the playing picture of the video can also be determined by detecting whether the user exists in the pictures captured by the camera of the electronic device 100 within a preset time, for example, in the pictures captured by the camera of the electronic device 100, if no picture of the user continuously exceeds 2 minutes, it is determined that the user does not focus on the playing picture of the video. The application is not limited in this regard.
It can be understood that the video playing method provided by the application can be applied to the video hard decoded scene; the processing of the image data may be a process of hard decoding and rendering the image data.
In some embodiments, the video playback flow may refer to the video playback flow schematic shown in fig. 2. It will be understood that the main execution body of each step in the flowchart shown in fig. 2 is the electronic device 100. In order to simplify the description, the description of the execution subject of each step will not be repeated below when introducing each step of the flow shown in fig. 2. As shown in fig. 2, the process includes, but is not limited to, the following steps:
S201: and acquiring image data of the video to be played and carrying out framing treatment.
In some embodiments, the electronic device 100 obtains image data of a video to be played and performs frame-dividing processing on the image data to obtain multi-frame image frame data, where the image frame data may include image frame data such as an independent frame (I-frame) and an incremental frame (P-frame, B-frame, etc.), which is not limited in this application.
S202: and acquiring audio data of the video to be played and performing audio processing.
In some embodiments, the electronic device 100 obtains the audio data of the video to be played and performs audio processing, where the audio processing may be, for example, an audio processing method such as framing, smoothing, filtering, etc., and the specific method of audio processing is not limited in the present application.
S203: and storing the image frame data of the video to be played and the corresponding time stamp.
In some embodiments, the electronic device 100 stores image frame data of a video to be played and its corresponding timestamp. It will be appreciated that the time stamp of the image frame data of the video to be played corresponds to the time of the audio data.
S204: and performing hard decoding on the image frame data, and rendering the decoded data.
In some embodiments, the electronic device 100 hard decodes the image frame data and renders the hard decoded data, and the rendering effect is not particularly limited in the present application.
S205: and displaying the rendered image data and playing the processed audio data.
In some embodiments, the electronic device 100 displays the rendered image data and plays the processed audio data, i.e., synchronously displays the image data and plays the audio data.
S206: the trigger event is detected and the processing of the image frame data is suspended.
In some embodiments, the electronic device 100 detects a trigger event, i.e., the user is not paying attention to the video play screen, and pauses the processing of the image data.
It will be appreciated that the processing of the image data may be a process of hard decoding and rendering the image data.
It will be appreciated that since the video does not terminate the playback, the processing and playback of the audio data is not paused while the processing of the image data is paused.
S207: a recovery event is detected and the processing of the image data is resumed.
In some embodiments, the electronic device 100 detects a resume event to resume processing of the image data.
It may be appreciated that the electronic device 100 obtains the time of the audio data corresponding to the current recovery event (or the time corresponding to the current recovery event), and performs the hard decoding and rendering processing on the image frame data corresponding to the time, where the image frame data corresponding to the time is independent frame data.
It can be understood that, after the electronic device 100 resumes the processing procedure of the image data, the rendered image data and the audio data after playing processing continue to be synchronously displayed, which is not described herein.
It can be understood that after the processing process of the image data is resumed, the image is automatically displayed from the latest independent frame data, and the situations of black screen, splash screen and the like cannot occur, i.e. the viewing experience of the user on the video cannot be affected. The latest independent frame data represents the independent frame data having the closest time stamp corresponding to the process of recovering the image data (or the recovery event), and the time stamp corresponding to the independent frame data is larger than the time stamp corresponding to the process of recovering the image data.
It can be understood that the video playing method only processes the processing progress of the image data, and does not process the processing progress of the audio data, i.e. the audio data is still played normally. If the process of processing the image data is paused and then the playing of the audio data is paused during the execution of the method described in fig. 2, the process of processing the image data is paused again after the operation of resuming the process of processing the image data is executed until the audio data is played normally.
In some embodiments, the processing of the image data is suspended (e.g., the hard decoding process is suspended) and the processing and playback of the audio data is not affected. If the process of processing the image data is paused, the playing of the audio data is paused, which may be caused by redrawing the video playing window due to the pause of the process of processing the image data, at this time, the playing of the audio data is continued only by resuming the process of processing the image data, the process of processing the image data is paused again, and the operation of resuming-pausing is repeated until the playing of the audio data is not paused along with the pause of the process of processing the image data.
It will be appreciated that, in other embodiments, the steps shown in fig. 2 may be combined, deleted or replaced with other steps that are beneficial to achieving the object of the present application, for example, the step S201 and the step S202 may be combined into one step according to actual requirements, which is not limited herein.
It can be appreciated that the video playing method provided by the embodiment of the application can be applied to any electronic equipment such as a notebook computer and a netbook carrying a Microsoft operating system. The embodiment of the application does not limit the specific type of the electronic equipment.
In order to better understand the technical solution of the embodiment of the present application, the following describes the scenario shown in fig. 1a to 1b in detail, with reference to the accompanying drawings, in which step S206 and step S207 in fig. 2 are described in detail.
Example 1
The technical scheme of the embodiment of the application is described below by taking video playing software as a browser based on a Chrome kernel (such as a Chrome browser, an Edge browser and the like), a triggering event as a minimizing event of a video playing window and a restoring event as a restoring event of the video playing window as examples.
Fig. 3 shows an interaction diagram of software modules of an electronic device when the video playing software is a browser, according to an embodiment of the present application. As shown in fig. 3, the electronic device 100 includes an application layer and a system (OS) layer.
The application layer includes a browser image processing unit (graphics processing unit, GPU) process, a video management service, and a browser host process. The system layer comprises a hard decoding control module and a message hook injection module.
In some embodiments, the video management service detects window minimization events/recovery events through the video management service message hook by sending a window hook injection function to a message hook injection module (e.g., user32. Dll) and injecting the video management service message hook at the browser host process. That is, the video management service transmits a window hook injection function to the message hook injection module, and after receiving the window hook injection function, the message hook injection module transmits the window hook injection function to the browser main process, and injects the video management service message hook, so that the video management service detects a window minimization event/recovery event through the video management service message hook.
In some embodiments, the video management service sends a suspend/resume instruction to the browser GPU process via a hard decode control module (e.g., ntdll. Dll) to control suspension/resume of the hard decode process. That is, the video management service sends a suspend instruction/resume instruction to the hard decoding control module, and after receiving the suspend instruction/resume instruction, the hard decoding control module sends the suspend instruction/resume instruction to the browser GPU process to control suspension/resume of the hard decoding process.
In some embodiments, the video management service of the electronic device 100 injects a hook (hook) function into the video playback process; corresponding to the hook function acquiring and blocking the trigger event (such as the minimized event of the video playing window), the video management service stops the video playing process through the video power saving service (hard decoding control module) to send the hard decoding and rendering instruction of the image data and the image data to the video processing unit (browser GPU process), and releases the blocking operation of the trigger event; in response to the hook function acquiring and blocking the recovery event (e.g., the recovery event of the video playing window), the video management service resumes the video playing process by the hard decoding control module sending the image data and the hard decoding and rendering instructions of the image data to the browser GPU process and unblocking the recovery event, and the hard decoding of the image data starts from the latest independent frame data.
Fig. 4 is a schematic diagram showing an interaction flow of a video playing method when the video playing software is a browser based on a chrome kernel according to an embodiment of the present application. As shown in fig. 4, the process includes, but is not limited to, the following steps:
s401: the video management service 20 enumerates GPU processes based on the chrome kernel browser.
In some embodiments, the video management service 20 obtains a hard decoding process in a chrome kernel based browser. It will be appreciated that the hard decoding process in the chrome kernel based browser is a GPU process.
Illustratively, the video management service 20 may enumerate a process with a "type=gpu-process" in a command line parameter in a sub-process in a browser playing video through command line instructions, which is a GPU process.
S402: the video management service 20 sends a window hook injection function to the browser host process 30.
In some embodiments, the video management service 20 sends a window hook injection function setwindowsookex to the browser host process 30 to inject a message hook (or hook function) into the browser host process 30 through the window hook injection function setwindowsookex.
It is understood that the message hook is used to acquire and block window minimization events and window restoration events.
It will be appreciated that the video management service 20 may send the window hook injection function setwindowsookex to the browser host process 30 by encapsulating all functions that acquire and block window minimize and restore events into one dynamic link library (dynamic link library, DLL) and injecting the dynamic link library (e.g., user32. DLL) into the browser host process 30 to inject the hook function into the browser host process 30, acquire and block window minimize and restore events.
In some embodiments, the video management service 20 sends the window hook injection function to the browser host process 30 by means of the message hook injection module of the OS layer, and specific reference may be made to the related description in fig. 3, which is not repeated here. S403: the browser host process 30 loads the video management service message hook.
In some embodiments, browser host process 30 loads the injected hooking function.
S404: the user 10 performs a window minimizing operation to the browser host process 30.
In some embodiments, performing the window minimization operation by the user 10 to the browser host process 30 may refer to the click operation of the minimization control 101 by the cursor 104 shown in FIG. 1 a.
S405: the browser host process 30 sends a window minimization event to the video management service 20.
In some embodiments, the browser host process 30 sends the received window minimisation event to the video management service 20 and blocks the window minimisation event so that the video management service 20 performs further processing based on the window minimisation event.
S406: video management service 20 sends a suspend instruction to browser GPU process 40.
In some embodiments, video management service 20, upon receiving the window minimize event, sends a suspend instruction to browser GPU process 40 to freeze (or suspend) the browser GPU process (hard decoding process) such that the hard decoding process of the image data is suspended upon receiving the window minimize event.
In some embodiments, the video management service 20 sends the suspension instruction to the browser GPU process 40 to be completed by the hard decoding control module of the OS layer, and specifically, reference may be made to the related description in fig. 3, which is not repeated herein.
S407: the browser GPU process 40 freezes the process.
In some embodiments, upon receipt of the suspend instruction by browser GPU process 40, the hard decoding process is frozen, e.g., invoking the suspend process interface function, ntSupported process, to suspend the hard decoding process, i.e., suspend the hard decoding process on the image data, and unblock the window minimize event.
S408: the user 10 performs a window restoration operation to the browser host process 30.
In some embodiments, the user 10 performing the window restoration operation to the browser host process 30 may be a click operation on the video application icon 1061 through the cursor 104 shown in FIG. 1 b.
S409: the browser host process 30 sends a window restoration event to the video management service 20.
In some embodiments, browser host process 30 sends the received window restoration event to video management service 20 and blocks the window restoration event so that video management service 20 proceeds with further processing based on the window restoration event.
S410: video management service 20 sends a resume instruction to browser GPU process 40.
In some embodiments, video management service 20, upon receiving the window restoration event, sends a restoration instruction to browser GPU process 40 to defrost (or resume) the browser GPU process (hard decoding process) such that the hard decoding process of the image data is resumed (restarted) upon receiving the window restoration event.
In some embodiments, resuming the hard decoding process on the image data may be a hard decoding and rendering process using the latest independent frame (I-frame) data in the data stream of the image data as a start frame.
In some embodiments, the sending of the resume instruction to the browser GPU process 40 by the video management service 20 is performed by the hard decoding control module of the OS layer, and specific reference may be made to the related description in fig. 3, which is not repeated here.
S411: browser GPU process 40 defreezes the process.
In some embodiments, upon receipt of a resume instruction by browser GPU process 40, the hard decoding process is defreezed, e.g., invoking resume process interface function NtRESUMEPRESPROCESS to resume the hard decoding process, i.e., resume hard decoding processing of image data, and unblock the window resume event.
It will be appreciated that the video playing method described above only processes image data (video picture data), and does not process audio data, i.e. the audio data is still playing normally. If the situation that the audio data play is paused occurs after the hard decoding process is frozen in the execution process of the method described in fig. 4, the hard decoding process is frozen after the operation of recovering the hard decoding process is executed until the audio data is played normally.
FIG. 5 illustrates a schematic diagram of interactions of a chrome browser process tree with a video management service, according to an embodiment of the application. As shown in fig. 5, the process includes, but is not limited to, the following steps:
S501: video management service 20 enumerates GPU processes in the browser.
In some embodiments, the video management service 20 obtains a hard decoding process in a chrome kernel based browser. It is understood that the hard-on-frequency decoding process in the chrome kernel based browser is a GPU process.
Illustratively, the video management service 20 may enumerate a process with a "type=gpu-process" in a command line parameter in a sub-process in a browser playing video, which is a GPU process.
S502: video management service 20 detects a window minimization event.
In some embodiments, the video management service 20 detecting a window minimization event may be detecting whether there is a minimization operation of the video play window. The minimizing operation may refer to the click operation of the minimizing control 101 by the cursor 104 shown in fig. 1 a.
S503: video management service 20 sends instructions to browser GPU process 40 to suspend the process.
In some embodiments, video management service 20 sends a suspend instruction to browser GPU process 40 upon receipt of a window minimize event to freeze the browser GPU process such that upon receipt of the window minimize event, hard decoding processing of the image data is suspended.
In some embodiments, the instruction of the video management service 20 to send the suspension process to the browser GPU process 40 is completed by the hard decoding control module of the OS layer, and specific reference may be made to the related description in fig. 3, which is not repeated herein.
S504: video management service 20 detects a window restoration event.
In some embodiments, the video management service 20 detecting a window restoration event may be detecting whether there is a restoration operation to the video playback window. The resume operation may be, for example, a click operation on the video application icon 1061 by the cursor 104 shown in fig. 1 b.
S505: video management service 20 sends instructions to browser GPU process 40 to resume the process.
In some embodiments, video management service 20, upon receiving the window restoration event, sends a restoration instruction to browser GPU process 40 to defrost the browser GPU process such that, upon receiving the window restoration event, the hard decoding process of the image data is restored.
In some embodiments, resuming the hard decoding process on the image data may be performing the hard decoding and rendering process with the latest independent frame data in the data stream of the image data as the start frame.
In some embodiments, the instruction of the video management service 20 to send the resume process to the browser GPU process 40 is completed by the hard decoding control module of the OS layer, and specific reference may be made to the related description in fig. 3, which is not repeated here.
It will be appreciated that, as shown in fig. 5, in the chrome browser process tree 300, the sub-processes of the browser main process 30 may include, in addition to the browser GPU process 40 in the above steps: the application is not limited in this regard as to sub-processes such as network processes, storage processes, page rendering processes, and the like.
It can be understood that, in the above embodiment, the video playing method provided by the embodiment of the present application is described only by taking the video playing software as a browser based on the chrome kernel, the triggering event as a minimizing event of the video playing window, and the recovering event as a recovering event of the video playing window as examples. In other embodiments, the triggering event may also be the absence of a user before the detection of the electronic device or the lack of a user looking at the screen of the electronic device, etc.; the resume event may also be a resume event in which the user reappears before the electronic device is detected, the user gazes back at the screen of the electronic device, the video playback window, etc. The above-mentioned method for detecting the resume event of the user re-appearing before the electronic device, the user re-gazing at the screen of the electronic device, and the video playing window may be an artificial intelligence (artificial intelligence, AI) method. The present application is not particularly limited thereto.
Example two
The technical scheme of the embodiment of the application is described below by taking video playing software as video playing software based on video hard decoding, a triggering event as a minimizing event of a video playing window and a recovering event as a recovering event of the video playing window as examples.
Fig. 6 shows an interaction diagram of software modules of an electronic device when the video playing software is video playing software based on video hard decoding according to an embodiment of the application. As shown in fig. 6, the electronic device 100 includes an application layer and a system (OS) layer.
The application layer comprises a video playing software hard decoding process, a video management service and a video playing software main process. The system layer comprises a remote calling module and a message hook injection module.
In some embodiments, the video management service detects window minimization events/recovery events via a video management service message hook by sending a window hook injection function to a message hook injection module (e.g., user32. Dll) and injecting the video management service message hook at the video playback software host process. That is, the video management service transmits a window hook injection function to the message hook injection module, and the message hook injection module transmits the window hook injection function to the video playing software main process after receiving the window hook injection function, and injects a video management service message hook in the video playing software main process, so that the video management service can minimize events/recovery events through the video management service message hook detection window.
In some embodiments, the video management service replaces the initial callback function in the video playback process with the target callback function through a Hook (Hook) operation, so as to control the target callback function to stop/resume forwarding the content (image data, etc.) of the initial callback function according to the minimized event/resume event. The video management service sends a hooking instruction to the remote calling module, and after the remote calling module receives the hooking instruction, the video management service sends the hooking instruction to the video playing software hard decoding process so that the video playing software hard decoding process executes hooking operation and replaces the initial callback function with the target callback function.
In some embodiments, the video management service sends an instruction for stopping hard decoding/resuming hard decoding to the video playing software hard decoding process through a remote call module (e.g. RPC) to the target callback function replaced by the hooking operation, so as to control the target callback function to stop forwarding/resuming forwarding of the content of the initial callback function to the universal media drive (universal media drive, UMD), and further stop the hard decoding process/resume hard decoding process. The video management service sends an instruction for stopping hard decoding/recovering hard decoding to the remote calling module, and after the remote calling module receives the instruction for stopping hard decoding/recovering hard decoding, the remote calling module sends the instruction for stopping hard decoding/recovering hard decoding to the video playing software hard decoding process, so that when the target callback function is called, the target callback function is controlled to stop forwarding/recovering the content of the initial callback function to a universal media driver (universal media drive, UMD), and then the hard decoding process is stopped/the hard decoding process is recovered.
In some embodiments, the video management service of the electronic device 100 replaces an initial callback function in the video playing process with a target callback function through a hook operation and injects a hook (hook) function into the video playing process; the hook function acquires and blocks a triggering event (such as a minimized event of a video playing window), calls a target callback function, stops sending a hard decoding and rendering instruction of image data and the image data to a video processing unit (such as a GPU), and releases the blocking operation of the triggering event; corresponding to the hook function acquiring and blocking a resume event (e.g., a resume event of a video play window), invoking a target callback function and resuming sending hard decoding and rendering instructions of image data and image data to a video processing unit (e.g., GPU) and unblocking the resume event, and the hard decoding of image data starts from the latest independent frame data.
Fig. 7 is a schematic diagram showing an interaction flow of a video playing method when the video playing software is video playing software based on video hard decoding according to an embodiment of the present application. As shown in fig. 7, the process includes, but is not limited to, the following steps:
S701: video management service 20 sends a hook instruction to video playback software hard decoding process 60.
In some embodiments, video management service 20 sends a hooking instruction to video playback software hard decoding process 60 to cause video playback software hard decoding process 60 to perform a hooking operation upon receiving the hooking instruction.
In some embodiments, the video management service 20 sends the hooking command to the video playing software hard decoding process 60 by means of a remote call module of the OS layer, and specific reference may be made to the related description in fig. 6, which is not repeated here.
S702: video playback software hard decoding process 60 performs a hooking operation.
In some embodiments, the video playing software hard decoding process 60 performs the hooking operation after receiving the hooking instruction, that is, replaces the initial callback function with the target callback function through the hooking operation.
Specifically, the hooking operation may be to obtain a plurality of initial callback functions in the structure d3dddi_devicefus registered by the function CreateDevice implemented according to the framework of the graphics driver model (for example windows display driver model, WDDM) on the UMD process corresponding to the video playing hard decoding process 60, and replace the plurality of initial callback functions with the target callback functions. For example, the initial callback function may refer to table 1.
Table 1 initial callback function table
As shown in table 1, the video hard decode callback function may include: starting a decoding function pfnDecodeBeginFrame, executing a decoding function pfnDecodeExecute, and ending the decoding function pfnDecodeEndFrame; the video post-processing callback function may include: the method comprises the steps of starting a video post-processing function pfnvideo processBeginFrame, executing the video post-processing function pfnvideo processBlt, and ending the video post-processing function pfnvideo processEndFrame.
It is understood that the video hard decode callback function is used to generate GPU commands from the image data and extract the image data, resulting in image data for each frame in the video. Including independent frame (I-frame) data, delta frame (P-frame, B-frame) data, etc.
It can be appreciated that the video post-processing callback function is used for performing operations such as brightness, hue, saturation and the like on frame data, scaling, noise filtering and the like, that is, generating GPU commands at the UMD, so that the GPU commands are sent to the GPU through the UMD, and performing hard decoding and rendering on the image data.
It will be appreciated that the initial callback functions in table 1 are only some examples of initial callback functions, and in other embodiments, the initial callback functions may include other video hard decoding and video post-processing callback functions, which the present application is not limited to.
It may be appreciated that the target callback function is a custom callback function of the electronic device 100, and the initial callback function is replaced by the target callback function to implement that after the window minimizing event is detected, the target callback function is called, and the forwarding of the content (image data, GPU command, etc.) of the initial callback function to the UMD is stopped, so as to stop the hard decoding process; when a window restoration event is detected, the target callback function is called, and the content of the initial callback function is restored (restarted) and forwarded to the UMD so as to restore the hard decoding process.
S703: video management service 20 sends a window hook injection function to video playback software process 50.
In some embodiments, video management service 20 sends a window hook injection function setwindowsookex to video playback software process 50 to inject message hooks into video playback software process 50 via the window hook injection function setwindowsookex.
It is understood that the message hook is used to acquire and block window minimization events and window restoration events.
It will be appreciated that sending the window hook injection function setwindowsookex to the video playback software process 50 by the video management service 20 may be to package all functions that acquire and block window minimization events and window restoration events into one dynamic link library and inject the dynamic link library (e.g., user32. Dll) into the video playback software process 50 to inject the hook function into the video playback software process 50, acquire and block window minimization events and window restoration events.
In some embodiments, the video management service 20 sends the window hook injection function to the video playing software process 50 by means of the message hook injection module of the OS layer, and specific reference may be made to the related description in fig. 6, which is not repeated here.
S704: video playback software process 50 loads the video management service message hook.
In some embodiments, video playback software process 50 loads the injected hook function.
S705: user 10 performs a window minimization operation with video playback software process 50.
In some embodiments, user 10 performing a window minimization operation to video playback software process 50 may refer to a click operation of minimization control 101 by cursor 104 as shown in FIG. 1 a.
S706: video playback software process 50 sends a window minimization event to video management service 20.
In some embodiments, video playback software process 50 sends the received window minimisation event to video management service 20 and blocks the minimisation event so that video management service 20 proceeds with further processing based on the window minimisation event. S707: video management service 20 sends a stop hard decode instruction to video playback software hard decode process 60.
In some embodiments, video management service 20 sends a stop hard decoding instruction to video playback software hard decoding process 60 upon receipt of the window minimizing event to stop the video playback software hard decoding process (hard decoding process) such that the hard decoding process of the image data is suspended upon receipt of the window minimizing event.
In some embodiments, the sending of the instruction to stop hard decoding to the video playing software hard decoding process 60 by the video management service 20 is accomplished by means of a remote call module of the OS layer, and specific reference may be made to the related description in fig. 6, which is not repeated here.
S708: video playback software hard decoding process 60 stops hard decoding.
In some embodiments, the video playing software hard decoding process 60, upon receiving a stop hard decoding instruction, stops the hard decoding process, e.g., calls the target callback function, and stops forwarding the content of the initial callback function to the UMD to stop the hard decoding process, i.e., to halt the hard decoding process, and unblock the minimized event.
S709: user 10 performs a window restoration operation to video playback software process 50.
In some embodiments, the user 10 performing the window restoration operation to the video playback software process 5 may be a click operation on the video application icon 1061 through the cursor 104 shown in FIG. 1 b.
S710: video playback software process 50 sends a window restoration event to video management service 20.
In some embodiments, video playback software process 50 sends the received window restoration event to video management service 20 and blocks the restoration event so that video management service 20 proceeds with further processing based on the window restoration event.
S711: video management service 20 sends a resume hard decode instruction to video playback software hard decode process 60.
In some embodiments, video management service 20, upon receipt of the window restoration event, sends a restore hard decode instruction to video playback software hard decode process 60 to resume the video playback software hard decode process (hard decode process) such that upon receipt of the window restoration event, the hard decode process of the image data is resumed (restarted).
In some embodiments, resuming the hard decoding process on the image data may be performing the hard decoding and rendering process with the independent frame (I-frame) data of the last frame of the image data as the starting frame.
In some embodiments, the sending of the instruction to restore the hard decoding to the video playing software hard decoding process 60 by the video management service 20 is accomplished by means of a remote call module of the OS layer, and specific reference may be made to the related description in fig. 6, which is not repeated here.
S712: video playback software hard decoding process 60 resumes hard decoding.
In some embodiments, after receiving the resume hard decode instruction, the video playback software hard decode process 60 resumes the hard decode process, e.g., calls the target callback function, resumes (restarts) forwarding the content of the initial callback function to the UMD to resume the hard decode process, i.e., resume the hard decode process, and unblock the resume event.
Fig. 8 is a schematic diagram illustrating interaction of a video playing software process with a video management service according to an embodiment of the present application.
As shown in fig. 8, the video management service 20 includes a window minimization detection module 210, a window restoration detection module 220, and a hard decoding control module 230.
In some embodiments, window minimization detection module 210 detects whether there is a minimization operation of the video play window, where the minimization operation may refer to a click operation of minimization control 101 by cursor 104 as shown in fig. 1 a. If window minimization detection is detected, a window minimization event is sent to the hard decode control module 230.
In some embodiments, window restoration detection module 220 detects whether there is a restoration operation of the video play window, where the restoration operation may be, for example, a click operation of video application icon 1061 by cursor 104 shown in fig. 1 b. If a window restoration operation is detected, a window restoration event is sent to the hard decoding control module 230.
In some embodiments, after receiving the window minimizing event, the hard decoding control module 230 controls the video playing software process 50 to stop/resume the hard decoding process, i.e., when the target callback function replaced by the hooking operation is called, the target callback function is controlled to stop/resume forwarding the content of the initial callback function.
It will be appreciated that as shown in fig. 8, the process of video hard decoding in video playback software process 50 may be: video playing software running program; hard decoding each frame of image data and sending to a 3D graphics application programming interface (application programming interface, API), such as Direct3D; executing hooking operation on an initial callback function in the 3D graphic API, and replacing the initial callback function with a target callback function; the interception/release of the image data is controlled by the target callback function, i.e., the transmission/restoration of the transmission to the universal media drive UMD is stopped.
Fig. 9 is a schematic flow chart of a video playing method when the video playing software is video playing software based on video hard decoding according to the embodiment of the application. It will be understood that the main execution body of each step in the flowchart shown in fig. 9 is the electronic device 100. In order to simplify the description, the execution subject of each step will not be repeated in the description of each step of the flow shown in fig. 9. As shown in fig. 9, the process includes, but is not limited to, the following steps:
S901: video is played using hard decoding.
In some embodiments, electronic device 100 plays video using hard decoding, where the video playing software may be any application on electronic device 100 that plays video using hard decoding.
S902: the detection window minimizes events.
In some embodiments, the electronic device 100 detects whether there is a minimizing operation on the video play window, where the minimizing operation may refer to a clicking operation on the minimize control 101 by the cursor 104 as shown in fig. 1 a.
S903: the UMD is prevented from receiving callback functions for video hard decoding and post-processing.
In some embodiments, after the electronic device 100 detects the window minimizing event, the UMD is prevented from receiving the callback functions of the video hard decoding and the post-processing, i.e., the target callback function is called, and the target callback function is controlled to stop forwarding the content of the initial callback functions (the video hard decoding callback function and the video post-processing callback function).
S904: a window restoration event is detected.
In some embodiments, the electronic device 100 detects whether there is a resume operation of the video play window, where the resume operation may be, for example, a click operation of the video application icon 1061 by the cursor 104 shown in fig. 1 b.
S905: the resume UMD receives callback functions for video hard decoding and post-processing and starts hard decoding image data from the latest independent frame. In some embodiments, after the electronic device 100 detects the window restoration event, the restoration UMD receives the callback functions of the video hard decoding and the post-processing, that is, invokes the target callback function, and controls the target callback function to restore the content of the forwarding initial callback functions (the video hard decoding callback function and the video post-processing callback function). And, hard decoding and rendering processing is performed using the latest independent frame (I-frame) data among the image data as a start frame.
It will be appreciated that in some embodiments, after step S905 is performed, step S901 may also be performed continuously, and the video is played using hard decoding.
It will be appreciated that, in other embodiments, each step shown in fig. 9 may be combined, deleted or replaced with other steps that are beneficial to achieving the object of the present application, for example, the step S905 may be split into two steps according to actual requirements, which is not limited herein.
It can be understood that, in the above embodiment, only the video playing software is the video playing software based on video hard decoding, the triggering event is the minimizing event of the video playing window, and the recovering event is the recovering event of the video playing window. In other embodiments, the triggering event may also be the absence of a user before the detection of the electronic device or the lack of a user looking at the screen of the electronic device, etc.; the recovery event may also be the detection of a user before the electronic device appears or the user gazes back at the screen of the electronic device, etc. The present application is not particularly limited thereto.
In summary, in the video playing method provided by the embodiment of the present application, after detecting that the user does not pay attention to the picture content of the video, the processing process of the image data in the electronic device is paused, and after detecting the resume event (the user pays attention to the picture of the video again), the processing process of the image data in the electronic device is resumed. After the user does not pay attention to the picture content of the video, the decoding and rendering of the image data are suspended, so that the power consumption of the electronic equipment can be reduced, and the endurance time of the electronic equipment is further prolonged.
It can be understood that after the processing process of the image data is resumed, the image is automatically displayed from the latest independent frame data, and the situations of black screen, splash screen and the like cannot occur, i.e. the viewing experience of the user on the video cannot be affected.
Table 2 shows a table of duration versus situation of playing video using the video playing method provided by the embodiment of the present application and not using the video playing method provided by the embodiment of the present application.
As shown in table 2, in the first production verification test stage (production verification test, pvt 1), the model SKU1, the memory micro, the solid state disk (solid state drive, SSD) WD, and the integrated display TMX2007, the endurance time of the electronic device before optimization (video playing method not provided by the embodiment of the present application) was 6.3 hours, the endurance time after the first optimization (video playing method provided by the embodiment of the present application) was 7.58 hours, and the endurance time after the second optimization (video playing method provided by the embodiment of the present application) was 7.7 hours. In the second production verification test stage (production verification test, PVT 2), the electronic device with model SKU1, memory Samsung, SSD WD and unique TMX2007 has a duration of 6.65 hours before optimization (video playing method provided by the embodiment of the application is not used for playing video), a duration of 8 hours after the first optimization (video playing method provided by the embodiment of the application is used for playing video), and a duration of 8 hours after the second optimization (video playing method provided by the embodiment of the application is used for playing video).
Table 2 table of duration versus situation
It can be understood that the data in table 2 are obtained only by playing video on the Edge browser by using the video playing method provided by the embodiment of the application (i.e. normally suspending the GPU process of the Edge browser) and not using the video playing method provided by the embodiment of the application to play video test under the condition that the battery of the same electronic device is full and the power is not turned on. Therefore, the video playing method provided by the embodiment of the application can effectively improve the endurance time of the electronic equipment.
In order to better understand the technical solution of the embodiments of the present application, the structure of the electronic device related to the present application is described below with reference to the accompanying drawings.
Illustratively, fig. 10 shows a schematic structural diagram of an electronic device 100 according to an embodiment of the present application.
Further, fig. 10 illustrates a schematic structural diagram of an electronic device 100, according to some embodiments of the present application. As shown in fig. 10, electronic device 100 includes one or more processors 110, a system memory 120, a non-volatile memory (Non Volatile Memory, NVM) 130, a communication interface 140, an input/output (I/O) device 150, and system control logic 160 for coupling processor 110, system memory 120, non-volatile memory 130, communication interface 140, and input/output (I/O) device 150. Wherein:
The processor 110 may be used to control an electronic device to perform the video playback method of the present application, wherein the processor 110 may include one or more processing units, for example, a processing module or processing circuit that may include a central processing unit (central processing unit, CPU), an image processing unit (graphics processing unit, GPU), a digital signal processing unit (digital signal processor, DSP), a microprocessor (micro programmedcontrol unit, MCU), an AI processor, or a programmable logic device (field programmable gate array, FPGA) may include one or more single-core or multi-core processors.
The system memory 120 is a volatile memory such as random access memory (random access memory, RAM), double data rate synchronous dynamic random access memory (doubledata rate synchronous dynamic random access memory, DDR SDRAM), etc. The system memory is used to temporarily store data and/or instructions.
Nonvolatile memory 130 may include one or more tangible, non-transitory computer-readable media for storing data and/or instructions. In some embodiments, nonvolatile memory 130 may include any suitable nonvolatile memory such as flash memory and/or any suitable nonvolatile storage device, such as a Hard Disk Drive (HDD), compact Disc (CD), digital versatile disc (digital versatile disc, DVD), SSD, or the like. In some embodiments, the nonvolatile memory 130 may also be a removable storage medium, such as a Secure Digital (SD) memory card or the like.
In particular, system memory 120 and nonvolatile memory 130 may each include: a temporary copy and a permanent copy of instruction 170. The instructions 170 may include: the execution by the processor 110 causes the electronic device 100 to implement the video playing method provided by the embodiments of the present application.
Communication interface 140 may include a transceiver to provide a wired or wireless communication interface for electronic device 100 to communicate with any other suitable device via one or more networks. In some embodiments, the communication interface 140 may be integrated with other components of the electronic device 100, e.g., the communication interface 140 may be integrated in the processor 110. In some embodiments, the electronic device 100 may communicate with other devices through the communication interface 140, e.g., the electronic device 100 may obtain video playback methods to be run from the other electronic devices through the communication interface 140.
Input/output (I/O) devices 150 may include input devices such as a keyboard, mouse, etc., output devices such as a display, etc., through which a user may interact with electronic device 100.
The system control logic 160 may include any suitable interface controller to provide any suitable interface with other modules of the electronic device 100. For example, in some embodiments, system control logic 160 may include one or more memory controllers to provide an interface to system memory 120 and non-volatile memory 130.
In some embodiments, at least one of the processors 110 may be packaged together with logic for one or more controllers of the system control logic 160 to form a system package (system in package, siP). In other embodiments, at least one of the processors 110 may also be integrated on the same chip with logic for one or more controllers of the system control logic 160 to form a system on chip (SoC).
It is understood that electronic device 100 includes, but is not limited to, cell phones, wearable devices (e.g., smartwatches, etc.), tablet computers, desktop computers, laptops, handheld computers, notebook computers, ultra mobile personal computers (ultra mobile personal computer, UMPC), netbooks, and cellular phones, personal digital assistants (personal digital assistant, PDA), augmented Reality (AR)/Virtual Reality (VR) devices, etc., embodiments of the present application are not limited.
It is to be understood that the configuration of the electronic device 100 shown in fig. 10 is merely an example, and in other embodiments, the electronic device 100 may include more or fewer components than shown, or may combine certain components, or may split certain components, or may have a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Embodiments of the disclosed mechanisms may be implemented in hardware, software, firmware, or a combination of these implementations. Embodiments of the application may be implemented as a computer program or program code that is executed on a programmable system comprising at least one processor, a storage system (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device.
Program code may be applied to input instructions to perform the functions described herein and generate output information. The output information may be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (digitalsignal processor, DSP), microcontroller, application specific integrated circuit (application specific integrated circuit, ASIC), or microprocessor.
The program code may be implemented in a high level procedural or object oriented programming language to communicate with a processing system. Program code may also be implemented in assembly or machine language, if desired. Indeed, the mechanisms described in the present application are not limited in scope by any particular programming language. In either case, the language may be a compiled or interpreted language.
In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried by or stored on one or more transitory or non-transitory machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer readable media. Thus, a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including but not limited to floppy diskettes, optical disks, read-only memories (CD ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (random accessmemory, RAM), erasable programmable read-only memories (erasable programmable read only memory, EPROM), electrically erasable programmable read-only memories (electrically erasable programmable read only memory, EEPROM), magnetic or optical cards, flash memory, or tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signal digital signals, etc.) using the internet in an electrical, optical, acoustical or other form of propagated signal. Thus, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
In the drawings, some structural or methodological features may be shown in a particular arrangement and/or order. However, it should be understood that such a particular arrangement and/or ordering may not be required. Rather, in some embodiments, these features may be arranged in a different manner and/or order than shown in the illustrative figures. Additionally, the inclusion of structural or methodological features in a particular figure is not meant to imply that such features are required in all embodiments, and in some embodiments, may not be included or may be combined with other features.
It should be noted that, in the embodiments of the present application, each unit/module mentioned in each device is a logic unit/module, and in physical terms, one logic unit/module may be one physical unit/module, or may be a part of one physical unit/module, or may be implemented by a combination of multiple physical units/modules, where the physical implementation manner of the logic unit/module itself is not the most important, and the combination of functions implemented by the logic unit/module is only a key for solving the technical problem posed by the present application. Furthermore, in order to highlight the innovative part of the present application, the above-described device embodiments of the present application do not introduce units/modules that are less closely related to solving the technical problems posed by the present application, which does not indicate that the above-described device embodiments do not have other units/modules.
It should be noted that, in the examples and descriptions of this patent, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
While the application has been shown and described with reference to certain embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the application.

Claims (17)

1. A video playing method applied to an electronic device, comprising:
playing a first video through a first application;
in the playing process of the first video, detecting that the playing condition of the first video meets a stop condition;
And stopping decoding the image data to be played in the first video.
2. The method of claim 1, wherein the stop condition comprises at least one of:
the play window of the first video is minimized;
and the user is not detected in the preset range of the electronic equipment in the first time interval.
3. The method of claim 1, wherein the first application is a browser and,
the stopping decoding the image data to be played in the first video includes:
suspending the image processing process of the browser.
4. A method according to claim 3, wherein suspending the image processing process of the browser comprises:
the video management service of the electronic equipment sends a suspension instruction to an image processing process of a browser of the electronic equipment through a hard decoding control module of the electronic equipment;
and the image processing process of the browser executes a suspending operation.
5. The method of claim 4, wherein the detecting of the play condition of the first video is achieved by:
the video management service of the electronic equipment sends a window hook injection function to a message hook injection module of the electronic equipment;
And the message hook injection module of the electronic equipment injects a video management service message hook in a browser main process of the electronic equipment, so that the video management service detects the playing condition of the first video through the video management service message hook.
6. The method of claim 1, wherein the first application is video playback software based on video hard decoding, and wherein,
the stopping decoding the image data to be played in the first video includes:
replacing an initial callback function in the hard decoding process of the video playing software with a target callback function, wherein when the initial callback function is called, the image data to be played is sent to a video processing unit in the hard decoding process of the video playing software;
and calling the target callback function, and stopping sending the image data to be played to a video processing unit in the hard decoding process of the video playing software.
7. The method of claim 6, wherein replacing the initial callback function in the hard decoding process of the video playing software with the target callback function comprises:
The video management service of the electronic equipment sends a hooking instruction to a remote calling module of the electronic equipment;
the remote calling module sends a hooking instruction to a hard decoding process of the video playing software;
and the hard decoding process of the video playing software executes hooking operation, and replaces the initial callback function with the target callback function.
8. The method of claim 7, wherein the invoking the target callback function to stop sending the image data to be played to the video processing unit in the hard decoding process of the video playing software comprises:
the video management service of the electronic equipment sends an instruction for stopping hard decoding to a remote call module of the electronic equipment;
the remote calling module sends an instruction for stopping hard decoding to a hard decoding process of the video playing software;
and the hard decoding process of the video playing software calls the target callback function, and stops sending the image data to be played to a video processing unit in the hard decoding process of the video playing software.
9. The method of claim 8, wherein the detecting of the play condition of the first video is achieved by:
The video management service of the electronic equipment sends a window hook injection function to a message hook injection module of the electronic equipment;
and the message hook injection module of the electronic equipment injects a video management service message hook into a video playing software main process of the electronic equipment, so that the video management service detects the playing condition of the first video through the video management service message hook.
10. The method according to claim 5 or 9, further comprising:
after stopping decoding the image data to be played in the first video, detecting that the playing condition of the first video meets a recovery condition;
and restoring and decoding the image data to be played in the first video.
11. The method of claim 10, wherein the recovery condition comprises at least one of:
the play window of the first video is restored;
and detecting a user in a preset range of the electronic equipment in a first time interval.
12. The method of claim 10, wherein the first application is a browser and,
the restoring decoding the image data to be played in the first video includes:
Restoring the image processing process of the browser;
acquiring a first time when the playing condition of the first video meets the recovery condition;
and decoding the image data to be played from the independent frame data corresponding to the first time in the image data to be played.
13. The method of claim 12, wherein the resuming the image processing process of the browser is accomplished by:
the video management service of the electronic equipment sends a recovery instruction to an image processing process of a browser of the electronic equipment through a hard decoding control module of the electronic equipment;
and the image processing process of the browser executes a recovery operation.
14. The method of claim 10, wherein the first application is video playback software based on video hard decoding, and wherein,
the restoring decoding the image data to be played in the first video includes:
calling a target callback function, and sending the image data to be played to a video processing unit in a hard decoding process of the video playing software;
acquiring a second time when the playing condition of the first video meets the recovery condition;
And decoding the image data to be played from the independent frame data corresponding to the second time in the image data to be played.
15. The method of claim 14, wherein the calling the target callback function sends the image data to be played to a video processing unit in a hard decoding process of the video playing software, comprising:
the video management service of the electronic equipment sends an instruction for recovering hard decoding to a remote call module of the electronic equipment;
the remote calling module sends an instruction for recovering hard decoding to the hard decoding process of the video playing software;
and the hard decoding process of the video playing software calls the target callback function and sends the image data to be played to a video processing unit in the hard decoding process of the video playing software.
16. A readable medium having stored thereon instructions which, when executed on an electronic device, cause the electronic device to perform the method of any of claims 1 to 15.
17. An electronic device, comprising:
a memory for storing instructions for execution by one or more processors of the electronic device, and,
A processor, being one of the processors of an electronic device, for performing the method of any of claims 1 to 15.
CN202311046469.4A 2023-08-18 Video playing method, readable medium and electronic device Active CN116761032B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311046469.4A CN116761032B (en) 2023-08-18 Video playing method, readable medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311046469.4A CN116761032B (en) 2023-08-18 Video playing method, readable medium and electronic device

Publications (2)

Publication Number Publication Date
CN116761032A true CN116761032A (en) 2023-09-15
CN116761032B CN116761032B (en) 2024-04-23

Family

ID=

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130347002A1 (en) * 2012-06-21 2013-12-26 Microsoft Corporation Performant runtime pause with no cpu utilization
CN105828195A (en) * 2016-03-10 2016-08-03 乐视云计算有限公司 Suspending resuming method and apparatus of player
CN106792075A (en) * 2017-01-04 2017-05-31 合网络技术(北京)有限公司 Video broadcasting method and device
CN107613368A (en) * 2017-09-26 2018-01-19 珠海市魅族科技有限公司 Video pause method and apparatus, computer installation and computer-readable recording medium
CN109963191A (en) * 2017-12-14 2019-07-02 中兴通讯股份有限公司 A kind of processing method of video information, device and storage medium
CN110213636A (en) * 2018-04-28 2019-09-06 腾讯科技(深圳)有限公司 Video frame generating method, device, storage medium and the equipment of Online Video
CN110248240A (en) * 2019-06-11 2019-09-17 北京达佳互联信息技术有限公司 Playback method, device, electronic equipment and the storage medium of video
CN111436004A (en) * 2019-01-11 2020-07-21 腾讯科技(深圳)有限公司 Video playing method, device and equipment and computer readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130347002A1 (en) * 2012-06-21 2013-12-26 Microsoft Corporation Performant runtime pause with no cpu utilization
CN105828195A (en) * 2016-03-10 2016-08-03 乐视云计算有限公司 Suspending resuming method and apparatus of player
CN106792075A (en) * 2017-01-04 2017-05-31 合网络技术(北京)有限公司 Video broadcasting method and device
CN107613368A (en) * 2017-09-26 2018-01-19 珠海市魅族科技有限公司 Video pause method and apparatus, computer installation and computer-readable recording medium
CN109963191A (en) * 2017-12-14 2019-07-02 中兴通讯股份有限公司 A kind of processing method of video information, device and storage medium
CN110213636A (en) * 2018-04-28 2019-09-06 腾讯科技(深圳)有限公司 Video frame generating method, device, storage medium and the equipment of Online Video
CN111436004A (en) * 2019-01-11 2020-07-21 腾讯科技(深圳)有限公司 Video playing method, device and equipment and computer readable storage medium
CN110248240A (en) * 2019-06-11 2019-09-17 北京达佳互联信息技术有限公司 Playback method, device, electronic equipment and the storage medium of video

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
月疯: "hook(钩子函数)", pages 8, Retrieved from the Internet <URL:https://blog.csdn.net/chehec2010/article/details/91360772> *
码肥人壮: "SetWindowsHookEx函数详解", pages 1, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_42887343/article/details/115209343> *

Similar Documents

Publication Publication Date Title
CN111163345B (en) Image rendering method and device
CN107925749B (en) Method and apparatus for adjusting resolution of electronic device
KR20170097414A (en) Electronic device and operating method thereof
US10338976B2 (en) Method and apparatus for providing screenshot service on terminal device and storage medium and device
US11467717B2 (en) Optimizing window resize actions for remoted applications
CN107797833A (en) The interface display method of application program on smart machine
US20220058772A1 (en) Image Processing Method and Device
CN104915200B (en) The rendering intent of frame of video processing in Mobile operating system
EP4123983A1 (en) Video stream playing control method and apparatus, and storage medium
US20160275917A1 (en) Predictive pre-decoding of encoded media item
CN115576645A (en) Virtual processor scheduling method and device, storage medium and electronic equipment
CN116761032B (en) Video playing method, readable medium and electronic device
US10002589B2 (en) Retaining user selected screen area on user equipment
US10645306B2 (en) Method for producing media file and electronic device thereof
CN115469816B (en) Method, device, equipment and storage medium for switching reading and writing of memory
CN116761032A (en) Video playing method, readable medium and electronic device
CN114785887A (en) Screen projection control method and device, electronic equipment and computer readable storage medium
CN112988105A (en) Playing state control method and device, electronic equipment and storage medium
CN111467797A (en) Game data processing method and device, computer storage medium and electronic equipment
CN109669764B (en) Processing method, apparatus, device and machine readable medium
CN108235144B (en) Playing content obtaining method and device and computing equipment
WO2021121142A1 (en) Method for controlling animation refresh request, device, computer apparatus, and storage medium
US11907599B2 (en) Information processing method, apparatus, electronic device, and storage medium
CN117241089A (en) Video processing method, electronic device, and readable storage medium
CN117676248A (en) Video playing control method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant