CN112711477B - Method and device for switching application programs and electronic equipment - Google Patents

Method and device for switching application programs and electronic equipment Download PDF

Info

Publication number
CN112711477B
CN112711477B CN202110331668.4A CN202110331668A CN112711477B CN 112711477 B CN112711477 B CN 112711477B CN 202110331668 A CN202110331668 A CN 202110331668A CN 112711477 B CN112711477 B CN 112711477B
Authority
CN
China
Prior art keywords
rendering
switching
foreground
background
application program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110331668.4A
Other languages
Chinese (zh)
Other versions
CN112711477A (en
Inventor
范旭宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Tuoke Network Technology Co ltd
Original Assignee
Beijing Tuoke Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Tuoke Network Technology Co ltd filed Critical Beijing Tuoke Network Technology Co ltd
Priority to CN202110331668.4A priority Critical patent/CN112711477B/en
Publication of CN112711477A publication Critical patent/CN112711477A/en
Application granted granted Critical
Publication of CN112711477B publication Critical patent/CN112711477B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Abstract

The invention provides a method and a device for switching application programs and electronic equipment, wherein the method comprises the following steps: calling a rendering interface in the process of performing video rendering on an application program operated by a foreground, and playing a rendered video frame based on a rendering view; when a first switching instruction for switching from a foreground to a background is received, calling a rendering stopping interface, and cleaning a memory used in a video rendering process; the rendered view is removed, and the application is then switched to run in the background. According to the method, the device and the electronic equipment for switching the application program, provided by the embodiment of the invention, the application program running in the foreground plays the rendered video frame through the rendering view, and when the application program needs to be switched to the background, the rendering stopping interface is called and the rendering view is removed, so that the video frame which is not rendered can not influence the switching of the application program to the background, the application program can not be subjected to occasional collapse when being switched to the background, and the robustness and the stability of the application program can be improved.

Description

Method and device for switching application programs and electronic equipment
Technical Field
The present invention relates to the technical field of application programs, and in particular, to a method and an apparatus for switching an application program, an electronic device, and a computer-readable storage medium.
Background
When an application enters the background, the system will strive to keep more applications running in the background at the same time (suspended state rather than terminated). However, when the system memory is insufficient (each application program occupies the system memory when running), some suspended application programs are terminated to recycle the memory; generally, the program with the largest memory is terminated preferentially.
The video of the application program in the online audio and video interaction classroom is an important function in the teaching interaction process, and the application program needs to start video rendering when running in the foreground; in some operating systems, however, rendering using a rendering interface is required. For example, in the apple IOS system, the OpenGL ES interface needs to be invoked to render video. OpenGL ES is a subset of OpenGL (Open Graphics Library, an application programming interface for rendering Graphics, which can efficiently implement Graphics rendering), and can efficiently implement an application programming interface for video rendering.
Before the application program enters the background, the resources of OpenGL need to be released, so that the program in the background can use more resources. When the foreground application is switched to the background (for example, a Home key of the device is pressed), if the application still calls a rendering interface (for example, an interface provided by OpenGL), the application running in the background is forcibly terminated. To avoid this problem, the rendering interface is typically stopped from being invoked when switching to the background, so that the application can be suspended in the background and can continue to run normally when switching to the foreground again. However, the above scheme still occasionally causes the application to crash when the application is switched to the background.
Disclosure of Invention
In order to solve the existing technical problem, embodiments of the present invention provide a method and an apparatus for switching an application program, an electronic device, and a computer-readable storage medium.
In a first aspect, an embodiment of the present invention provides a method for switching an application, including:
calling a rendering interface in the process of performing video rendering on an application program operated by a foreground, and playing a rendered video frame based on a rendering view;
when a first switching instruction for switching from a foreground to a background is received, calling a rendering stopping interface, and cleaning a memory used in a video rendering process;
and removing the rendering view, and then switching the application program to a background running mode.
In a second aspect, an embodiment of the present invention further provides an apparatus for switching an application, where the apparatus includes:
the rendering module is used for calling a rendering interface in the process of performing video rendering on the application program running in the foreground and playing a rendered video frame based on a rendering view;
the video rendering system comprises a first switching module, a second switching module and a processing module, wherein the first switching module is used for calling a rendering stopping interface and cleaning a memory used in a video rendering process when receiving a first switching instruction for switching from a foreground to a background;
and the view removing module is used for removing the rendering view and then switching the application program to a background operation.
In a third aspect, an embodiment of the present invention provides an electronic device, including a bus, a transceiver, a memory, a processor, and a computer program stored on the memory and executable on the processor, where the transceiver, the memory, and the processor are connected via the bus, and when the computer program is executed by the processor, the method for switching an application program described in any one of the above is implemented.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the method for switching an application program described in any one of the above.
According to the method, the device, the electronic equipment and the computer readable storage medium for switching the application program, the application program running in the foreground plays the rendered video frame through the rendering view, the rendering stopping interface is called to stop rendering when the application program needs to be switched to the background, and the rendering view is removed, so that the video frame which is not rendered can not influence the switching of the application program to the background, the application program can not be accidentally collapsed when being switched to the background, and the robustness and the stability of the application program can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or the background art of the present invention, the drawings required to be used in the embodiments or the background art of the present invention will be described below.
Fig. 1 is a flowchart illustrating a method for switching applications according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating another method for switching applications according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram illustrating an apparatus for switching an application according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device for executing a method for switching an application according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described below with reference to the drawings.
Fig. 1 shows a flowchart of a method for switching an application according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step 101: and calling a rendering interface in the process of performing video rendering on the application program operated in the foreground, and playing the rendered video frame based on the rendering view.
In the embodiment of the invention, the application program is an application program which is installed at a mobile terminal and needs to render a video, and for example, the application program can be an application program installed on an iphone or an ipad; moreover, the application program needs to call a corresponding rendering interface in the rendering process, such as a rendering start interface provided by OpenGL ES, and the application program can acquire the rendered video frame by calling the rendering interface, and then play the video frame. In the embodiment of the invention, a rendering view is set for an application program, and the rendering view is used for playing rendered video frames. Specifically, the application program can be a live application program or a video-capable application program, the application program can acquire data to be rendered when the foreground runs and needs to play a video, the data is rendered by calling a rendering interface, and then a rendered video frame is generated, and the rendered video frame can be played through the rendering view, so that a user can view the rendered video frame.
Optionally, the step of "invoking rendering interface" specifically includes:
step A1: starting a rendering timer, calling a corresponding rendering interface, and performing rendering processing based on the rendering timer; the rendering timer is a timer determined according to the screen refresh frequency.
In the embodiment of the invention, a corresponding timer, namely a rendering timer, is determined according to the screen refresh frequency of the device where the application program is located, and generally, the rendering timer is kept consistent with the screen refresh frequency. For example, the screen refresh frequency is 60 frames, i.e. 60 pictures (video frames) are displayed every second, and the rendering timer will perform the action of rendering pictures every 1/60 seconds; therefore, the video frame rate and the screen refreshing frequency can be kept consistent, and the video looks smoother.
Step 102: and when a first switching instruction for switching from a foreground to a background is received, calling a rendering stopping interface, and cleaning a memory used in the video rendering process.
In the embodiment of the present invention, when an application program is switched from a foreground to a background (or from the background to the foreground), for example, when a user presses a Home key, an operating system sends a corresponding notification, and this embodiment may determine whether a corresponding switching instruction is received by monitoring the notification; for example, when it is monitored that the application program switches from the foreground to the background, it may be determined that a corresponding first switching instruction is received. The first switching instruction is used for indicating the state of the switching application program, namely switching from the foreground to the background.
In the embodiment of the present invention, when the first switching instruction is received, a rendering stopping interface is invoked, for example, a deletedaway interface provided by an operating system is invoked, so that the operating system can invoke a relevant interface of an OpenGL ES, and thus rendering can be stopped, and other interfaces of the OpenGL ES are no longer invoked. And corresponding memories can be allocated for use in the rendering process, and are cleaned when the rendering process is switched to the background.
Further optionally, the method may further comprise:
step B1: and when a first switching instruction for switching from the foreground to the background is received, stopping acquiring the data to be rendered and stopping the rendering timer.
In the embodiment of the present invention, as shown in the step a1, if the rendering timer is started during rendering, the rendering timer also needs to be stopped when rendering needs to be stopped.
Step 103: the rendered view is removed, and the application is then switched to run in the background.
As described above, although the conventional scheme stops calling the rendering interface when switching to the background, there is still an occasional crash, i.e., the application program may crash by chance. In completing the creation of the present invention, the inventors found that this is caused by a time difference between rendering the video and stopping the rendering. Specifically, rendering the video and stopping rendering are performed by different threads. After a polling timer (i.e., a rendering timer) is started, after video data is received, a rendering interface is called through a thread A to achieve video rendering, and meanwhile, the video data is transmitted to achieve video rendering. When the background is switched, rendering is stopped through other threads B, namely, a rendering stopping interface is called, and a corresponding memory is cleared; specifically, when the background is switched, the polling timer is stopped, so that the thread A is not informed to call a rendering interface and transmit video data; the deletedaway interface is invoked, the buffered objects associated with the rendered view are deleted, and the associated object memory is cleared. At this time, when the thread B calls the rendering stopping interface, the thread a is still executing, and before the thread B calls the deletedwable clearing buffer, the thread a has taken out one frame of video data from the buffer, and then starts to call the rendering interface and starts to perform rendering operation on the video data. At this time, even if the rendering stopping interface is called, the application still calls the API of OpenGL in the background to render and play the video, and the system prohibits the application in the background from calling the command of OpenGL, so that the application is forcibly terminated, and the application crashes.
In the embodiment of the present invention, rendering is stopped, and the rendering view used for playing the rendered video frame is also removed, so that even if there is a video frame that has not been rendered at the time point when rendering is stopped, the association with OpenGL can be completely broken because there is no rendering view for playing the rendered video frame, and the application program will not be affected by the video frame that has not been rendered. And then, the application program is switched to the background operation, so that the application program running in the background is not influenced by the video frames which are not rendered, and the accidental collapse can be avoided.
Further optionally, if the application running in the background is not terminated due to too many background running programs, it may switch to the foreground running normally. Specifically, the method may further include:
step C1: and when a second switching instruction for switching from the background to the foreground is received, switching the application program to the foreground for running, then recreating the rendering view, acquiring the data to be rendered, and recalling the rendering interface.
In the embodiment of the invention, when a second switching instruction for switching the application program running in the background to the foreground is received, the application program is switched to the foreground to run, then the rendering view is created again, and the rendering interface is called again; in addition, the rendering timer described above may also be restarted. When a second switching instruction is received, the application program is preferentially switched to the foreground, so that the application program is not crashed even if the rendering view is created subsequently. When data to be rendered are acquired, rendering processing can be performed according to the step 101, and the rendered video frames are played through the rendering view for a user to watch.
According to the method for switching the application program, provided by the embodiment of the invention, the application program running in the foreground plays the rendered video frame through the rendering view, the rendering stopping interface is called to stop rendering when the application program needs to be switched to the background, and the rendering view is removed, so that the video frame which is not rendered can not influence the switching of the application program to the background, the application program can not be subjected to occasional collapse when being switched to the background, and the robustness and the stability of the application program can be improved.
On the basis of the above embodiment, the rendered view is removed when switching to the background, and at this time, the application program does not play any video frame, and the user sees a black screen, that is, there is a problem of a black screen at a moment. In the embodiment of the present invention, the problem is avoided by displaying the target image, and specifically, the method further includes:
step D1: when a first switching instruction for switching from a foreground to a background is received, converting a currently rendered video frame into a target image, and displaying the target image at a position corresponding to a rendering view.
Step D2: upon receiving a second switch instruction for switching from the background to the foreground, the target image is removed after the rendered view is recreated and the rendering interface is recalled.
In the embodiment of the invention, when a first switching instruction is received, before the rendering view is removed, the last frame of rendering is converted into the target image, and the target image is displayed at the position corresponding to the rendering view, so that the target image can cover the rendering view. And then, even if the rendering view is removed, the user can see the target image, so that the problem of black screen does not occur in the process of switching the application program to the background.
In addition, when the application program returns to the foreground operation again, after the rendering view is created again and the rendering interface is called again, the rendered video frame can be generated and played normally, at the moment, the target image is removed, so that the application program switched to the foreground can operate normally, and the target image cannot shield the video frame.
The method flow of switching the application program is described in detail below by an embodiment. Referring to fig. 2, the method includes:
step 201: the application program runs in the foreground, and a rendering view is created; starting a rendering timer, calling a rendering interface, converting the acquired data into rendered video frames, and playing the rendered video frames based on the rendering view.
Step 202: when a first switching instruction for switching from a foreground to a background is received, converting a currently rendered latest video frame into a target image, and displaying the target image at a position corresponding to a rendering view.
Step 203: stopping receiving data to be rendered, stopping the rendering timer, calling a rendering stopping interface, cleaning a memory used in the video rendering process, and removing the rendering view.
In the embodiment of the present invention, when the first switching instruction is received, the rendered view needs to be removed after the target image is displayed, and the rest of the processes may be performed simultaneously, that is, after the target image is generated, the above steps 202 and 203 may be performed simultaneously.
Step 204: and then the application program is switched to the background to run, and a target image is reserved.
Step 205: and under the condition that the application program is not terminated, switching the application program to the foreground to run when a second switching instruction for switching from the background to the foreground is received.
Step 206: and then, recreating the rendering view, starting a rendering timer, acquiring data needing rendering, recalling a rendering interface, and then removing the target image.
According to the method for switching the application program, provided by the embodiment of the invention, the application program running in the foreground plays the rendered video frame through the rendering view, the rendering stopping interface is called to stop rendering when the application program needs to be switched to the background, and the rendering view is removed, so that the video frame which is not rendered can not influence the switching of the application program to the background, the application program can not be subjected to occasional collapse when being switched to the background, and the robustness and the stability of the application program can be improved. When switching to the background, the target image is generated based on the video frame of the last frame and displayed on the upper layer of the rendered view, so that the problem of black screen is not caused when the rendered view is removed.
The method for switching the application program provided by the embodiment of the present invention is described above in detail, and the method may also be implemented by a corresponding apparatus.
Fig. 3 is a schematic structural diagram illustrating an apparatus for switching an application according to an embodiment of the present invention. As shown in fig. 3, the apparatus for switching an application includes:
the rendering module 31 is configured to invoke a rendering interface in a process of performing video rendering on an application program running in a foreground, and play a rendered video frame based on a rendering view;
the first switching module 32 is configured to, when receiving a first switching instruction for switching from a foreground to a background, call a rendering stopping interface, and clean a memory used in a video rendering process;
a view removal module 33, configured to remove the rendered view, and then switch the application to a background operation.
On the basis of the above embodiment, the apparatus further includes:
and the second switching module is used for switching the application program to the foreground for operation when receiving a second switching instruction for switching from the background to the foreground, then recreating the rendering view, acquiring data to be rendered, and recalling the rendering interface.
On the basis of the above embodiment, the apparatus further includes:
the image module is used for converting a currently rendered video frame into a target image and displaying the target image at a position corresponding to the rendering view when a first switching instruction for switching from a foreground to a background is received;
upon receiving a second switch instruction to switch from background to foreground, removing the target image after recreating the rendered view and recalling the rendering interface.
On the basis of the above embodiment, the invoking of the rendering interface by the rendering module 31 includes:
starting a rendering timer, calling a corresponding rendering interface, and performing rendering processing based on the rendering timer; the rendering timer is a timer determined according to a screen refresh frequency.
On the basis of the above embodiment, the first switching module 32 is further configured to:
and when a first switching instruction for switching from a foreground to a background is received, stopping acquiring data needing rendering and stopping the rendering timer.
In addition, an embodiment of the present invention further provides an electronic device, which includes a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the transceiver, the memory, and the processor are connected via the bus, and when the computer program is executed by the processor, each process of the method for switching application programs is implemented, and the same technical effect can be achieved, and details are not described here to avoid repetition.
Specifically, referring to fig. 4, an embodiment of the present invention further provides an electronic device, which includes a bus 1110, a processor 1120, a transceiver 1130, a bus interface 1140, a memory 1150, and a user interface 1160.
In an embodiment of the present invention, the electronic device further includes: a computer program stored on the memory 1150 and executable on the processor 1120, the computer program, when executed by the processor 1120, implementing the processes of the method embodiments of switching applications described above.
A transceiver 1130 for receiving and transmitting data under the control of the processor 1120.
In embodiments of the invention in which a bus architecture (represented by bus 1110) is used, bus 1110 may include any number of interconnected buses and bridges, with bus 1110 connecting various circuits including one or more processors, represented by processor 1120, and memory, represented by memory 1150.
Bus 1110 represents one or more of any of several types of bus structures, including a memory bus, and memory controller, a peripheral bus, an Accelerated Graphics Port (AGP), a processor, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include: an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA (EISA) bus, a Video Electronics Standards Association (VESA), a Peripheral Component Interconnect (PCI) bus.
Processor 1120 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits in hardware or instructions in software in a processor. The processor described above includes: general purpose processors, Central Processing Units (CPUs), Network Processors (NPs), Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs), Complex Programmable Logic Devices (CPLDs), Programmable Logic Arrays (PLAs), Micro Control Units (MCUs) or other Programmable Logic devices, discrete gates, transistor Logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in embodiments of the present invention may be implemented or performed. For example, the processor may be a single core processor or a multi-core processor, which may be integrated on a single chip or located on multiple different chips.
Processor 1120 may be a microprocessor or any conventional processor. The steps of the method disclosed in connection with the embodiments of the present invention may be directly performed by a hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), a register, and other readable storage media known in the art. The readable storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The bus 1110 may also connect various other circuits such as peripherals, voltage regulators, or power management circuits to provide an interface between the bus 1110 and the transceiver 1130, as is well known in the art. Therefore, the embodiments of the present invention will not be further described.
The transceiver 1130 may be one element or may be multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. For example: the transceiver 1130 receives external data from other devices, and the transceiver 1130 transmits data processed by the processor 1120 to other devices. Depending on the nature of the computer system, a user interface 1160 may also be provided, such as: touch screen, physical keyboard, display, mouse, speaker, microphone, trackball, joystick, stylus.
It is to be appreciated that in embodiments of the invention, the memory 1150 may further include memory located remotely with respect to the processor 1120, which may be coupled to a server via a network. One or more portions of the above-described networks may be an ad hoc network (ad hoc network), an intranet (intranet), an extranet (extranet), a Virtual Private Network (VPN), a Local Area Network (LAN), a Wireless Local Area Network (WLAN), a Wide Area Network (WAN), a Wireless Wide Area Network (WWAN), a Metropolitan Area Network (MAN), the Internet (Internet), a Public Switched Telephone Network (PSTN), a plain old telephone service network (POTS), a cellular telephone network, a wireless fidelity (Wi-Fi) network, and combinations of two or more of the above. For example, the cellular telephone network and the wireless network may be a global system for Mobile Communications (GSM) system, a Code Division Multiple Access (CDMA) system, a Worldwide Interoperability for Microwave Access (WiMAX) system, a General Packet Radio Service (GPRS) system, a Wideband Code Division Multiple Access (WCDMA) system, a Long Term Evolution (LTE) system, an LTE Frequency Division Duplex (FDD) system, an LTE Time Division Duplex (TDD) system, a long term evolution-advanced (LTE-a) system, a Universal Mobile Telecommunications (UMTS) system, an enhanced Mobile Broadband (eMBB) system, a mass Machine Type Communication (mtc) system, an Ultra Reliable Low Latency Communication (urrllc) system, or the like.
It is to be understood that the memory 1150 in embodiments of the present invention can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. Wherein the nonvolatile memory includes: Read-Only Memory (ROM), Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or Flash Memory.
The volatile memory includes: random Access Memory (RAM), which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as: static random access memory (Static RAM, SRAM), Dynamic random access memory (Dynamic RAM, DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (Double Data Rate SDRAM, DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DRRAM). The memory 1150 of the electronic device described in the embodiments of the invention includes, but is not limited to, the above and any other suitable types of memory.
In an embodiment of the present invention, memory 1150 stores the following elements of operating system 1151 and application programs 1152: an executable module, a data structure, or a subset thereof, or an expanded set thereof.
Specifically, the operating system 1151 includes various system programs such as: a framework layer, a core library layer, a driver layer, etc. for implementing various basic services and processing hardware-based tasks. Applications 1152 include various applications such as: media Player (Media Player), Browser (Browser), for implementing various application services. A program implementing a method of an embodiment of the invention may be included in application program 1152. The application programs 1152 include: applets, objects, components, logic, data structures, and other computer system executable instructions that perform particular tasks or implement particular abstract data types.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements each process of the method for switching an application program in the embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The computer-readable storage medium includes: permanent and non-permanent, removable and non-removable media may be tangible devices that retain and store instructions for use by an instruction execution apparatus. The computer-readable storage medium includes: electronic memory devices, magnetic memory devices, optical memory devices, electromagnetic memory devices, semiconductor memory devices, and any suitable combination of the foregoing. The computer-readable storage medium includes: phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), non-volatile random access memory (NVRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic tape cartridge storage, magnetic tape disk storage or other magnetic storage devices, memory sticks, mechanically encoded devices (e.g., punched cards or raised structures in a groove having instructions recorded thereon), or any other non-transmission medium useful for storing information that may be accessed by a computing device. As defined in embodiments of the present invention, the computer-readable storage medium does not include transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses traveling through a fiber optic cable), or electrical signals transmitted through a wire.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, electronic device and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electrical, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to solve the problem to be solved by the embodiment of the invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present invention may be substantially or partially contributed by the prior art, or all or part of the technical solutions may be embodied in a software product stored in a storage medium and including instructions for causing a computer device (including a personal computer, a server, a data center, or other network devices) to execute all or part of the steps of the methods of the embodiments of the present invention. And the storage medium includes various media that can store the program code as listed in the foregoing.
In the description of the embodiments of the present invention, it should be apparent to those skilled in the art that the embodiments of the present invention can be embodied as methods, apparatuses, electronic devices, and computer-readable storage media. Thus, embodiments of the invention may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), a combination of hardware and software. Furthermore, in some embodiments, embodiments of the invention may also be embodied in the form of a computer program product in one or more computer-readable storage media having computer program code embodied in the medium.
The computer-readable storage media described above may take any combination of one or more computer-readable storage media. The computer-readable storage medium includes: an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of the computer-readable storage medium include: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only Memory (ROM), an erasable programmable read-only Memory (EPROM), a Flash Memory, an optical fiber, a compact disc read-only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any combination thereof. In embodiments of the invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, device, or apparatus.
The computer program code embodied on the computer readable storage medium may be transmitted using any appropriate medium, including: wireless, wire, fiber optic cable, Radio Frequency (RF), or any suitable combination thereof.
Computer program code for carrying out operations for embodiments of the present invention may be written in assembly instructions, Instruction Set Architecture (ISA) instructions, machine related instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or in one or more programming languages, including an object oriented programming language, such as: java, Smalltalk, C + +, and also include conventional procedural programming languages, such as: c or a similar programming language. The computer program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be over any of a variety of networks, including: a Local Area Network (LAN) or a Wide Area Network (WAN), which may be connected to the user's computer, may be connected to an external computer.
The method, the device and the electronic equipment are described through the flow chart and/or the block diagram.
It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions. These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing apparatus to function in a particular manner. Thus, the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
The above description is only a specific implementation of the embodiments of the present invention, but the scope of the embodiments of the present invention is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present invention, and all such changes or substitutions should be covered by the scope of the embodiments of the present invention. Therefore, the protection scope of the embodiments of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for switching applications, comprising:
calling a rendering interface in the process of performing video rendering on an application program operated by a foreground, and playing a rendered video frame based on a rendering view;
when a first switching instruction for switching from a foreground to a background is received, calling a rendering stopping interface, and cleaning a memory used in a video rendering process;
and removing the rendering view, and then switching the application program to a background running mode.
2. The method of claim 1, further comprising:
and when a second switching instruction for switching from the background to the foreground is received, switching the application program to the foreground for running, then recreating the rendering view, acquiring the data to be rendered, and recalling the rendering interface.
3. The method of claim 2, further comprising:
when a first switching instruction for switching from a foreground to a background is received, converting a currently rendered video frame into a target image, and displaying the target image at a position corresponding to the rendering view;
upon receiving a second switch instruction to switch from background to foreground, removing the target image after recreating the rendered view and recalling the rendering interface.
4. The method of any of claims 1-3, wherein the invoking the rendering interface comprises:
starting a rendering timer, calling a corresponding rendering interface, and performing rendering processing based on the rendering timer; the rendering timer is a timer determined according to a screen refresh frequency.
5. The method of claim 4, further comprising:
and when a first switching instruction for switching from a foreground to a background is received, stopping acquiring data needing rendering and stopping the rendering timer.
6. An apparatus for switching applications, comprising:
the rendering module is used for calling a rendering interface in the process of performing video rendering on the application program running in the foreground and playing a rendered video frame based on a rendering view;
the video rendering system comprises a first switching module, a second switching module and a processing module, wherein the first switching module is used for calling a rendering stopping interface and cleaning a memory used in a video rendering process when receiving a first switching instruction for switching from a foreground to a background;
and the view removing module is used for removing the rendering view and then switching the application program to a background operation.
7. The apparatus of claim 6, further comprising:
and the second switching module is used for switching the application program to the foreground for operation when receiving a second switching instruction for switching from the background to the foreground, then recreating the rendering view, acquiring data to be rendered, and recalling the rendering interface.
8. The apparatus of claim 7, further comprising:
the image module is used for converting a currently rendered video frame into a target image and displaying the target image at a position corresponding to the rendering view when a first switching instruction for switching from a foreground to a background is received;
upon receiving a second switch instruction to switch from background to foreground, removing the target image after recreating the rendered view and recalling the rendering interface.
9. An electronic device comprising a bus, a transceiver, a memory, a processor and a computer program stored on the memory and executable on the processor, the transceiver, the memory and the processor being connected via the bus, characterized in that the computer program realizes the steps in the method of switching applications according to any of claims 1 to 5 when executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of switching an application according to any one of claims 1 to 5.
CN202110331668.4A 2021-03-29 2021-03-29 Method and device for switching application programs and electronic equipment Active CN112711477B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110331668.4A CN112711477B (en) 2021-03-29 2021-03-29 Method and device for switching application programs and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110331668.4A CN112711477B (en) 2021-03-29 2021-03-29 Method and device for switching application programs and electronic equipment

Publications (2)

Publication Number Publication Date
CN112711477A CN112711477A (en) 2021-04-27
CN112711477B true CN112711477B (en) 2021-06-25

Family

ID=75550405

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110331668.4A Active CN112711477B (en) 2021-03-29 2021-03-29 Method and device for switching application programs and electronic equipment

Country Status (1)

Country Link
CN (1) CN112711477B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114339415B (en) * 2021-12-23 2024-01-02 天翼云科技有限公司 Client video playing method and device, electronic equipment and readable medium
CN117472483A (en) * 2022-07-21 2024-01-30 荣耀终端有限公司 Image display method and related device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655808A (en) * 2009-09-07 2010-02-24 宇龙计算机通信科技(深圳)有限公司 Application program management method and mobile communication terminal
CN104374399A (en) * 2014-10-31 2015-02-25 北京搜狗科技发展有限公司 Method and device for display of navigation information
CN109308173A (en) * 2017-07-26 2019-02-05 腾讯科技(深圳)有限公司 Display methods and device, display terminal and computer storage medium
CN110213636A (en) * 2018-04-28 2019-09-06 腾讯科技(深圳)有限公司 Video frame generating method, device, storage medium and the equipment of Online Video
CN110648272A (en) * 2019-08-21 2020-01-03 北京达佳互联信息技术有限公司 Graphic resource conversion method, apparatus, electronic device and storage medium
CN112114965A (en) * 2020-09-15 2020-12-22 深圳市欢太科技有限公司 Application program running method and device, terminal and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8483078B2 (en) * 2005-05-12 2013-07-09 Cisco Technology, Inc. Digital program management

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655808A (en) * 2009-09-07 2010-02-24 宇龙计算机通信科技(深圳)有限公司 Application program management method and mobile communication terminal
CN104374399A (en) * 2014-10-31 2015-02-25 北京搜狗科技发展有限公司 Method and device for display of navigation information
CN109308173A (en) * 2017-07-26 2019-02-05 腾讯科技(深圳)有限公司 Display methods and device, display terminal and computer storage medium
CN110213636A (en) * 2018-04-28 2019-09-06 腾讯科技(深圳)有限公司 Video frame generating method, device, storage medium and the equipment of Online Video
CN110648272A (en) * 2019-08-21 2020-01-03 北京达佳互联信息技术有限公司 Graphic resource conversion method, apparatus, electronic device and storage medium
CN112114965A (en) * 2020-09-15 2020-12-22 深圳市欢太科技有限公司 Application program running method and device, terminal and storage medium

Also Published As

Publication number Publication date
CN112711477A (en) 2021-04-27

Similar Documents

Publication Publication Date Title
CN112711477B (en) Method and device for switching application programs and electronic equipment
CN107493375B (en) Mobile terminal expansion screen projection method and screen projection system
US20190205159A1 (en) Method and apparatus for silently starting application in background and terminal device
CN110162343B (en) Application starting method and device, electronic equipment and storage medium
CN111954051B (en) Method and system for transmitting video and audio data, cloud server and storage medium
CN111436004B (en) Video playing method, device and equipment and computer readable storage medium
US20200404330A1 (en) Video sending and receiving method, apparatus, and terminal thereof
US20170163702A1 (en) Android platform-based multimedia processing method and electronic device
CN110704202A (en) Multimedia recording data sharing method and terminal equipment
CN108235756B (en) Audio competition playing device and method and mobile terminal
CN109429374B (en) RRC state transition method, device and computer readable storage medium
CN113259744B (en) Video display method, device, equipment and medium
KR20170046714A (en) Method and apparatus for providing screenshot service on terminal device and storage medium and device
WO2017080241A1 (en) Time-lapse photographing method and device
CN104869466B (en) A kind of video broadcast control method and device
CN104053002A (en) Video decoding method and device
US11908481B2 (en) Method for encoding live-streaming data and encoding device
US9380189B2 (en) Method of providing information configuration function in video play device and video play device
CN110267088B (en) Video playing control method and device, electronic equipment and storage medium
CN107197363B (en) Video playing method and device
US10735502B2 (en) Interactive system, terminal apparatus, server apparatus, control method, program, and recording medium
US10002589B2 (en) Retaining user selected screen area on user equipment
CN113423009B (en) Video progress adjusting method and device and electronic equipment
CN112860214B (en) Animation display method, device, storage medium and equipment based on voice session
CN111467797B (en) Game data processing method and device, computer storage medium and electronic equipment

Legal Events

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