Power consumption control method and device, equipment and storage medium

By detecting the number of codec instances in electronic devices, identifying video scenes and controlling power consumption, the problem of rapid increase in power consumption of electronic devices is solved, and battery life and user experience are improved.

CN119126959APending Publication Date: 2024-12-13BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310700296.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-13
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

With the enrichment of functions of electronic devices, the frequent use of video processing functions leads to a rapid increase in power consumption, and there is a problem of waste of electricity.

Method used

By detecting the number of codec instances of each application in the electronic device, the current video scene is determined, and the power consumption of the electronic device is controlled based on the scene, such as reducing the CPU frequency, freezing the background codec instance, and reducing the codec performance parameters.

Benefits of technology

It realizes accurate identification of video scenes of electronic devices, and takes corresponding power consumption control measures to reduce power consumption, improve the battery life of electronic devices, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119126959A_ABST
    Figure CN119126959A_ABST
Patent Text Reader

Abstract

The invention relates to a power consumption control method and device, equipment and a storage medium, and the method comprises the steps: detecting the number of codec instances of each application program in electronic equipment, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances; determining a current video scene of the electronic equipment based on the number of codec instances; and controlling the power consumption of the electronic equipment based on the current video scene. The power consumption of the electronic equipment is reduced, the cruising ability of the electronic equipment is improved, and then the use experience of a user can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of terminal technology, and in particular to a power consumption control method, device, equipment and storage medium. Background Art

[0002] With the popularity of electronic devices such as smartphones and tablets, more and more people are using the rich functions provided by these electronic devices. Among them, video processing functions such as video playback, video recording, and video calls are becoming more and more popular. However, as electronic devices become better and more functional, people use electronic devices more and more frequently, and the power consumption of electronic devices is also increasing. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the embodiments of the present disclosure provide a power consumption control method, apparatus, device and storage medium to solve the defects in the related art.

[0004] According to a first aspect of an embodiment of the present disclosure, a power consumption control method is provided, the method comprising:

[0005] Detecting the number of codec instances of each application in the electronic device, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances;

[0006] determining a current video scene of the electronic device based on the number of codec instances;

[0007] The power consumption of the electronic device is controlled based on the current video scene.

[0008] In some embodiments, detecting the number of codec instances of each application in the electronic device includes:

[0009] Acquire currently updated codec identification information, where the codec identification information is updated based on creation and / or destruction of codec instances of the respective applications in the electronic device;

[0010] The codec instance quantity is determined based on the codec identification information.

[0011] In some embodiments, the method further comprises updating the codec identification information based on:

[0012] receiving a notification message sent by a first application among the applications when creating or destroying a first codec instance, wherein the notification message includes first codec identification bit information corresponding to the first codec instance;

[0013] The current codec identification information is updated based on the first codec identification information to obtain the currently updated codec identification information.

[0014] In some embodiments, the method further comprises:

[0015] Searching for the first application in a preset whitelist, wherein the whitelist includes pre-specified video scene applications;

[0016] In response to finding the first application in the whitelist, the operation of updating the current codec identification information based on the first codec identification information is performed.

[0017] In some embodiments, determining the current video scene of the electronic device based on the number of codec instances includes:

[0018] In response to the number of codec instances satisfying a preset number condition corresponding to a preset video scene, the current video scene is determined to be the preset video scene, the preset video scene includes a single video scene and / or a mixed video scene, the single video scene includes at least one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene, and the mixed video scene includes at least two of the single video scenes.

[0019] In some embodiments, controlling the power consumption of the electronic device based on the current video scene includes:

[0020] In response to the current video scene being the single video scene, comparing the number of codec instances with a first number threshold;

[0021] In response to the number of codec instances being less than or equal to the first number threshold, reducing a current frequency of a CPU of the electronic device.

[0022] In some embodiments, controlling the power consumption of the electronic device based on the current video scene includes:

[0023] In response to the current video scene being the video playback scene or a mixed video scene including the video playback scene, detecting a running state of a second application program that is currently playing the video;

[0024] In response to detecting that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application is frozen.

[0025] In some embodiments, controlling the power consumption of the electronic device based on the current video scene includes:

[0026] In response to the current video scene being the mixed video scene and detecting that a third application in the electronic device is creating a third codec, performance parameters of the third codec are reduced, the performance parameters including resolution and / or frame rate.

[0027] In some embodiments, controlling the power consumption of the electronic device based on the current video scene includes:

[0028] In response to the current video scene being the single video scene and detecting that a third application in the electronic device is creating a third codec, comparing the number of codec instances with a second number threshold;

[0029] In response to the number of codec instances being greater than or equal to the second number threshold, a performance parameter of the third codec is reduced, the performance parameter comprising resolution and / or frame rate.

[0030] According to a second aspect of an embodiment of the present disclosure, a power consumption control device is provided, the device comprising:

[0031] A quantity detection module, used to detect the number of codec instances of each application in the electronic device, wherein the number of codec instances includes a first number of encoder instances and / or a second number of decoder instances;

[0032] A scene determination module, configured to determine a current video scene of the electronic device based on the number of codec instances;

[0033] A power consumption control module is used to control the power consumption of the electronic device based on the current video scene.

[0034] In some embodiments, the quantity detection module includes:

[0035] An information acquisition unit, configured to acquire currently updated codec identification information, wherein the codec identification information is updated based on creation and / or destruction of codec instances of the respective applications in the electronic device;

[0036] A quantity determining unit is used to determine the quantity of the codec instances based on the codec identification information.

[0037] In some embodiments, the apparatus further comprises an identification information updating module;

[0038] The identification information updating module includes:

[0039] A message receiving unit, configured to receive a notification message sent by a first application among the applications when creating or destroying a first codec instance, wherein the notification message includes first codec identification bit information corresponding to the first codec instance;

[0040] An information updating unit is used to update the current codec identification information based on the first codec identification information to obtain the currently updated codec identification information.

[0041] In some embodiments, the identification information updating module further includes:

[0042] A program search unit, configured to search for the first application in a preset white list, wherein the white list includes pre-specified video scene applications;

[0043] The information updating unit is further configured to, in response to finding the first application in the whitelist, execute the operation of updating the current codec identification information based on the first codec identification bit information.

[0044] In some embodiments, the scene determination module is also used to determine that the current video scene is the preset video scene in response to the number of codec instances satisfying a preset number condition corresponding to a preset video scene, the preset video scene including a single video scene and / or a mixed video scene, the single video scene including at least one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene, and the mixed video scene including at least two of the single video scenes.

[0045] In some embodiments, the power consumption control module includes a first control unit;

[0046] The first control unit is used to:

[0047] In response to the current video scene being the single video scene, comparing the number of codec instances with a first number threshold;

[0048] In response to the number of codec instances being less than or equal to the first number threshold, reducing a current frequency of a CPU of the electronic device.

[0049] In some embodiments, the power consumption control module includes a second control unit;

[0050] The second control unit is used for:

[0051] In response to the current video scene being the video playback scene or a mixed video scene including the video playback scene, detecting a running state of a second application program that is currently playing the video;

[0052] In response to detecting that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application is frozen.

[0053] In some embodiments, the power consumption control module includes a third control unit;

[0054] The third control unit is used for:

[0055] In response to the current video scene being the mixed video scene and detecting that a third application in the electronic device is creating a third codec, performance parameters of the third codec are reduced, the performance parameters including resolution and / or frame rate.

[0056] In some embodiments, the power consumption control module includes a fourth control unit;

[0057] The fourth control unit is used for:

[0058] In response to the current video scene being the single video scene and detecting that a third application in the electronic device is creating a third codec, comparing the number of codec instances with a second number threshold;

[0059] In response to the number of codec instances being greater than or equal to the second number threshold, a performance parameter of the third codec is reduced, the performance parameter comprising resolution and / or frame rate.

[0060] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, the device comprising:

[0061] a processor and a memory for storing a computer program;

[0062] Wherein, the processor is configured to implement, when executing the computer program:

[0063] Detecting the number of codec instances of each application in the electronic device, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances;

[0064] determining a current video scene of the electronic device based on the number of codec instances;

[0065] The power consumption of the electronic device is controlled based on the current video scene.

[0066] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the following is implemented:

[0067] Detecting the number of codec instances of each application in the electronic device, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances;

[0068] determining a current video scene of the electronic device based on the number of codec instances;

[0069] The power consumption of the electronic device is controlled based on the current video scene.

[0070] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0071] The present disclosure detects the number of codec instances of each application in an electronic device, the number of codec instances including a first number of encoder instances and / or a second number of decoder instances, and determines the current video scene of the electronic device based on the number of codec instances, and then controls the power consumption of the electronic device based on the current video scene. This can achieve accurate identification of different video scenes of the electronic device, and then accurately adopt a power consumption control method corresponding to the current video scene to control the power consumption of the electronic device, which is beneficial to reducing the power consumption of the electronic device, improving the battery life of the electronic device, and then improving the user experience.

[0072] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0074] Figure 1 is a flow chart of a power consumption control method according to an exemplary embodiment of the present disclosure;

[0075] Figure 2 is a flowchart showing how to detect the number of codec instances of each application in an electronic device according to an exemplary embodiment of the present disclosure;

[0076] Figure 3 is a flowchart showing how to update the codec identification information according to an exemplary embodiment of the present disclosure;

[0077] Figure 4 is a flowchart showing how to control the power consumption of the electronic device based on the current video scene according to an exemplary embodiment of the present disclosure;

[0078] Figure 5Ais a flowchart showing how to control the power consumption of the electronic device based on the current video scene according to another exemplary embodiment of the present disclosure;

[0079] Figure 5B is a schematic diagram of a system framework according to an exemplary embodiment of the present disclosure;

[0080] Figure 6 is a flowchart showing how to control the power consumption of the electronic device based on the current video scene according to another exemplary embodiment of the present disclosure;

[0081] Figure 7 is a block diagram of a power consumption control device according to an exemplary embodiment of the present disclosure;

[0082] Figure 8 is a block diagram of another power consumption control device according to an exemplary embodiment of the present disclosure;

[0083] Fig. 9 It is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0084] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0085] With the popularity of electronic devices such as smartphones and tablets, more and more people are using the rich functions provided by these electronic devices. Among them, video processing functions such as video playback, video recording, and video calls are becoming more and more popular. However, as electronic devices become better and more functional, people use electronic devices more and more frequently, and the power consumption of electronic devices is also increasing.

[0086] For example, when an application that provides a video processing function switches from the foreground to the background, it will continue to perform video encoding and decoding in the background, causing the electronic device to continue to consume power. On the other hand, in order to ensure the operating performance of the application that provides the video processing function, the CPU frequency of the electronic device is usually set higher. However, a higher CPU frequency will result in higher power consumption, and sometimes only a few applications may be running in an electronic device (for example, only one video playback application, etc.), and the electronic device does not need to have high computing performance, resulting in a waste of power in the electronic device.

[0087] In view of this, the present disclosure provides the following power consumption control method, apparatus, device and storage medium, which can improve the battery life of electronic devices by accurately identifying different video scenes of electronic devices and controlling the power consumption of electronic devices based on different video scenes, thereby improving the user experience.

[0088] Figure 1 is a flow chart of a power consumption control method according to an exemplary embodiment; the method of this embodiment can be executed by a power consumption control device, which can be configured in an electronic device, such as a server, a workstation, a personal computer, a mobile terminal (such as a mobile phone, a tablet computer, etc.), a wearable device (such as glasses, a watch, etc.), etc. Figure 1 As shown, the method includes the following steps S101-S103:

[0089] In step S101, the number of codec instances of each application in the electronic device is detected.

[0090] In this embodiment, the electronic device can detect the number of codec instances of each application installed in the electronic device based on a set period.

[0091] The above-mentioned number of codec instances may include a first number of encoder instances and / or a second number of decoder instances.

[0092] It can be understood that the above-mentioned applications may be applications that need to use media codecs (MediaCodec) to perform video processing tasks such as video playback, video recording, video calls, and video transcoding. When performing corresponding video processing tasks, these programs need to create codec instances (i.e., encoder instances and / or decoder instances).

[0093] In some embodiments, the electronic device may select a detection method in the related art to detect the number of codec instances of each application in the electronic device based on actual needs. This embodiment does not limit the specific detection method.

[0094] In some other embodiments, the electronic device may also be based on the following Figure 2 The method of the embodiment shown is to detect the number of codec instances of each application in the electronic device, and this embodiment will not be described in detail.

[0095] In step S102, a current video scene of the electronic device is determined based on the number of codec instances.

[0096] In this embodiment, after detecting the number of codec instances of each application in the electronic device, the electronic device may determine the current video scene of the electronic device based on the number of codec instances.

[0097] In some embodiments, conditions on the number of codec instances corresponding to various preset video scenes can be pre-set. Then, when the electronic device detects the number of codec instances of each application in the electronic device, it can determine which preset video scene the number of codec instances satisfies the condition on the number of codec instances, thereby determining the current video scene of the electronic device.

[0098] That is, the electronic device may determine that the current video scene is the preset video scene in response to the number of the codec instances satisfying a preset number condition corresponding to the preset video scene.

[0099] Exemplarily, the above-mentioned preset video scenes may include a single video scene and / or a mixed video scene. The above-mentioned single video scene may further include at least one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene; and the mixed video scene may include at least two of the above-mentioned single video scenes, such as "video playback scene + video recording scene", "video playback scene + video call scene + video transcoding scene", etc.

[0100] For example, when the number of encoder instances of an APP in an electronic device is 0 and the number of decoder instances is 1, it can be determined that the APP is playing a video; when the number of encoder instances of an APP in an electronic device is 1 and the number of decoder instances is 0, it can be determined that the APP is recording a video; when the number of encoder instances of an APP in an electronic device is 1 and the number of decoder instances is 1, it can be determined that the APP is making a video call or video transcoding.

[0101] On this basis, when there is only an application for video playback in the electronic device, but no application for video recording, video calls or video transcoding, it can be determined that the current video scene of the electronic device is a video playback scene in a single video scene (referred to as the "video playback scene" for short); similarly, when there is only an application for video recording in the electronic device, but no application for video playback, video calls or video transcoding, it can be determined that the current video scene of the electronic device is a video recording scene in a single video scene (referred to as the "video recording scene" for short), which are not listed one by one here.

[0102] When there are two or more video processing applications in an electronic device, such as an application for video playback and an application for video recording, or an application for video calls and an application for video transcoding, it can be determined that the current video scene of the electronic device is a mixed video scene, which are not listed one by one here.

[0103] In step S103, the power consumption of the electronic device is controlled based on the current video scene.

[0104] In this embodiment, after the current video scene of the electronic device is determined based on the number of codec instances, the power consumption of the electronic device may be controlled based on the current video scene.

[0105] In some embodiments, the corresponding power consumption control mode can be set in advance based on the requirements of different video scenes, and then when the electronic device determines the current video scene based on the number of codec instances, the power consumption control mode corresponding to the current video scene can be determined to adjust the performance of the electronic device or adjust the operating parameters of the application in the electronic device, so as to control the power consumption of the electronic device. Since the corresponding power consumption control mode is set in advance based on the requirements of different video scenes, the accuracy of determining the power consumption control mode can be improved, and the power consumption of the electronic device can be accurately controlled, which is conducive to reducing the power consumption of the electronic device and improving the endurance of the electronic device.

[0106] In some other embodiments, the above-mentioned method of controlling the power consumption of the electronic device based on the current video scene can also refer to the following Figures 4 to 6 The embodiment shown is not described in detail here.

[0107] As can be seen from the above description, the method of this embodiment detects the number of codec instances of each application in the electronic device, the number of codec instances including a first number of encoder instances and / or a second number of decoder instances, and determines the current video scene of the electronic device based on the number of codec instances, and then controls the power consumption of the electronic device based on the current video scene. This can accurately identify different video scenes of the electronic device, and then accurately adopt the power consumption control method corresponding to the current video scene to control the power consumption of the electronic device, which is beneficial to reducing the power consumption of the electronic device, improving the battery life of the electronic device, and then improving the user experience.

[0108] Figure 2 It is a flowchart showing how to detect the number of codec instances of each application in an electronic device according to an exemplary embodiment of the present disclosure; based on the above embodiment, this embodiment uses how to detect the number of codec instances of each application in an electronic device as an example to illustrate.

[0109] like Figure 2 As shown, the detection of the number of codec instances of each application in the electronic device in the above step S101 may include the following steps S201-S202:

[0110] In step S201, the currently updated codec identification information is obtained.

[0111] In this embodiment, when the electronic device needs to detect the number of codec instances of each application in the electronic device, the currently updated codec identification information can be obtained.

[0112] The codec identification information may be information stored in a target process (eg, ServiceC) pre-created in the electronic device, and the codec identification information may be updated based on creation and / or destruction of codec instances of each application in the electronic device.

[0113] That is to say, when an application in an electronic device creates and / or destroys its own codec instance, the codec identification information stored in the above target process can be updated accordingly, so that the number of codec instances of each application in the electronic device can be timely and accurately reflected through the updated codec identification information. Among them, the codec identification information can include the identification bit corresponding to the codec instance of each application (i.e., an application that can perform video processing tasks such as video playback and video recording). The identification bit can be used to indicate the position of the codec of each application corresponding to the above codec identification information.

[0114] For example, the above codec identification information can be a 64-bit attribute information, and every 2 bits in the attribute information can be used to indicate the identification bit corresponding to the codec instance of an APP. For example, "01" means that the APP has only created a decoder instance, "10" means that the APP has only created an encoder instance, "11" means that the APP has created both a decoder instance and an encoder instance, and "00" means that the APP has not created a decoder instance or an encoder instance.

[0115] In step S202, the number of codec instances is determined based on the codec identification information.

[0116] In this embodiment, after the currently updated codec identification information is obtained, the number of codec instances may be determined based on the codec identification information.

[0117] Still taking the codec identification information as 64-bit attribute information as an example, after obtaining the currently updated codec identification information, the number of codec instances can be determined by counting the values ​​of each identification bit of the attribute information. For example, if the codec identification information is "01100...00", the number of codec instances can be determined to be "encoder instance number 1; decoder instance number 1". For another example, if the codec identification information is "010100...00", the number of codec instances can be determined to be "encoder instance number 0; decoder instance number 2".

[0118] From the above description, it can be seen that this embodiment obtains the currently updated codec identification information and determines the number of codec instances based on the codec identification information, so as to accurately determine the number of codec instances of each application in the electronic device, and then can subsequently determine the current video scene of the electronic device based on the number of codec instances, and control the power consumption of the electronic device based on the current video scene, which is beneficial to reducing the power consumption of the electronic device, improving the battery life of the electronic device, and thus improving the user experience.

[0119] Figure 3 The flowchart of how to update the codec identification information according to an exemplary embodiment of the present disclosure is shown; based on the above embodiment, this embodiment takes how to update the codec identification information as an example for exemplary description.

[0120] like Figure 3 As shown, the power consumption control method of this embodiment may further include updating the codec identification information based on the following steps S301-S302:

[0121] In step S301, a notification message sent by a first application among the various applications when creating or destroying a first codec instance is received.

[0122] In this embodiment, when the first application creates or destroys its own codec instance (named as the first codec instance for easy distinction), a notification message can be sent to the electronic device. The notification message may include the first codec identification information corresponding to the first codec instance, and may also include the first program package name of the first application. Exemplarily, assuming that when program W creates its own decoder instance, a notification message can be sent to the electronic device, the message including the package name "W" of program W and the identification "h" corresponding to the decoder instance of program W.

[0123] In some embodiments, the electronic device may receive the above notification message based on a pre-created target process (eg, ServiceC) to obtain the package name of the application and the corresponding codec identification information.

[0124] In step S302, the current codec identification information is updated based on the first codec identification information to obtain the currently updated codec identification information.

[0125] In this embodiment, when the electronic device receives a notification message sent by the first application among the various applications when creating or destroying the first codec instance, it can update the current codec identification information based on the first codec identification bit information to obtain the currently updated codec identification information.

[0126] In some embodiments, a 64-bit integer variable A and attribute information B may be defined in Service C, both of which are 0 by default, wherein the integer variable A is the value of the attribute information B.

[0127] For example, when Service C receives the notification message sent by program W when creating a decoder instance, it can update the current codec identification information according to the identification bit "h" corresponding to the decoder instance of program W to obtain the currently updated codec identification information. For example, the current codec identification information can be updated based on the following formula (3-1):

[0128] Variable A = variable A || identification bit h corresponding to the decoder instance of program W; (3-1)

[0129] In the above formula, “||” represents the “or” operation.

[0130] For another example, when Service C receives the notification message sent by program W when destroying the decoder instance, it can update the current codec identification information according to the identification bit "h" corresponding to the decoder instance of program W to obtain the currently updated codec identification information. For example, the current codec identification information can be updated based on the following formula (3-2):

[0131] Variable A = variable A&& the identifier h corresponding to the decoder instance of program W; (3-2)

[0132] In the above formula, “&&” represents the “and” operation.

[0133] On this basis, Service C can update the value of attribute information B to variable A, that is, the currently updated codec identification information.

[0134] In some embodiments, when the electronic device receives the notification message sent by the first application, it can search for the first application in a preset whitelist based on the first package name of the first application. The whitelist includes a pre-specified video scene application. On this basis, the electronic device can respond to finding the first application in the whitelist and execute the above step S302 to update the current codec identification information based on the first codec identification information.

[0135] From the above description, it can be seen that this embodiment receives a notification message sent by the first application among the various applications when creating or destroying the first codec instance, and updates the current codec identification information based on the first codec identification information to obtain the currently updated codec identification information. This can achieve timely and accurate updating of the codec identification information, and further can achieve subsequent determination of the number of codec instances based on the codec identification information, which can improve the accuracy of determining the number of codec instances, and further can improve the accuracy of subsequent determination of the current video scene of the electronic device.

[0136] Figure 4 It is a flowchart showing how to control the power consumption of the electronic device based on the current video scene according to an exemplary embodiment of the present disclosure; based on the above embodiment, this embodiment uses how to control the power consumption of the electronic device based on the current video scene as an example to exemplify.

[0137] like Figure 4 As shown, the controlling of the power consumption of the electronic device based on the current video scene in the above step S103 may include the following steps S401-S402:

[0138] In step S401 , in response to the current video scene being the single video scene, the number of codec instances is compared with a first number threshold.

[0139] In this embodiment, after the current video scene of the electronic device is determined based on the number of codec instances, if it is detected that the current video scene is the single video scene (e.g., any one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene), the number of codec instances can be compared with a first quantity threshold.

[0140] The first quantity threshold may be set based on actual application requirements, such as being set to 1 or 2, etc., and this embodiment does not limit this.

[0141] In step S402, in response to the number of codec instances being less than or equal to the first number threshold, the current frequency of the CPU of the electronic device is reduced.

[0142] In this embodiment, after comparing the number of codec instances with the first number threshold, if the comparison result is that the number of codec instances is less than or equal to the first number threshold, the current frequency of the CPU of the electronic device can be reduced. The degree of reduction of the current frequency of the CPU of the electronic device can be set based on actual scenario requirements, such as 20% or 30%, etc., which is not limited in this embodiment.

[0143] It is understandable that a higher CPU frequency will lead to higher power consumption, and when a few applications are running in an electronic device (for example, only a video playback application is running), the electronic device does not need to have high computing performance. Therefore, this embodiment can avoid wasting power in the electronic device by reducing the current frequency of the CPU, thereby reducing the power consumption of the electronic device.

[0144] From the above description, it can be seen that this embodiment reduces the power consumption of the electronic device based on the current video scene, improves the battery life of the electronic device, and thus improves the user experience by comparing the number of codec instances with the first number threshold in response to the current video scene being the single video scene, and reducing the current frequency of the CPU of the electronic device in response to the number of codec instances being less than or equal to the first number threshold.

[0145] Figure 5A It is a flowchart showing how to control the power consumption of the electronic device based on the current video scene according to another exemplary embodiment of the present disclosure; based on the above embodiment, this embodiment uses how to control the power consumption of the electronic device based on the current video scene as an example to exemplify.

[0146] like Figure 5A As shown, the controlling the power consumption of the electronic device based on the current video scene in the above step S103 may include the following steps S501-S502:

[0147] In step S501, in response to the current video scene being the video playing scene or a mixed video scene including the video playing scene, the running state of the second application currently playing the video is detected.

[0148] In this embodiment, after the current video scene of the electronic device is determined based on the number of codec instances, if it is detected that the current video scene is the video playback scene (e.g., a scene in which only a video playback application is running) or a mixed video scene that includes the video playback scene (e.g., a scene in which both a video playback application and a video recording, video call and / or video transcoding application are running), the running status of the application currently playing the video (named the second application for easy distinction) can be detected.

[0149] The running status of the above application may include a foreground running status and a background running status.

[0150] It is worth noting that the detection method of the running status of the above-mentioned application can be selected from relevant technologies based on actual needs, and this embodiment does not limit this.

[0151] In step S502, in response to detecting that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application is frozen.

[0152] In this embodiment, after detecting the running state of the second application currently playing the video, if it is detected that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application can be frozen.

[0153] The above-mentioned method of freezing the codec instance of the second application may include, but is not limited to, discarding the data stream output by the codec.

[0154] For example, Figure 5B FIG. 1 is a schematic diagram of a system framework according to an exemplary embodiment of the present disclosure. Figure 5B As shown, normally, when the second application needs to play a video, the video data (Bit stream) is sent to the electronic device to create a codec instance (hereinafter referred to as the second codec instance for ease of distinction) for decoding the video data through the electronic device, such as by calling the initialization interface (init interface) and configuration interface (config interface) of the media codec (MediaCodec) and codec2.0 (a preset software architecture for creating a decoder) to create the second codec instance.

[0155] After the creation of the second codec instance is completed, the video data (Bit stream) can be decoded based on the second codec instance, and the decoded Bit stream is passed to Figure 5B The components in the dotted boxes in the figure are further processed. However, in the related art, when the application that plays the video switches from the foreground running state to the background running state, the components in the dotted boxes in the figures will continue to process the bit stream passed from the second codec instance, but the screen of the electronic device will not display the processed video data at this time, which results in the processing of these video data in vain and also results in the waste of electric energy of the electronic device. Therefore, after detecting that the running state of the application that currently plays the video switches from the foreground running state to the background running state, this embodiment freezes the second codec instance of the application, such as preventing the second codec instance from passing the processed bit stream downward, or preventing the second codec instance from passing the processed bit stream downward. Figure 5BThe VideoHAL component in the dotted box discards the bit stream transmitted by the second codec instance, thereby preventing the various layer components in the dotted box from continuing to process the bit stream transmitted by the second codec instance, thereby avoiding the waste of electric energy of the electronic device, thereby reducing the power consumption of the electronic device and improving the battery life of the electronic device.

[0156] From the above description, it can be seen that this embodiment detects the running status of the second application currently playing the video in response to the current video scene being the video playback scene or a mixed video scene including the video playback scene, and freezes the codec instance of the second application in response to detecting that the running status of the second application switches from the foreground running state to the background running state. This can achieve freezing the codec of the background running application based on the current video scene, thereby reducing the power consumption of the electronic device, improving the battery life of the electronic device, and further improving the user experience.

[0157] Figure 6 It is a flowchart showing how to control the power consumption of the electronic device based on the current video scene according to another exemplary embodiment of the present disclosure; based on the above embodiment, this embodiment uses how to control the power consumption of the electronic device based on the current video scene as an example to exemplify.

[0158] like Figure 6 As shown, the controlling the power consumption of the electronic device based on the current video scene in the above step S103 may include the following steps S601-S602:

[0159] In step S601, in response to the current video scene being the single video scene and detecting that a third application in the electronic device is creating a third codec, the number of codec instances is compared with a second number threshold.

[0160] In this embodiment, after the current video scene of the electronic device is determined based on the number of codec instances, if it is detected that the current video scene is the single video scene (e.g., any one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene), and it is detected that a third application in the electronic device is creating a third codec (e.g., a notification message sent by the third application when creating a third codec is received), the number of codec instances can be compared with a second number threshold.

[0161] Among them, the above-mentioned second quantity threshold can be set based on actual application requirements, such as being set to an integer greater than or equal to 2, etc., which is not limited in this embodiment.

[0162] In step S602, in response to the number of codec instances being greater than or equal to the second number threshold, a performance parameter of the third codec is reduced.

[0163] In this embodiment, after comparing the number of codec instances with the second number threshold, if the comparison result is that the number of codec instances is greater than or equal to the second number threshold, the performance parameter of the third codec may be reduced. The above performance parameter may include resolution and / or frame rate.

[0164] It is worth noting that the extent of reducing the performance parameters of the third codec can be set based on actual scenario requirements, such as being set to 20% or 30%, etc., which is not limited in this embodiment.

[0165] It is understandable that the higher the performance parameter of the third codec, the higher the requirement for hardware performance and the higher the power consumption. Therefore, this embodiment can ensure the hardware performance of the electronic device by reducing the performance parameter of the third codec, avoid the problem of video playback, video recording, video call or video transcoding error caused by exceeding the hardware performance, and reduce the power consumption of the electronic device.

[0166] In other embodiments, the electronic device may also reduce the performance parameters of the third codec in response to the current video scene being the mixed video scene and detecting that a third application in the electronic device is creating a third codec. It is understandable that since the mixed video scene includes at least two of the single video scenes, the number of codec instances in the mixed video scene is also more than 2. Therefore, in order to avoid the error problem caused by exceeding the hardware performance, the performance parameters of the third codec may be reduced when the current video scene is detected to be the mixed video scene and the third application in the electronic device is detecting that the third codec is being created.

[0167] From the above description, it can be seen that this embodiment, in response to the current video scene being the single video scene and detecting that the third application in the electronic device is creating a third codec, compares the number of codec instances with the second number threshold, and then in response to the number of codec instances being greater than or equal to the second number threshold, reduces the performance parameters of the third codec. This can achieve reducing the performance parameters of the third codec based on the current video scene, ensure the hardware performance of the electronic device, avoid video playback, video recording, video calls or video transcoding errors caused by exceeding hardware performance, and reduce the power consumption of the electronic device, improve the battery life of the electronic device, and thus improve the user experience.

[0168] Figure 7 : is a block diagram of a power consumption control device according to an exemplary embodiment of the present disclosure; the power consumption control device of this embodiment can be configured in electronic devices, such as servers, workstations, personal computers, mobile terminals (such as mobile phones, tablet computers, etc.), wearable devices (such as glasses, watches, etc.), etc. Figure 7 As shown, the device includes: a quantity detection module 110, a scene determination module 120 and a power consumption control module 130, wherein:

[0169] A quantity detection module 110, configured to detect the number of codec instances of each application in the electronic device, wherein the number of codec instances includes a first number of encoder instances and / or a second number of decoder instances;

[0170] A scene determination module 120, configured to determine a current video scene of the electronic device based on the number of codec instances;

[0171] The power consumption control module 130 is configured to control the power consumption of the electronic device based on the current video scene.

[0172] As can be seen from the above description, the device of this embodiment detects the number of codec instances of each application in the electronic device, where the number of codec instances includes a first number of encoder instances and / or a second number of decoder instances, and determines the current video scene of the electronic device based on the number of codec instances, and then controls the power consumption of the electronic device based on the current video scene. This can accurately identify different video scenes of the electronic device, and then accurately adopt a power consumption control method corresponding to the current video scene to control the power consumption of the electronic device, which is beneficial to reducing the power consumption of the electronic device, improving the battery life of the electronic device, and then improving the user experience.

[0173] Figure 8 2 is a block diagram of another power consumption control device according to an exemplary embodiment of the present disclosure; the power consumption control device of this embodiment can be configured in electronic devices, such as servers, workstations, personal computers, mobile terminals (such as mobile phones, tablet computers, etc.), wearable devices (such as glasses, watches, etc.), etc. Among them, the quantity detection module 210, the scene determination module 220 and the power consumption control module 230 are similar to the aforementioned Figure 7 The functions of the quantity detection module 110 , the scene determination module 120 and the power consumption control module 130 in the illustrated embodiment are the same and will not be described in detail herein.

[0174] like Figure 8 As shown, the quantity detection module 210 may include:

[0175] The information acquisition unit 211 is used to acquire the currently updated codec identification information, where the codec identification information is updated based on the creation and / or destruction of the codec instance of each application in the electronic device;

[0176] The quantity determining unit 212 is configured to determine the quantity of the codec instances based on the codec identification information.

[0177] In some embodiments, the above apparatus may further include an identification information updating module 240;

[0178] The identification information updating module 240 may include:

[0179] A message receiving unit 241 is configured to receive a notification message sent by a first application among the applications when creating or destroying a first codec instance, wherein the notification message includes a first program package name of the first application and first codec identification information corresponding to the first codec instance;

[0180] The information updating unit 242 is configured to update the current codec identification information based on the first codec identification information to obtain the currently updated codec identification information.

[0181] In some embodiments, the identification information updating module 240 may further include:

[0182] A program search unit 243, configured to search for the first application in a preset white list, wherein the white list includes pre-specified video scene applications;

[0183] Furthermore, the information updating unit 242 may be further configured to, in response to finding the first application in the whitelist, execute the operation of updating the current codec identification information based on the first codec identification information.

[0184] In some embodiments, the above-mentioned scene determination module 220 can also be used to determine that the current video scene is the preset video scene in response to the number of codec instances satisfying a preset number condition corresponding to a preset video scene, and the preset video scene includes a single video scene and / or a mixed video scene, the single video scene includes at least one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene, and the mixed video scene includes at least two of the single video scenes.

[0185] In some embodiments, the power consumption control module 230 may include a first control unit 221;

[0186] The first control unit 221 can be used to:

[0187] In response to the current video scene being the single video scene, comparing the number of codec instances with a first number threshold;

[0188] In response to the number of codec instances being less than or equal to the first number threshold, reducing a current frequency of a CPU of the electronic device.

[0189] In some embodiments, the power consumption control module 230 may include a second control unit 222;

[0190] The second control unit 222 can be used to:

[0191] In response to the current video scene being the video playback scene or a mixed video scene including the video playback scene, detecting a running state of a second application program that is currently playing the video;

[0192] In response to detecting that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application is frozen.

[0193] In some embodiments, the power consumption control module 230 may include a third control unit 223;

[0194] The third control unit 223 can be used to:

[0195] In response to the current video scene being the mixed video scene and detecting that a third application in the electronic device is creating a third codec, performance parameters of the third codec are reduced, the performance parameters including resolution and / or frame rate.

[0196] In some embodiments, the power consumption control module 230 may include a fourth control unit 224;

[0197] The fourth control unit 224 can be used to:

[0198] In response to the current video scene being the single video scene and detecting that a third application in the electronic device is creating a third codec, comparing the number of codec instances with a second number threshold;

[0199] In response to the number of codec instances being greater than or equal to the second number threshold, a performance parameter of the third codec is reduced, the performance parameter comprising resolution and / or frame rate.

[0200] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0201] Fig. 9 900 is a block diagram of an electronic device according to an exemplary embodiment. For example, the device 900 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0202] Reference Fig. 9 , device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .

[0203] The processing component 902 generally controls the overall operation of the device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.

[0204] The memory 904 is configured to store various types of data to support operations on the device 900. Examples of such data include instructions for any application or method operating on the device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0205] The power supply component 906 provides power to the various components of the device 900. The power supply component 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 900.

[0206] The multimedia component 908 includes a screen that provides an output interface between the device 900 and the user. In some embodiments, the screen may include a liquid crystal display panel and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 908 includes a front camera and / or a rear camera. When the device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0207] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the device 900 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting audio signals.

[0208] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0209] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the device 900. For example, the sensor assembly 914 can detect the open / closed state of the device 900, the relative positioning of components, such as the display panel and keypad of the device 900, and the sensor assembly 914 can also detect the position change of the device 900 or a component of the device 900, the presence or absence of user contact with the device 900, the orientation or acceleration / deceleration of the device 900, and the temperature change of the device 900. The sensor assembly 914 can also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0210] The communication component 916 is configured to facilitate wired or wireless communication between the device 900 and other devices. The device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0211] In an exemplary embodiment, the device 900 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0212] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 904 including instructions, and the instructions can be executed by the processor 920 of the device 900 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0213] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0214] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A power consumption control method, characterized in that: The method comprises: Detecting the number of codec instances of each application in the electronic device, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances; determining a current video scene of the electronic device based on the number of codec instances; The power consumption of the electronic device is controlled based on the current video scene.

2. The method according to claim 1, characterized in that The detecting the number of codec instances of each application in the electronic device includes: Acquire currently updated codec identification information, where the codec identification information is updated based on creation and / or destruction of codec instances of the respective applications in the electronic device; The codec instance quantity is determined based on the codec identification information.

3. The method according to claim 2, characterized in that The method further comprises updating the codec identification information based on: receiving a notification message sent by a first application among the applications when creating or destroying a first codec instance, wherein the notification message includes first codec identification bit information corresponding to the first codec instance; The current codec identification information is updated based on the first codec identification information to obtain the currently updated codec identification information.

4. The method according to claim 3, characterized in that The method further comprises: Searching for the first application in a preset whitelist, wherein the whitelist includes pre-specified video scene applications; In response to finding the first application in the whitelist, the operation of updating the current codec identification information based on the first codec identification information is performed.

5. The method according to claim 1, characterized in that The determining the current video scene of the electronic device based on the number of codec instances includes: In response to the number of codec instances satisfying a preset number condition corresponding to a preset video scene, the current video scene is determined to be the preset video scene, the preset video scene includes a single video scene and / or a mixed video scene, the single video scene includes at least one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene, and the mixed video scene includes at least two of the single video scenes.

6. The method according to claim 5, characterized in that The controlling the power consumption of the electronic device based on the current video scene includes: In response to the current video scene being the single video scene, comparing the number of codec instances with a first number threshold; In response to the number of codec instances being less than or equal to the first number threshold, reducing a current frequency of a CPU of the electronic device.

7. The method according to claim 5, characterized in that The controlling the power consumption of the electronic device based on the current video scene includes: In response to the current video scene being the video playback scene or a mixed video scene including the video playback scene, detecting a running state of a second application program that is currently playing the video; In response to detecting that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application is frozen.

8. The method according to claim 5, characterized in that The controlling the power consumption of the electronic device based on the current video scene includes: In response to the current video scene being the mixed video scene and detecting that a third application in the electronic device is creating a third codec, performance parameters of the third codec are reduced, the performance parameters including resolution and / or frame rate.

9. The method according to claim 5, characterized in that The controlling the power consumption of the electronic device based on the current video scene includes: In response to the current video scene being the single video scene and detecting that a third application in the electronic device is creating a third codec, comparing the number of codec instances with a second number threshold; In response to the number of codec instances being greater than or equal to the second number threshold, a performance parameter of the third codec is reduced, the performance parameter comprising resolution and / or frame rate.

10. A power consumption control device, characterized in that: The device comprises: A quantity detection module, used to detect the number of codec instances of each application in the electronic device, wherein the number of codec instances includes a first number of encoder instances and / or a second number of decoder instances; A scene determination module, configured to determine a current video scene of the electronic device based on the number of codec instances; A power consumption control module is used to control the power consumption of the electronic device based on the current video scene.

11. The device according to claim 10, characterized in that The quantity detection module comprises: An information acquisition unit, configured to acquire currently updated codec identification information, wherein the codec identification information is updated based on creation and / or destruction of codec instances of the respective applications in the electronic device; A quantity determining unit is used to determine the quantity of the codec instances based on the codec identification information.

12. The device according to claim 11, characterized in that The device also includes an identification information updating module; The identification information updating module includes: A message receiving unit, configured to receive a notification message sent by a first application among the applications when creating or destroying a first codec instance, wherein the notification message includes first codec identification bit information corresponding to the first codec instance; An information updating unit is used to update the current codec identification information based on the first codec identification information to obtain the currently updated codec identification information.

13. The device according to claim 12, characterized in that The identification information updating module also includes: A program search unit, configured to search for the first application in a preset white list, wherein the white list includes pre-specified video scene applications; The information updating unit is further configured to, in response to finding the first application in the whitelist, execute the operation of updating the current codec identification information based on the first codec identification bit information.

14. The device according to claim 10, characterized in that The scene determination module is also used to determine that the current video scene is the preset video scene in response to the number of codec instances satisfying a preset number condition corresponding to a preset video scene, the preset video scene including a single video scene and / or a mixed video scene, the single video scene including at least one of a video playback scene, a video recording scene, a video call scene, and a video transcoding scene, and the mixed video scene including at least two of the single video scenes.

15. The device according to claim 14, characterized in that The power consumption control module includes a first control unit; The first control unit is used to: In response to the current video scene being the single video scene, comparing the number of codec instances with a first number threshold; In response to the number of codec instances being less than or equal to the first number threshold, reducing a current frequency of a CPU of the electronic device.

16. The device according to claim 14, characterized in that The power consumption control module includes a second control unit; The second control unit is used for: In response to the current video scene being the video playback scene or a mixed video scene including the video playback scene, detecting a running state of a second application program that is currently playing the video; In response to detecting that the running state of the second application is switched from the foreground running state to the background running state, the codec instance of the second application is frozen.

17. The device according to claim 14, characterized in that The power consumption control module includes a third control unit; The third control unit is used for: In response to the current video scene being the mixed video scene and detecting that a third application in the electronic device is creating a third codec, performance parameters of the third codec are reduced, the performance parameters including resolution and / or frame rate.

18. The device according to claim 14, characterized in that The power consumption control module includes a fourth control unit; The fourth control unit is used for: In response to the current video scene being the single video scene and detecting that a third application in the electronic device is creating a third codec, comparing the number of codec instances with a second number threshold; In response to the number of codec instances being greater than or equal to the second number threshold, a performance parameter of the third codec is reduced, the performance parameter comprising resolution and / or frame rate.

19. An electronic device, characterized in that: The device comprises: a processor and a memory for storing a computer program; Wherein, the processor is configured to implement, when executing the computer program: Detecting the number of codec instances of each application in the electronic device, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances; determining a current video scene of the electronic device based on the number of codec instances; The power consumption of the electronic device is controlled based on the current video scene.

20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, it realizes: Detecting the number of codec instances of each application in the electronic device, the number of codec instances comprising a first number of encoder instances and / or a second number of decoder instances; determining a current video scene of the electronic device based on the number of codec instances; The power consumption of the electronic device is controlled based on the current video scene.