Resource detection method and apparatus, electronic device, storage medium, and program product

CN122526918APending Publication Date: 2026-08-07BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING ZITIAO NETWORK TECH CO LTD
Filing Date
2025-02-05
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

然而,相关技术中,对动态图像内容的资源检测方式较为单一,导致动态图像内容可能会对设备资源产生额外的消耗

Benefits of technology

[0016]第四方面,本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本公开实施例所述的资源检测方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122526918A_ABST
    Figure CN122526918A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a resource detection method and device, electronic equipment, storage medium and program product. The method comprises: obtaining display attribute information of dynamic image content in an interface, an image frame of the dynamic image content being in a playing state; determining a display state of the dynamic image content according to the display attribute information; and if the display state of the dynamic image content is an invisible state, determining that the dynamic image content has resource leakage. Embodiments of the present disclosure utilize the above technical solutions to achieve resource leakage detection of dynamic image content and reduce resource abnormal occupation of dynamic image content in an invisible state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to a resource detection method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] Dynamic image content primarily relies on the rapid and continuous updating of static image frames, utilizing the phenomenon of visual persistence to achieve the visual effect of continuous image changes. However, related technologies employ relatively simplistic resource detection methods for dynamic image content, potentially leading to additional resource consumption on the device. Summary of the Invention

[0003] This disclosure provides a resource detection method, apparatus, electronic device, storage medium, and program product to detect resource leaks in dynamic image content and reduce abnormal resource usage when dynamic image content is in an invisible state.

[0004] In a first aspect, embodiments of this disclosure provide a resource detection method, including:

[0005] Obtain the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state;

[0006] The display status of the dynamic image content is determined based on the display attribute information;

[0007] If the display status of the dynamic image content is invisible, it is determined that the dynamic image content has a resource leak.

[0008] Secondly, embodiments of this disclosure also provide a resource detection device, comprising:

[0009] The information acquisition module is used to acquire the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state;

[0010] A status determination module is used to determine the display status of the dynamic image content based on the display attribute information;

[0011] The resource detection module is used to determine that the dynamic image content has resource leakage when the display state of the dynamic image content is invisible.

[0012] Thirdly, embodiments of this disclosure also provide an electronic device, including:

[0013] One or more processors;

[0014] Memory, used to store one or more programs.

[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the resource detection method as described in the embodiments of this disclosure.

[0016] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the resource detection method as described in embodiments of this disclosure.

[0017] Fifthly, embodiments of this disclosure also provide a computer program product that, when executed by a computer, enables the computer to implement the resource detection method as described in embodiments of this disclosure.

[0018] The resource detection method, apparatus, electronic device, storage medium, and program product provided in this disclosure determine whether there is resource leakage in dynamic image content based on the playback and display status of the dynamic image content. This enables the detection of resource leakage in dynamic image content and reduces abnormal resource usage when the dynamic image content is in an invisible state. Attached Figure Description

[0019] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0020] Figure 1 A schematic flowchart of a resource detection method provided in an embodiment of this disclosure;

[0021] Figure 2 A flowchart illustrating another resource detection method provided in this embodiment of the disclosure;

[0022] Figure 3 This is a schematic diagram of a resource detection process provided in an embodiment of the present disclosure;

[0023] Figure 4 This is a structural block diagram of a resource detection device provided in an embodiment of the present disclosure;

[0024] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0025] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0026] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0027] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0028] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0029] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0030] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0031] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0032] Figure 1 This is a flowchart illustrating a resource detection method provided in an embodiment of this disclosure. The method can be executed by a resource detection device, which can be implemented in software and / or hardware and can be configured in an electronic device, typically a computer, mobile phone, or tablet. The resource detection method provided in this disclosure is applicable to scenarios involving resource leakage detection of dynamic image content. Figure 1As shown, the resource detection method provided in this embodiment may include:

[0033] S101. Obtain the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state.

[0034] Dynamic image content can be understood as dynamically displayed image content, such as image content that presents the movement and change of objects or the development of a series of events within a certain period of time. Dynamic image content mainly utilizes the phenomenon of persistence, achieving a visual effect of continuous image change by rapidly and continuously updating static image frames. The type of dynamic image content is not limited; optionally, it includes animation content and / or video content. Animation content generates dynamic effects by switching a specific set of static images at a specified frequency. The image frames in animation content are generally hand-drawn and / or computer-generated images. Video content is generally dynamic image content created through processes such as shooting, editing, and editing. Animation content may or may not contain audio data; the following explanation uses animation content that does not contain audio data and plays in a loop within the interface as an example.

[0035] The image frames of dynamic image content can be understood as the image frames contained within the dynamic image content. An interface can be understood as an interface containing dynamic image content, such as an interface where the image frames of the dynamic image content are in a playing state. An image frame being in a playing state can be understood as the image frames of the dynamic image content being in a continuously updated state, such as the current image frame in an application that is continuously rendering and updating the dynamic image content. Dynamic image content may or may not contain audio data. When dynamic image content contains audio data, the playback state of the image frames of the dynamic image content can be the same as or the same as the playback state of its audio data. For example, when the audio data of the dynamic image content is in a playing state, its image frames can be in a playing state or a non-playing state.

[0036] The display attribute information of dynamic image content can be understood as information describing the display attributes of the dynamic image content in the interface. For example, this display attribute information can be associated with the display state of the dynamic image content, thus the display attribute information can be used to determine the display state of the dynamic image content. Optionally, the display attribute information includes at least one of hiding attribute information, occlusion attribute information, and position attribute information, wherein the hiding attribute information indicates whether the dynamic image content is hidden, the occlusion attribute information indicates whether the dynamic image content is completely occluded, and the position attribute information indicates whether the dynamic image content is located outside the visible area of ​​the interface. This hiding attribute information can be understood as attribute information of the hiding attribute, which can be used to indicate whether the dynamic image content is hidden, such as whether the dynamic image content is in a hidden state. This occlusion attribute information can be understood as attribute information of the occlusion attribute, which can be used to indicate whether the dynamic image content is completely occluded, such as whether the dynamic image content is in a completely occluded state. Location attribute information can be understood as the attribute information of location attributes. For example, this location attribute information can be the attribute information of the relative position between the dynamic image content and the visible area of ​​the interface. Thus, the location attribute information can be used to indicate whether the dynamic image content is located outside the visible area of ​​the interface.

[0037] Specifically, it is possible to obtain the display attribute information of dynamic image content in the interface where the image frame is in a playing state. For example, for dynamic image content in the interface, it is possible to determine whether the image frame of the dynamic image content is in a playing state, and if it is determined to be in a playing state, obtain the display attribute information such as the hiding attribute information, occlusion attribute information and / or position attribute information of the dynamic image content, so as to determine the display state of the dynamic image content based on this display attribute information.

[0038] Furthermore, considering that when the image frames in the dynamic image content are not in a playback state, there is no need to continuously render and update the image frames of the dynamic image content. In other words, the dynamic image content will not experience resource leakage due to continuous updates of image frames when it is invisible. Therefore, when it is determined that the image frames of the dynamic image content are in a non-playing state, resource leakage detection of the dynamic image content can be omitted, such as not obtaining the display attribute information of the dynamic image content.

[0039] S102. Determine the display status of the dynamic image content based on the display attribute information.

[0040] The display state of the dynamic image content can be used to indicate whether the dynamic image content is visible to the user, that is, whether the user can see the image of the dynamic image content. For example, the display state of the dynamic image content can include a visible state and an invisible state. When the dynamic image content is visible, at least a portion of the image area of ​​the dynamic image content is visible to the user; in other words, the user can see at least a portion of the image area of ​​the dynamic image content. When the dynamic image content is invisible, the image area of ​​the dynamic image content is not visible to the user; in other words, the user cannot see the image area of ​​this dynamic image content.

[0041] Specifically, after obtaining the display attribute information of the dynamic image content in the playback state, it is possible to determine whether the dynamic image content is currently visible to the user based on this display attribute information, and thus determine the display state of the dynamic image content.

[0042] Optionally, determining the display state of the dynamic image content based on the display attribute information includes: in response to the dynamic image content satisfying at least one of being hidden, completely obscured, or located outside the visible area of ​​the interface, determining the display state of the dynamic image content as invisible.

[0043] For example, it can be determined whether the hiding attribute information of the dynamic image content indicates that the dynamic image content is hidden. If the hiding attribute information of the dynamic image content indicates that the dynamic image content is hidden, then the dynamic image content is determined to be in an invisible state. It can also be determined whether the occlusion attribute information of the dynamic image content indicates that the dynamic image content is completely occluded. If the occlusion attribute information of the dynamic image content indicates that the dynamic image content is completely occluded, that is, the image area of ​​the dynamic image content is completely occluded by other interface content in the interface, then the dynamic image content is determined to be in an invisible state. And / or, it can be determined whether the dynamic image content is located outside the visible area of ​​the interface. If the dynamic image content is located outside the visible area of ​​the interface, in other words, if the view area of ​​the dynamic image content does not overlap with the visible area of ​​the interface corresponding to the dynamic image content, then the dynamic image content is determined to be in an invisible state.

[0044] Furthermore, if display attribute information such as the hiding attribute, occlusion attribute, and / or position attribute of the dynamic image content determines that the dynamic image content is not in an invisible state, then the dynamic image content can be determined to be in a visible state. Taking the display attribute information of the dynamic image content, which includes hiding, occlusion, and position attributes, as an example, if the dynamic image content is not hidden, not completely occluded, and not located outside the visible area of ​​the interface, then the display state of the dynamic image content can be determined to be visible. For example, if the hiding attribute information of the dynamic image content indicates that the dynamic image content is not hidden, the occlusion attribute information indicates that the dynamic image content is not completely occluded, and the position attribute information indicates that the dynamic image content is not entirely outside the visible area of ​​the interface, then the dynamic image content can be determined to be visible.

[0045] S103. If the display state of the dynamic image content is invisible, it is determined that the dynamic image content has a resource leak.

[0046] Resource leakage can be understood as the abnormal resource consumption caused by the continuous updating of image frames of dynamic image content even when the content is not visible. For example, due to development and / or configuration reasons, some dynamic image content (such as animation) in an application may continuously update image frames in places invisible to the user. This dynamic image content is not seen by the user, but it continuously consumes the device's central processing unit (CPU) and graphics processing unit (GPU) resources. This type of problem can be called a resource leakage problem of dynamic image content, such as animation leakage.

[0047] Specifically, if the display attribute information of the dynamic image content determines that the display state of the dynamic image content in the playback state is invisible, it means that the dynamic image content is continuously rendering and updating the image frames in a state that is invisible to the user. In this case, it can be determined that the dynamic image content has a resource leak.

[0048] Furthermore, if the display status of the dynamic image content is determined to be visible based on the display attribute information of the dynamic image content, it means that the dynamic image content is rendered and updated in a state visible to the user. In this case, it can be determined that there is no resource leakage in the dynamic image content.

[0049] The resource detection method provided in this embodiment obtains the display attribute information of dynamic image content in a playback state on the interface; determines the display state of the dynamic image content based on this display attribute information; if the display state of the dynamic image content is invisible, it is determined that the dynamic image content has resource leakage. This embodiment utilizes the above technical solution to determine whether dynamic image content has resource leakage based on its playback and display states, enabling resource leakage detection of dynamic image content and reducing abnormal resource consumption when dynamic image content is invisible.

[0050] In some embodiments, display attribute information of the dynamic image content can be obtained when the dynamic image content meets preset information acquisition conditions. These preset information acquisition conditions can be flexibly set as needed; for example, the display attribute information of the dynamic image content can be obtained before playing a certain image frame, after playing a certain image frame, or at preset time intervals, etc.

[0051] Optionally, obtaining the display attribute information of the dynamic image content in the interface includes: obtaining the display attribute information of the dynamic image content when the preset information acquisition conditions of the dynamic image content are met. The preset information acquisition conditions include a first information acquisition condition and / or a second information acquisition condition. The first information acquisition condition includes receiving a playback command for a first image frame in the dynamic image content, the completion of displaying a second image frame in the dynamic image content, or a change in the current image frame of the dynamic image content. The second information acquisition condition includes reaching a preset information acquisition period.

[0052] Preset information acquisition conditions can be understood as pre-set conditions for acquiring display attribute information of dynamic image content. Preset information conditions may include a first information acquisition condition and / or a second information acquisition condition. The first information acquisition condition may be associated with an image frame of the dynamic image content, and the second information acquisition condition may be associated with a preset information acquisition period.

[0053] The first image frame, the second image frame, and the preset information acquisition period can all be set as needed. For example, the first image frame can be the nth (n is a positive integer) image frame of the dynamic image content from front to back or from back to front, such as the 1st, 3rd, or 5th image frame of the dynamic image content, etc. The second image frame can be the mth (m is a positive integer) image frame of the dynamic image content from front to back or from back to front, such as the last image frame, the second-to-last image frame, or the third-to-last image frame of the dynamic image content, etc. The preset information acquisition period can be set to, for example, 20s, 30s, or 60s. The playback instruction for the first image frame can be understood as an instruction to instruct the playback of the first image frame. The current image frame of the dynamic image content can be understood as the image frame currently being played in the dynamic image content.

[0054] Specifically, if the current conditions meet the preset conditions for obtaining information about the dynamic image content, the display attribute information of the dynamic image content can be obtained.

[0055] Taking the default loop playback of dynamic image content and the preset information acquisition conditions as the first information acquisition conditions as an example, the display attribute information of the dynamic image content can be acquired when a playback instruction for the first image frame in the dynamic image is received. For example, the display attribute information of the dynamic image content can be acquired each time the dynamic image content is started during loop playback. Alternatively, the display attribute information of the dynamic image content can be acquired after the second image frame of the dynamic image content is displayed. For example, the display attribute information of the dynamic image content can be acquired each time the dynamic image content finishes playing during loop playback. Furthermore, the display attribute information of the dynamic image content can be acquired when the current image frame of the dynamic image content changes. For example, the display attribute information of the dynamic image content can be acquired each time the image frame of the dynamic image content is updated and / or rendered, and so on.

[0056] Taking the default loop playback of dynamic image content and the preset information acquisition condition as the second information acquisition condition as an example, the dynamic image content can be looped, and the display attribute information of the dynamic image content can be acquired when the preset information acquisition cycle of the dynamic image content is reached. For example, the display attribute information of the dynamic image content can be acquired when the time length since the last acquisition of the display attribute information of the dynamic image content is greater than or equal to the cycle length of the preset information acquisition cycle.

[0057] In some embodiments, if resource leakage exists in the dynamic image content, further processing can be performed. Optionally, after determining that resource leakage exists in the dynamic image content, at least one of the following is further included: providing a resource leakage warning for the dynamic image content; switching the image frame of the dynamic image content from a playback state to a paused playback state; updating the preset information acquisition conditions of the dynamic image content to a first information acquisition condition and a second information acquisition condition.

[0058] In some examples, if a resource leak is detected in the animated image content, a resource leak warning can be issued for the animated image content, such as reporting the resource leak issue, so that developers can correct the configuration information of the animated image content.

[0059] In some examples, if it is determined that there is a resource leak in the moving image content, the image frames of this moving image content can be switched from playback to paused playback, that is, the playback of this moving image content can be paused to prevent the moving image content from continuing to leak resources.

[0060] Understandably, after pausing the playback of this animated content, if the display state of the animated content changes from invisible to visible, the playback of the animated content's image frames can resume, that is, the playback of the animated content's image frames can be switched back from paused to play. When replaying this animated content, for example, if the animated content does not contain audio data, it can resume playback at the playback progress it was at when it was paused; if the animated content contains audio data, it can resume playback at the current playback progress of that audio data.

[0061] In some examples, when it is determined that there is a resource leak in the dynamic image content, the preset information acquisition conditions of this dynamic image content can be updated to include a first information acquisition condition and a second information acquisition condition. That is, when both the first and second information acquisition conditions are met, the display attribute information of this dynamic image content is then acquired, so as to reduce the resources occupied by the resource leak detection of the dynamic image content.

[0062] For example, if no resource leak has been detected in the current loop playback of the dynamic image content, the display attribute information of the dynamic image content can be obtained based on the first information acquisition condition. In other words, resource leak detection is performed on the dynamic image content each time the first information acquisition condition is met. Alternatively, the display attribute information of the dynamic image content can be obtained based on the second information acquisition condition. In other words, resource leak detection is performed on the dynamic image content each time the second information acquisition condition is met.

[0063] If a resource leak is detected in the animated image content, the display attribute information of the animated image content can continue to be obtained based on the first information acquisition condition and the second information acquisition condition. In other words, resource leak detection is performed on the animated image content only when both the first and second information acquisition conditions are met. For example, after the first detection of a resource leak in the animated image content, the preset information acquisition conditions for the animated image content can be updated from either the first or second information acquisition condition to both the first and second information acquisition conditions. After subsequent detections of resource leaks in the animated image content, such as after the information acquisition conditions for the animated image content have been updated to the first and second information acquisition conditions, the display attribute information of the animated image content can continue to be obtained based on these first and second information acquisition conditions until the animated image content finishes looping.

[0064] Figure 2 This is a flowchart illustrating another resource detection method provided in an embodiment of this disclosure. The solution in this embodiment can be combined with one or more optional solutions in the above embodiments. Optionally, obtaining the display attribute information of the dynamic image content includes: obtaining view parameter information of a preset view in the interface used to display the dynamic image content, wherein the view parameter information includes at least one of hiding parameter information, transparency parameter information, and position parameter information; determining the display attribute information of the preset view based on the view parameter information, as the display attribute information of the dynamic image content.

[0065] Correspondingly, such as Figure 2 As shown, the resource detection method provided in this embodiment may include:

[0066] S201. Obtain the associated view parameter information of the preset view used to display dynamic image content in the interface. The image frame of the dynamic image content is in a playback state. The associated view parameter information includes at least one of the following: hiding parameter information, transparency parameter information, position parameter information, and layer parameter information.

[0067] Here, the preset view can be understood as the view in the interface used to display this dynamic image content. The associated view parameter information can be understood as parameter information associated with this preset view. For example, this associated view parameter information can be parameter information related to the display state of the preset view, such as the hiding parameter information of the preset view and its parent view, the transparency parameter information of the preset view and its parent view, and / or the position parameter information of the preset view. This hiding parameter information can be, for example, the parameter value of a hiding parameter. This transparency parameter information can be, for example, the parameter value of a transparency parameter. This position parameter information can be, for example, position information, such as position coordinates. This hierarchy parameter information can be understood as parameter information of the display hierarchy, such as the display hierarchy information of the preset view.

[0068] For example, if an image frame of a certain dynamic image content in the interface is in playback state, the associated view parameter information of the preset view of this dynamic image content can be obtained, such as the hiding parameter information of the preset view and its parent view, the transparency parameter information of the preset view and its parent view, and / or the position parameter information of the preset view.

[0069] S202. Determine the display attribute information of the preset view based on the associated view parameter information, and use it as the display attribute information of the dynamic image content.

[0070] In this embodiment, the display attribute information of the preset view can be determined based on the associated view parameter information, such as the hidden attribute information, occlusion attribute information and / or position attribute information of the preset view, which are used as the display attribute information of the dynamic image content in the preset view.

[0071] In some examples, the hidden attribute information of the preset view can be determined recursively by checking whether the hidden parameter (YES) and the alpha parameter (0) of the preset view and / or all its parent views are true. For example, the preset view can be used as the current view. The hidden parameter and alpha parameter of the current view can be checked. If the hidden parameter and alpha parameter are both true and 0, the current view is hidden, thus confirming that the preset view is hidden. If the hidden parameter and alpha parameter are not true, the parent view of the current view can be used as the current view, and the process of checking the hidden parameter and alpha parameter can be repeated until the preset view is hidden or the current view has no parent view. If the hidden parameter and alpha parameter are both true, the current view has no parent view, and the current view has no parent view, then the preset view is not hidden.

[0072] In some examples, the occlusion attribute information of a preset view can be determined based on its position and layer parameters to determine whether the preset view is completely obscured by other views located above it in the display layer. For example, the position parameter information of each other view in the screen with a display layer higher than the preset view can be obtained. Based on the position parameter information of the preset view and these other views, it can be determined whether the preset view has a view area that does not overlap with any of the other views. If so, the preset view is determined to be completely obscured; otherwise, the preset view is determined to be completely obscured.

[0073] In some examples, the position parameter information of a preset view can be used to determine whether it is displayed outside the visible area of ​​the interface, thereby determining the position attribute information of the preset view. For example, the first position coordinates (i.e., position parameter information) of the preset view can be obtained, and the position coordinates of the preset view can be converted into the second position coordinates in the coordinate system of the main window to obtain the exact position of the preset view relative to the visible area of ​​the interface; it can then be determined whether the preset view intersects with the main window, that is, whether there is an overlapping area between the preset view and the main window. If so, the preset view is determined to be within the visible area of ​​the interface; if not, the preset view is determined to be outside the visible area of ​​the interface.

[0074] S203. Determine the display status of the dynamic image content based on the display attribute information.

[0075] S204. If the display state of the dynamic image content is invisible, then it is determined that the dynamic image content has a resource leak.

[0076] In an optional example, let's consider a looping animation. Animation effects play a crucial role in application interaction, enhancing user experience, guiding operations, and conveying system status. The implementation principle of animation effects mainly relies on rapidly and continuously updating static images, utilizing the phenomenon of visual persistence to achieve continuous playback. Animations typically update at a frequency of 30 frames per second or 60 frames per second. This frequency ensures smooth animation execution but also consumes certain device resources.

[0077] Currently, some applications may contain animations that continuously run in places invisible to the user (such as continuously updating animation frames). These animations are not visible to the user, but they continuously consume the device's CPU and GPU resources. This disclosure defines this type of problem as an animation leakage problem. Currently, there are no existing concepts or detection methods for animation leakage on the market.

[0078] Based on this, the present disclosure proposes the relevant concept of animation leakage and provides a resource detection method to detect animation leakage problems (i.e., animation resource leakage problems).

[0079] Figure 3 This is a schematic diagram of a resource detection process provided in an embodiment of the present disclosure, such as... Figure 3 As shown, the resource detection method provided in this embodiment can be described as follows:

[0080] Each time an animation starts or ends, it checks whether the animation is currently playing (i.e., whether it is in a playback state). If the animation is playing, it checks whether the animation view is hidden. If the animation view is hidden, it is determined that the animation has an animation leakage problem, and the animation leakage problem is reported. If the animation view is not hidden, it further checks whether the animation view is off-screen. If so, it is determined that the animation has an animation leakage problem, and the animation leakage problem is reported.

[0081] Regarding the timing of animation leakage detection, a looping animation includes three key periods: the start of playback, the update of animation frames (i.e., image frames), and the end of playback. Considering that performing animation leakage detection every time the animation frames are updated may be too frequent, in order to detect animation leakage problems in a timely manner while reducing the performance impact of the detection process itself, this embodiment can, for example, perform animation leakage detection when the animation starts or ends playing.

[0082] Regarding whether the animation is visible, it is considered that when the animation view (i.e., the preset view) is hidden or outside the screen range, the animation will definitely not be seen by the user, that is, the animation is invisible.

[0083] To determine whether an animated view is hidden, for example, one can recursively check whether the animated view and all its parent views have `hidden=YES` or `alpha=0`. If any parent view in the animated view's view tree satisfies `hidden=YES` or `alpha=0`, the animated view is considered hidden and invisible (i.e., in an invisible state). The `hidden` and `alpha` attributes of the view can be provided by the device's operating system.

[0084] To determine whether an animated view is off-screen, for example, the coordinates of the animated view can be transformed into the coordinate system of the main screen window to obtain the exact position of the animated view relative to the window; it can also be determined whether the animated view frame intersects with the main screen window frame. If they do not intersect, it can be determined that the animated view is off-screen and is not visible.

[0085] In addition, during the looping playback of the animation, before an animation leak problem is detected for the first time, animation leak detection can be performed when the animation starts or stops playing. After an animation leak problem is detected for the first time, the frequency of animation leak detection for this animation can be updated. For example, it can be updated to perform animation leak detection only when the animation starts or stops playing, and when the time since the last animation leak detection reaches a preset duration (i.e., a preset information acquisition cycle), in order to further reduce the resources occupied by animation leak detection.

[0086] The resource detection method provided in this embodiment can detect resource leakage of dynamic image content and reduce abnormal resource consumption when dynamic image content is invisible.

[0087] Figure 4 This is a structural block diagram of a resource detection device provided in an embodiment of this disclosure. The device can be implemented in software and / or hardware, and can be configured in an electronic device, typically a computer, mobile phone, or tablet computer. It can detect resource leaks in dynamic image content by executing a resource detection method. Figure 4 As shown, the resource detection device provided in this embodiment may include: an information acquisition module 401, a status determination module 402, and a resource detection module 403, wherein,

[0088] The information acquisition module 401 is used to acquire the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state.

[0089] The status determination module 402 is used to determine the display status of the dynamic image content based on the display attribute information;

[0090] The resource detection module 403 is used to determine that the dynamic image content has resource leakage when the display state of the dynamic image content is invisible.

[0091] The resource detection device provided in this embodiment acquires the display attribute information of dynamic image content in a playback state through an information acquisition module; determines the display state of the dynamic image content based on this display attribute information through a state determination module; and determines that the dynamic image content has resource leakage if its display state is invisible through a resource detection module. This embodiment utilizes the above technical solution to determine whether dynamic image content has resource leakage based on its playback and display states, thereby enabling resource leakage detection of dynamic image content and reducing abnormal resource consumption when dynamic image content is invisible.

[0092] Optionally, the display attribute information includes at least one of hiding attribute information, occlusion attribute information, and position attribute information, wherein the hiding attribute information indicates whether the dynamic image content is hidden, the occlusion attribute information indicates whether the dynamic image content is completely occluded, and the position attribute information indicates whether the dynamic image content is located outside the visible area of ​​the interface.

[0093] Optionally, the state determination module 402 can be specifically used to: determine the display state of the dynamic image content as invisible in response to at least one of the following: the dynamic image content is hidden, completely obscured, or located outside the visible area of ​​the interface.

[0094] Optionally, the information acquisition module 401 can be specifically used to: acquire associated view parameter information of a preset view in the interface used to display dynamic image content, wherein the associated view parameter information includes at least one of hiding parameter information, transparency parameter information, position parameter information, and hierarchy parameter information; and determine the display attribute information of the preset view based on the associated view parameter information, as the display attribute information of the dynamic image content.

[0095] Optionally, the information acquisition module 401 can be specifically used to: acquire display attribute information of the dynamic image content when the preset information acquisition conditions of the dynamic image content are met. The preset information acquisition conditions include a first information acquisition condition and / or a second information acquisition condition. The first information acquisition condition includes receiving a playback instruction for a first image frame in the dynamic image content, the completion of display of a second image frame in the dynamic image content, or a change in the current image frame of the dynamic image content. The second information acquisition condition includes reaching a preset information acquisition period.

[0096] Furthermore, the resource detection device may further include at least one of the following: a resource notification module, configured to provide a resource leakage notification to the dynamic image content after determining that the dynamic image content has a resource leakage; a state switching module, configured to switch the image frame of the dynamic image content from a playback state to a paused playback state after determining that the dynamic image content has a resource leakage; and a condition update module, configured to update the preset information acquisition conditions of the dynamic image content to a first information acquisition condition and a second information acquisition condition after determining that the dynamic image content has a resource leakage.

[0097] Optionally, the dynamic image content includes animation content and / or video content.

[0098] The resource detection device provided in this disclosure can execute the resource detection method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the resource detection method. Technical details not described in detail in this embodiment can be found in the resource detection method provided in any embodiment of this disclosure.

[0099] The following is for reference. Figure 5 The diagram illustrates a structural schematic of an electronic device (e.g., a terminal device) 500 suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0100] like Figure 5 As shown, the electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0101] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0102] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0103] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0104] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0105] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0106] The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the electronic device causes the electronic device to: obtain display attribute information of dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state; determine the display state of the dynamic image content based on the display attribute information; and determine that the dynamic image content has a resource leak if the display state of the dynamic image content is invisible.

[0107] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0108] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0109] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of modules do not, in some cases, constitute a limitation on the unit itself.

[0110] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0111] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0112] According to one or more embodiments of this disclosure, Example 1 provides a resource detection method, including:

[0113] Obtain the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state;

[0114] The display status of the dynamic image content is determined based on the display attribute information;

[0115] If the display status of the dynamic image content is invisible, it is determined that the dynamic image content has a resource leak.

[0116] According to one or more embodiments of this disclosure, Example 2 describes the method according to Example 1, wherein the display attribute information includes at least one of hiding attribute information, occlusion attribute information, and position attribute information, wherein the hiding attribute information indicates whether the dynamic image content is hidden, the occlusion attribute information indicates whether the dynamic image content is completely occluded, and the position attribute information indicates whether the dynamic image content is located outside the visible area of ​​the interface.

[0117] According to one or more embodiments of this disclosure, Example 3 describes the method described in Example 2, wherein determining the display state of the dynamic image content based on the display attribute information includes:

[0118] In response to the dynamic image content satisfying at least one of being hidden, completely obscured, or located outside the visible area of ​​the interface, the display state of the dynamic image content is determined to be invisible.

[0119] According to one or more embodiments of this disclosure, Example 4, based on the method described in Example 1, includes obtaining the display attribute information of the dynamic image content, including:

[0120] Obtain associated view parameter information of a preset view in the interface used to display dynamic image content, wherein the associated view parameter information includes at least one of the following: hide parameter information, transparency parameter information, position parameter information, and hierarchy parameter information;

[0121] The display attribute information of the preset view is determined based on the associated view parameter information, and is used as the display attribute information of the dynamic image content.

[0122] According to one or more embodiments of this disclosure, Example 5, based on the method described in Example 1, includes obtaining the display attribute information of dynamic image content in the interface, including:

[0123] Under the condition that the preset information acquisition conditions of the dynamic image content are met, the display attribute information of the dynamic image content is acquired. The preset information acquisition conditions include a first information acquisition condition and / or a second information acquisition condition. The first information acquisition condition includes receiving a playback instruction for a first image frame in the dynamic image content, the completion of display of a second image frame in the dynamic image content, or a change in the current image frame of the dynamic image content. The second information acquisition condition includes reaching a preset information acquisition period.

[0124] According to one or more embodiments of this disclosure, Example 6, based on any one of Examples 1-5, further includes at least one of the following after determining that the moving image content contains a resource leak:

[0125] A resource leakage warning will be issued for the aforementioned dynamic image content;

[0126] Switch the image frame of the dynamic image content from playback state to pause playback state;

[0127] The preset information acquisition conditions for the dynamic image content are updated to the first information acquisition condition and the second information acquisition condition.

[0128] According to one or more embodiments of this disclosure, Example 7 describes the method according to any one of Examples 1-5, wherein the dynamic image content includes animation content and / or video content.

[0129] According to one or more embodiments of this disclosure, Example 8 provides a resource detection apparatus, including:

[0130] The information acquisition module is used to acquire the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state;

[0131] A status determination module is used to determine the display status of the dynamic image content based on the display attribute information;

[0132] The resource detection module is used to determine that the dynamic image content has resource leakage when the display state of the dynamic image content is invisible.

[0133] According to one or more embodiments of this disclosure, Example 9 provides an electronic device, including:

[0134] One or more processors;

[0135] Memory, used to store one or more programs.

[0136] When the one or more programs are executed by the one or more processors, the one or more processors implement the resource detection method as described in any of Examples 1-7.

[0137] According to one or more embodiments of the present disclosure, Example 10 provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the resource detection method as described in any of Examples 1-7.

[0138] According to one or more embodiments of this disclosure, Example 11 provides a computer program product that, when executed by a computer, causes the computer to implement the resource detection method as described in any of Examples 1-7.

[0139] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0140] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0141] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A resource detection method, characterized in that, include: Obtain the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state; The display status of the dynamic image content is determined based on the display attribute information; If the display status of the dynamic image content is invisible, it is determined that the dynamic image content has a resource leak.

2. The method according to claim 1, characterized in that, The display attribute information includes at least one of hidden attribute information, occlusion attribute information, and position attribute information, wherein the hidden attribute information indicates whether the dynamic image content is hidden, the occlusion attribute information indicates whether the dynamic image content is completely occluded, and the position attribute information indicates whether the dynamic image content is located outside the visible area of ​​the interface.

3. The method according to claim 2, characterized in that, Determining the display state of the dynamic image content based on the display attribute information includes: In response to the dynamic image content satisfying at least one of being hidden, completely obscured, or located outside the visible area of ​​the interface, the display state of the dynamic image content is determined to be invisible.

4. The method according to claim 1, characterized in that, The acquisition of display attribute information of dynamic image content includes: Obtain associated view parameter information of a preset view in the interface used to display dynamic image content, wherein the associated view parameter information includes at least one of the following: hide parameter information, transparency parameter information, position parameter information, and hierarchy parameter information; The display attribute information of the preset view is determined based on the associated view parameter information, and is used as the display attribute information of the dynamic image content.

5. The method according to claim 1, characterized in that, The acquisition of display attribute information of dynamic image content in the interface includes: Under the condition that the preset information acquisition conditions of the dynamic image content are met, the display attribute information of the dynamic image content is acquired. The preset information acquisition conditions include a first information acquisition condition and / or a second information acquisition condition. The first information acquisition condition includes receiving a playback instruction for a first image frame in the dynamic image content, the completion of display of a second image frame in the dynamic image content, or a change in the current image frame of the dynamic image content. The second information acquisition condition includes reaching a preset information acquisition period.

6. The method according to any one of claims 1-5, characterized in that, After determining that the dynamic image content contains a resource leak, the method further includes at least one of the following: A resource leakage warning will be issued for the aforementioned dynamic image content; Switch the image frame of the dynamic image content from playback state to pause playback state; The preset information acquisition conditions for the dynamic image content are updated to the first information acquisition condition and the second information acquisition condition.

7. The method according to any one of claims 1-5, characterized in that, The dynamic image content includes animated content and / or video content.

8. A resource detection device, characterized in that, include: The information acquisition module is used to acquire the display attribute information of the dynamic image content in the interface, wherein the image frame of the dynamic image content is in a playback state; A status determination module is used to determine the display status of the dynamic image content based on the display attribute information; The resource detection module is used to determine that the dynamic image content has resource leakage when the display state of the dynamic image content is invisible.

9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the resource detection method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the resource detection method according to any one of claims 1-7.

11. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the resource detection method according to any one of claims 1-7.