A method, apparatus, device, and readable storage medium for video playback of a mobile terminal

The method stabilizes mobile terminal video playback by separating rendering and data processing processes and monitoring memory usage to prevent leaks and overflow, ensuring stable video playback.

CN116074578BActive Publication Date: 2025-07-15E SURFING VISION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211673687.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2025-07-15
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

The problem of video application crashing and crashing due to full memory space and memory leaks when playing videos in mobile terminals.

Method used

In the video playback method of the mobile terminal, the main process of the target mobile terminal application is started, the screen buffer is obtained, and the video data processing process is judged and created, the memory usage is monitored, the memory leakage is avoided, and the video playback kernel queue is used to process the video data to achieve process-level separation and data multiplexing.

Benefits of technology

Stable playback of video data, avoid memory overflow and leakage, provide stable and reliable video playback methods, free up application memory space, and improve the stability and reliability of video playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116074578B_ABST
    Figure CN116074578B_ABST
Patent Text Reader

Abstract

The present application provides a method, apparatus, device, and readable storage medium for video playback on a mobile terminal. The method provided by the present application can utilize the mobile terminal to play videos based on memory allocation, effectively separating the two processes of video interface rendering and video data processing at the process level, reusing data for homologous videos in the video data processing process, and monitoring memory allocation to avoid memory overflow or leakage of data, which can effectively ensure the stability of the memory peak value fluctuation during video playback on the mobile terminal, providing a more stable and reliable video playback method for mobile terminal applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video playback technology, and in particular to a method, device, equipment and readable storage medium for video playback on a mobile terminal. Background Art

[0002] With the development of science and technology, people tend to use mobile terminals to play short videos. In actual application, when a mobile terminal video application plays a video, the video stream data obtained by decoding the video to be played by some commonly used video playback kernels is written into the screen buffer and rendered in the visible window.

[0003] However, the memory space occupied by each application process in the mobile terminal is limited. Frequent video data processing and resource recycling will cause the memory space to be overlaid due to untimely recycling, resulting in the inability of the video playing application to play the video in time due to full memory space, and even crashing. At the same time, if the video playing kernel has a memory leak, it may cause the memory to continue to increase, which will also cause the above problems in the application. Summary of the invention

[0004] The present application aims to solve at least one of the above-mentioned technical defects. In view of this, the present application provides a mobile terminal video playback method, device, equipment and readable storage medium, which are used to solve the technical defect in the prior art that it is difficult to stably play videos on mobile terminals.

[0005] A mobile terminal video playback method, comprising:

[0006] Start the main process of the target mobile terminal application, enter the video playback page and start the video playback function of the target mobile terminal application;

[0007] Apply to the application rendering system to obtain the target screen buffer;

[0008] Determine whether there is a video data processing process in the application rendering system;

[0009] If the application rendering system does not have a video data processing process, creating a first target video data processing process as the target video data processing process;

[0010] Passing the target screen buffer and the target video source address into the target video data processing process;

[0011] Reading the memory space occupied by the target video data processing process;

[0012] According to the memory occupied space data of the target video data processing process, determining whether the application rendering system has a memory leak causing a continuous increase in memory;

[0013] If there is no situation where the application rendering system has a memory leak resulting in continuous memory increase, directly run the main service of the target video data processing process;

[0014] Read the video playback kernel queue data;

[0015] Based on the video playback kernel queue data, determine whether there is a video playback kernel instance in the video playback kernel queue;

[0016] If there is a video playback kernel instance in the video playback kernel queue, determine whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue;

[0017] If there is the target video playback kernel instance in the video playback kernel queue, take out the target video playback kernel instance with the target video source address as the key value;

[0018] Run the main service of the target video data processing process to bind the target screen buffer and the target video source address to the video playback kernel;

[0019] After running the video playback kernel and performing video data pulling, de-encapsulation, and decoding processing on the target video source address, write the target video data into the target screen buffer;

[0020] Display the target video data in the target screen buffer through the application rendering system.

[0021] Preferably, the method further includes:

[0022] If the application rendering system has a memory leak resulting in continuous memory increase, actively close the first target video data processing process, and create a second target video data processing process as the target video processing process;

[0023] And return to execute the operation of passing the target screen buffer and the target video source address into the target video data processing process.

[0024] Preferably, the method further includes:

[0025] If there is no video playback kernel instance in the video playback kernel queue, initiate monitoring of the memory occupancy space of the target video data processing process, and record the memory occupancy space value of the target video data processing process;

[0026] And return to execute the operation of reading the memory occupancy space data of the target video data processing process.

[0027] Preferably, the method further includes:

[0028] If the target video playback kernel instance does not exist in the video playback kernel queue, create a first target video playback kernel instance;

[0029] Set the target video source address as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance;

[0030] Add the second target video playback kernel instance to the video playback kernel queue and return to execute the operation of retrieving the target video playback kernel instance with the target video source address as the key value.

[0031] A mobile terminal video playback device, including:

[0032] A startup unit for starting the main process of the target mobile terminal application and entering the video playback page to start the video playback function of the target mobile terminal application;

[0033] A buffer application unit for applying to the application rendering system to obtain a target screen buffer;

[0034] A first judgment unit for judging whether there is a video data processing process in the application rendering system;

[0035] A first creation unit for creating a first target video data processing process as the target video data processing process when the execution result of the first judgment unit is that there is no video data processing process in the application rendering system;

[0036] A transmission unit for transmitting the target screen buffer and the target video source address into the target video data processing process;

[0037] A first reading unit for reading the memory occupancy data of the target video data processing process;

[0038] A second judgment unit for judging whether there is a situation where the application rendering system has a memory leak resulting in continuous memory increase based on the memory occupancy data of the target video data processing process;

[0039] A first running unit for directly running the main service of the target video data processing process when the execution result of the second judgment unit is that there is no situation where the application rendering system has a memory leak resulting in continuous memory increase;

[0040] A second reading unit for reading the video playback kernel queue data;

[0041] A third judgment unit, configured to determine whether there is a video playback kernel instance in the video playback kernel queue according to the video playback kernel queue data;

[0042] A fourth judgment unit, configured to, when the execution result of the third judgment unit is that there is a video playback kernel instance in the video playback kernel queue, determine whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue;

[0043] A first setting unit, configured to, when the execution result of the fourth judgment unit is that there is the target video playback kernel instance in the video playback kernel queue, take out the target video playback kernel instance with the target video source address as the key value;

[0044] A second operation unit, configured to run the target video data processing process main service to bind the target screen buffer and the target video source address to the video playback kernel;

[0045] A third operation unit, configured to run the video playback kernel and perform video data pulling, de-encapsulation, and decoding processing on the target video source address, and then write the target video data into the target screen buffer;

[0046] A display unit, configured to display the target video data in the target screen buffer through the application rendering system.

[0047] Preferably, the device further includes:

[0048] A process closing unit, configured to, when the execution result of the second judgment unit is that there is a situation where the application rendering system has a memory leak resulting in continuous memory increase, actively close the first target video data processing process, and create a second target video data processing process as the target video processing process; and return to execute the operation of passing the target screen buffer and the target video source address into the target video data processing process.

[0049] Preferably, the device further includes:

[0050] A monitoring unit, configured to, when the execution result of the third judgment unit is that there is no video playback kernel instance in the video playback kernel queue, initiate monitoring of the memory occupancy of the target video data processing process, and record the memory occupancy value of the target video data processing process; and return to execute the operation of reading the memory occupancy data of the target video data processing process.

[0051] Preferably, the device further includes:

[0052] An instance creation unit, configured to create a first target video playback kernel instance when the execution result of the fourth determination unit indicates that the target video playback kernel instance does not exist in the video playback kernel queue;

[0053] A second setting unit, configured to set the target video source address as the key value of the first target video playback kernel instance, to obtain a second target video playback kernel instance;

[0054] An instance addition unit, configured to add the second target video playback kernel instance to the video playback kernel queue, and return an operation of retrieving the corresponding target video playback kernel instance by using the target video source address as the key value.

[0055] A mobile terminal video playback device, comprising: one or more processors, and a memory;

[0056] The memory stores computer-readable instructions, which, when executed by the one or more processors, implement the steps of the mobile terminal video playback method as described in any one of the foregoing introductions.

[0057] A readable storage medium, which stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to implement the steps of the mobile terminal video playback method as described in any one of the foregoing introductions.

[0058] As can be seen from the technical solutions introduced above, when it is necessary to stably play the video data to be played on a mobile terminal, the method provided by the embodiments of the present application can start the main process of the target mobile terminal application, enter the video playback page to start the video playback function of the target mobile terminal application; and apply to the application rendering system to obtain a target screen buffer; after obtaining the target screen buffer, it can be determined whether there is a video data processing process in the application rendering system; if there is no video data processing process in the application rendering system, it means that there is no process in the current application rendering system that can process video data, then a first target video data processing process can be created as the target video data processing process to process the target video data to be played; and after creating the supplementary video data processing process, the target screen buffer and the target video source address are passed into the target video data processing process; at the same time, the memory occupancy data of the target video data processing process can be read; and based on the memory occupancy data of the target video data processing process, it can be further determined whether there is a situation where the application rendering system has a memory leak resulting in continuous memory increase; if there is no situation where the application rendering system has a memory leak resulting in continuous memory increase, it means that directly running the target video data processing process will not cause a failure, then the main service of the target video data processing process can be directly run; and the video playback kernel queue data can be read; after determining the video playback kernel queue data, it can be further determined whether there is a target video playback kernel instance in the video playback kernel queue based on the video playback kernel queue data; if there is a video playback kernel instance in the video playback kernel queue, it means that there is no need to create a new video playback kernel instance, then it can be further determined whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue; if there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue, the target video source address can be taken as a key value to obtain the corresponding target video playback kernel instance; and the main service of the target video data processing process is run to bind the target screen buffer and the target video source address to the target video playback kernel; the target video playback kernel is run to perform video data pulling, de-encapsulation, and decoding processing according to the target video source address, and then the target video data is written into the target screen buffer; finally, the target video data in the target screen buffer can be presented through the application rendering system.

[0059] The method provided by the embodiments of the present application can utilize a mobile terminal to play a video based on memory allocation, effectively separating the two processes of video interface rendering and video data processing at the process level. In the video data processing process, data reuse is performed on homologous videos, and memory allocation is monitored to avoid memory overflow or leakage of data, which can effectively ensure the stability of the memory peak fluctuation during mobile video playback, providing a more stable and reliable video playback method for mobile terminal applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0061] Figure 1 It is a flowchart of a method for implementing mobile terminal video playback provided by an embodiment of the present application;

[0062] Figure 2 It is a schematic structural diagram of a mobile terminal video playback device exemplified by an embodiment of the present application;

[0063] Figure 3 It is a hardware structure block diagram of a mobile terminal video playback device disclosed by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0064] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.

[0065] In view of the fact that most current mobile terminal video playback solutions are difficult to adapt to complex and changing business requirements, the applicant has studied a mobile terminal video playback solution. The mobile terminal video playback method can utilize a mobile terminal to play a video based on memory allocation, effectively separating the two processes of video interface rendering and video data processing at the process level. In the video data processing process, data reuse is performed on homologous videos, and memory allocation is monitored to avoid memory overflow or leakage of data, which can effectively ensure the stability of the memory peak fluctuation during mobile video playback, providing a more stable and reliable video playback method for mobile terminal applications.

[0066] The method provided by the embodiments of the present application can be used in many general or special computing device environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or equipment, and so on.

[0067] The embodiments of the present application provide a method for playing videos on a mobile terminal. This method can be applied to various video playback systems or video display systems, and can also be applied to various computer terminals or intelligent terminals. The execution entity can be the processor or server of the computer terminal or intelligent terminal.

[0068] For example, in the actual application process, the method provided by the embodiments of the present application can be applied in an application rendering system, and the application rendering system can include an application main process module, a Surface screen buffer module, a video data processing process main service module, a video playback kernel module, a video playback kernel queue module, and a process memory monitoring module.

[0069] The following will separately explain each module:

[0070] The main process module is mainly the carrier of the mobile application and can associate the Surface screen buffer with the application rendering system.

[0071] The Surface screen buffer module is mainly the bridge between the application rendering system and the video data. The cross-process feature of the Surface makes it possible to separate the application rendering system and the video data processing.

[0072] The video data processing process main service module is mainly the carrier of video data processing and process control and is the key part that can perform memory allocation. The independent process does not occupy the memory space of the main process. It processes data reuse according to the video source address and the video playback kernel queue and releases the memory occupied by memory leaks according to the process memory monitoring data.

[0073] The video playback kernel module is mainly the core part of video playback and is also the part that consumes the most memory. It mainly includes the acquisition and processing of video data, and the writing of data to the Surface screen buffer.

[0074] The video playback kernel queue module is mainly the key part of data reuse for videos from the same source. One video source address corresponds to one item in the queue.

[0075] The process memory monitoring module mainly monitors the memory occupied by the video data processing process. When there is no video playback kernel instance, the process memory continuously increases, and it returns the process memory leak flag data.

[0076] The following will be combined with Figure 1, introduces the process of the mobile terminal video playback method given in the embodiment of the present application, such as Figure 1 As shown, the process can include the following steps:

[0077] Step S101, start the main process of the target mobile terminal application, enter the video play page and start the video play function of the target mobile terminal application.

[0078] Specifically, in actual application, when a mobile terminal video application plays a video, the video stream data after being decoded by the video playback kernel is written into a screen buffer and rendered in a visible window.

[0079] in,

[0080] Common video playback kernels include MediaPlayer and ijkPlayer.

[0081] in,

[0082] The screen buffer may include a screen buffer pointed to by a Surface.

[0083] in,

[0084] A mobile terminal may include at least one application, and each application of the mobile terminal may occupy different memories.

[0085] A mobile terminal application may include at least one process;

[0086] However, there is an upper limit to the memory space occupied by each application process on a mobile terminal.

[0087] Frequent video data processing and resource recycling will cause an instantaneous peak superposition effect due to untimely memory recycling, resulting in the mobile terminal application being unable to play videos in an orderly manner due to full memory space, and may even cause system crashes and flash backs.

[0088] Therefore, when the mobile terminal application is needed to play the video data to be played, the main process of the target mobile terminal application can be started first, and the video playback page can be entered to start the video playback function of the target mobile terminal application so that the target mobile terminal application can be used to play the video data.

[0089] Step S102: Apply to the application rendering system to obtain the target screen buffer.

[0090] Specifically, as can be seen from the above introduction, the method provided by the embodiment of the present application can start the main process of the target mobile terminal application, enter the video playback page to start the video playback function of the target mobile terminal application. After starting the video playback function of the target mobile terminal application, in order to display the video data to be played on the screen, a target screen buffer can be applied for from the application rendering system, so as to apply for the memory occupied by the screen required to play the video data to be played.

[0091] For example,

[0092] In the actual application process, the Surface screen buffer can be applied for from the application rendering system by using the video playback page.

[0093] Step S103, determine whether there is a video data processing process in the application rendering system.

[0094] Specifically, in the actual application process, after applying for the target screen buffer from the application rendering system, whether there is a video data processing process in the application rendering system, its memory allocation, and the processing process after its memory allocation are different.

[0095] Therefore, after applying for the target screen buffer from the application rendering system, if it is determined that there is no video data processing process in the application rendering system, step S104 can be executed.

[0096] For example,

[0097] In the actual application process, the Surface screen buffer and the video source address can be passed into the process through the cross-process handle of the video data processing process, which can lay the foundation for subsequent video stream pulling and processing in the process.

[0098] Step S104, create a first target video data processing process as the target video data processing process.

[0099] Specifically, as can be seen from the above introduction, the method provided by the embodiment of the present application can further determine whether there is a video data processing process in the application rendering system after applying for the target screen buffer from the application rendering system.

[0100] If it is determined that there is no video data processing process in the application rendering system, it means that there is no video data processing process in the application rendering system at the current moment to process the video data to be played. Therefore, after determining that there is no video data processing process in the application rendering system, a first target video data processing process can be created as the target video data processing process, so as to use the target video data processing process to process the video data to be played.

[0101] Step S105: Pass the target screen buffer and the target video source address into the target video data processing process.

[0102] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can create a first target video data processing process as the target video data processing process after determining that there is no video data processing process in the application rendering system.

[0103] After creating the target video data processing process, the target video data processing process can be used to process the video data to be played. Therefore, the target screen buffer and the target video source address can be passed into the target video data processing process, so that the target video data processing process can be used to prepare the basic work for subsequent video streaming and processing in the process.

[0104] Step S106: Read the memory occupancy data of the target video data processing process.

[0105] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can pass the target screen buffer and the target video source address into the target video data processing process, so that the target video data processing process can be used to process the video data to be played.

[0106] In order to determine that the target video data processing process has enough memory to process the video data to be played and avoid video playback stuttering, after passing the target screen buffer and the target video source address into the target video data processing process, the memory occupancy data of the target video data processing process can be read, so that it can be determined whether there is a situation where the application rendering system has a memory leak causing continuous memory increase based on the memory occupancy data of the target video data processing process, so that the fault caused by the memory leak can be excluded in time.

[0107] Step S107: Determine whether there is a situation where the application rendering system has a memory leak causing continuous memory increase based on the memory occupancy data of the target video data processing process.

[0108] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can read the memory occupancy data of the target video data processing process.

[0109] Among them,

[0110] The memory occupancy data of the target video data processing process can reflect the specific situation of the memory occupied by the current target video processing process. If the memory occupied by the target video data processing process is insufficient, it is difficult to use the target video processing data to process the video data to be played.

[0111] Therefore, after reading the memory occupancy data of the target video data processing process, it is possible to further determine, based on the memory occupancy data of the target video data processing process, whether there is a situation where memory leakage in the application rendering system causes the memory to continuously increase, so as to promptly detect and eliminate faults, providing a stable environment for playing video data.

[0112] If there is no situation where memory leakage in the application rendering system causes the memory to continuously increase, it means that the memory of the application rendering system does not leak at the current moment, and there is no fault caused by insufficient memory. Then, step S108 can be executed;

[0113] If there is a situation where memory leakage in the application rendering system causes the memory to continuously increase, it means that the memory of the application rendering system leaks at the current moment, and there may be a fault caused by insufficient memory. It is necessary to promptly eliminate the fault so as to smoothly process the video data to be played. Therefore, step S109 can be executed.

[0114] Step S108: Directly run the main service of the target video data processing process.

[0115] Specifically, as introduced above, the method provided by the embodiment of the present application can determine whether there is a situation where memory leakage in the application rendering system causes the memory to continuously increase. If there is no such situation, it means that the memory of the application rendering system does not leak at the current moment, and there is no fault caused by insufficient memory. At the current moment, the application rendering system can provide the memory required for the target video processing process to process the video data to be played. Therefore, when it is determined that there is no such situation, the main service of the target video data processing process can be directly run so as to run the main service of the target video data processing process to process the video data to be played.

[0116] Step S109: Actively close the first target video data processing process and create a second target video data processing process as the target video processing process.

[0117] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can determine whether there is a situation where memory leakage in the application rendering system causes continuous memory increase. If there is a situation where memory leakage in the application rendering system causes continuous memory increase, it indicates that the memory of the application rendering system leaks at the current moment, and there may be a failure caused by insufficient memory. At the current moment, the application rendering system may not be able to provide the memory required for the target video processing process to process the video data to be played, and the originally created first target video data processing process may not be directly used to process the video data to be played. It may be necessary to promptly eliminate the possible faults so that the video data to be played can be processed smoothly.

[0118] Therefore, when it is determined that there is a situation where memory leakage in the application rendering system causes continuous memory increase, the first target video data processing process can be actively closed, and a second target video data processing process can be created as the target video processing process.

[0119] When creating the second target video data processing process as the target video processing process, in order to confirm whether the newly created target video processing process can smoothly process the video data to be played, after creating the second target video data processing process as the target video processing process, the operation of passing the target screen buffer and the target video source address into the target video data processing process can be returned to be executed, so that the newly created target video processing process can be used to process the video data to be played.

[0120] Step S110, read the video playback kernel queue data.

[0121] Specifically, in the actual application process, usually the video playback kernel is used to render and play video data. Therefore, after running the target video data processing process, the video playback kernel queue data can be read to determine whether there is a video playback kernel instance waiting to be processed in the video playback kernel at the current moment.

[0122] Among them,

[0123] There may be at least one video playback kernel instance waiting to be processed in a video playback kernel queue.

[0124] Each video playback kernel instance waiting to be processed can correspond to a video data to be played.

[0125] Step S111, according to the video playback kernel queue data, determine whether there is a video playback kernel instance in the video playback kernel queue.

[0126] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can read the video playback kernel queue data, and the video playback kernel queue data can reflect whether there is a video playback kernel instance being processed in the video playback kernel sequence at the current moment.

[0127] Therefore, after reading the video playback kernel queue data, it is possible to determine whether there is a video playback kernel instance in the video playback kernel queue based on the video playback kernel queue data.

[0128] If there is no video playback kernel instance in the video playback kernel queue, it means that the target video data processing process can be directly used to process the video data to be played without waiting, and then step S112 can be executed.

[0129] If there is a video playback kernel instance in the video playback kernel queue, it means that the target video data processing process cannot be directly used to process the video data to be played and waiting is required, and then step S113 can be executed.

[0130] Step S112, initiate monitoring of the memory occupied by the target video data processing process and record the value of the memory occupied by the target video data processing process.

[0131] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can, after reading the video playback kernel queue data, determine whether there is a video playback kernel instance in the video playback kernel queue based on the video playback kernel queue data.

[0132] If there is no video playback kernel instance in the video playback kernel queue, it means that the target video data processing process can be directly used to process the video data to be played without waiting, and then the monitoring of the memory occupied by the target video data processing process can be initiated and the value of the memory occupied by the target video data processing process can be recorded, so as to timely monitor the memory occupation situation of the target video data processing process, which helps to timely predict and eliminate faults in case of memory failures. In order to confirm the specific situation of the memory occupied by the current target video processing process, after initiating the monitoring of the memory occupied by the target video data processing process and recording the value of the memory occupied by the target video data processing process, the operation of reading the memory occupation space data of the target video data processing process can be returned and executed.

[0133] So as to confirm the memory occupation situation of the target video processing process.

[0134] Step S113, determine whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue.

[0135] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can, after reading the video playback kernel queue data, determine whether there is a video playback kernel instance in the video playback kernel queue according to the video playback kernel queue data.

[0136] If there is no video playback kernel instance in the video playback kernel queue, it means that the target video data processing process can be directly used to process the video data to be played. If it is necessary to wait, it can be further determined whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue.

[0137] If there is the target video playback kernel instance in the video playback kernel queue, it means that the instance currently being processed by the video playback kernel is the instance corresponding to the target video playback kernel instance, and step S114 can be executed.

[0138] Step S114, take out the target video playback kernel instance with the target video source address as the key value.

[0139] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can, when it is determined that there is no video playback kernel instance in the video playback kernel queue, further determine whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue.

[0140] In the actual application process, if there is the target video playback kernel instance in the video playback kernel queue, it means that the instance currently being processed by the video playback kernel is the instance corresponding to the target video playback kernel instance, and the target video playback kernel instance can be taken out with the target video source address as the key value.

[0141] So that the video data to be played can be played through the target video playback kernel instance.

[0142] Step S115, run the main service of the target video data processing process to bind the target screen buffer and the target video source address to the video playback kernel.

[0143] Specifically, as can be seen from the above introduction, the method provided by the embodiments of the present application can, after determining that there is the target video playback kernel instance in the video playback kernel queue, take out the target video playback kernel instance with the target video source address as the key value.

[0144] In actual application, after taking out the target video playback kernel instance, in order to better utilize the video playback kernel to play the video data corresponding to the target video playback kernel instance, the target video data processing process main service can be further run to bind the target screen buffer and the target video source address to the video playback kernel, so that the video playback kernel can use the target screen buffer and the target video source address to access the target video playback kernel instance.

[0145] in,

[0146] A Surface instance can correspond to a video playback kernel instance.

[0147] Step S116, running the video playback kernel and performing video data streaming, decapsulation, and decoding processing on the target video source address, and then writing the target video data into the target screen buffer.

[0148] Specifically, from the above introduction, it can be seen that the method provided in the embodiment of the present application can run the target video data processing process main service to bind the target screen buffer and the target video source address to the video playback kernel.

[0149] In actual application, after the target screen buffer and the target video source address are bound to the video playback kernel, in order to smoothly play the video data to be played, the video data to be played needs to be processed.

[0150] For example,

[0151] The video playback kernel can be run to pull, decapsulate, and decode the video data of the target video source address to obtain the target video data to be played.

[0152] After obtaining the target video data to be played, the target video data may be written into the target screen buffer so that the target video data may be played using the target screen buffer.

[0153] From the above introduction, it can be seen that in actual application, the entire video playback process of the mobile application is mainly carried out in the main process of the application.

[0154] The main process of the application needs to carry out a large number of video data operations such as video streaming, decapsulation, and decoding by the video playback kernel.

[0155] However, this part of the functional process often takes up a large amount of application memory space, causing application memory space overflow, making the application functions unusable or crashing.

[0156] Step S117, presenting the target video data in the target screen buffer through the application rendering system.

[0157] Specifically, as introduced above, the method provided in the embodiments of the present application can, after binding the target screen buffer and the target video source address to the video playback kernel, run the video playback kernel and perform video data pulling, decompression, and decoding processing on the target video source address, and then write the target video data into the target screen buffer.

[0158] In the actual application process, after writing the target video data to the target screen buffer, the target video data in the target screen buffer can be presented through the application rendering system.

[0159] For example, a relatively comprehensive use case was implemented on a certain home surveillance App. In the cloud video playback module of this home surveillance App, when the user selects to open a video in the cloud video playback list, the home surveillance App can apply for a Surface screen buffer from the rendering system on the video playback page, create an independent video data processing process, and pass the Surface and the cloud storage video address to the independent video data processing process through AIDL.

[0160] The video playback kernel in the independent video data processing process performs video data pulling, decompression, decoding, etc. according to the video source address, writes the video data into the Surface screen buffer, and presents it through the application rendering system.

[0161] It can be seen from the technical solutions introduced above that when it is necessary to play the to-be-played video data using a mobile terminal, the method provided in the embodiments of the present application can use the mobile terminal to play the video based on memory allocation, effectively separate the two processes of video interface rendering and video data processing at the process level, reuse the data of the same-source video in the video data processing process, and monitor the memory allocation to avoid memory overflow or leakage of data, effectively ensuring the stability of the memory peak value fluctuation during mobile video playback, and providing a more stable and reliable video playback method for mobile terminal applications.

[0162] At the same time, a large amount of application memory space can also be released to the application main process, solving the problem of enabling the stable and reliable video playback ability of mobile terminal applications under the condition of limited application memory space. Compared with the traditional single-process video playback of mobile terminal applications, the stability and reliability of video playback are improved.

[0163] In the actual application process, if the target video playback kernel instance does not exist in the video playback kernel queue, the processing process of the method provided by the embodiments of the present application is different. When the target video playback kernel instance does not exist in the video playback kernel queue, the embodiments of the present application can create a video playback kernel instance and process the created video playback kernel instance. Next, this process will be introduced. This process can include the following steps:

[0164] Step S201, create a first target video playback kernel instance.

[0165] Specifically, as introduced above, if the target video playback kernel instance does not exist in the video playback kernel queue, it means that at the current moment, there is no target video playback kernel instance corresponding to the target video data processing process in the video playback kernel queue, and the target video data to be played cannot be directly played using the target video data processing process and the video playback kernel.

[0166] Therefore, when it is determined that the target video playback kernel instance does not exist in the video playback kernel queue, the method provided by the embodiments of the present application can create a first target video playback kernel instance.

[0167] Among them, the first target video playback kernel instance corresponds to the target video data processing process.

[0168] Step S202, set the target video source address as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance.

[0169] Specifically, as introduced above, the method provided by the embodiments of the present application can create a first target video playback kernel instance, and since the first target video playback kernel instance corresponds to the target video data processing process.

[0170] Therefore, after creating the first target video playback kernel instance, the target video source address can be set as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance, so that the first target video playback kernel instance can be accessed through the target video source address.

[0171] Step S203, add the second target video playback kernel instance to the video playback kernel queue and return to execute the operation of taking out the target video playback kernel instance with the target video source address as the key value.

[0172] Specifically, as can be seen from the above introduction, after creating the first target video playback kernel instance in the method provided by the embodiments of the present application, the target video source address can be set as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance.

[0173] In the actual application process, after accessing the first target video playback kernel instance, in order to better display the video data to be played, after setting the target video source address as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance, the second target video playback kernel instance can be further added to the video playback kernel queue. After adding the second target video playback kernel instance to the video playback kernel queue, in order to better utilize the video playback kernel to play the video data to be played, the operation of taking out the target video playback kernel instance with the target video source address as the key value can be returned for execution.

[0174] So that the video playback kernel can access the target video playback kernel instance through the target video source address.

[0175] As can be seen from the technical solutions introduced above, when the target video playback kernel instance does not exist in the video playback kernel queue, the embodiments of the present application can create a video playback kernel instance and process the created video playback kernel instance, so that the second target video playback kernel instance can be added to the video playback kernel queue, which helps to play the video data to be played using the target mobile terminal.

[0176] Next, the mobile terminal video playback device provided by the embodiments of the present application will be described. The mobile terminal video playback device described below can be correspondingly referred to the mobile terminal video playback method described above.

[0177] See Figure 2 , Figure 2 which is a schematic structural diagram of a mobile terminal video playback device disclosed in the embodiments of the present application.

[0178] As Figure 2 shown, the mobile terminal video playback device may include:

[0179] A startup unit 101, configured to start the main process of the target mobile terminal application and enter the video playback page to start the video playback function of the target mobile terminal application;

[0180] A buffer application unit 102, configured to apply to the application rendering system to obtain a target screen buffer;

[0181] The first judgment unit 103 is configured to judge whether there is a video data processing process in the application rendering system;

[0182] The first creation unit 104 is configured to, when the execution result of the first judgment unit indicates that there is no video data processing process in the application rendering system, create a first target video data processing process as the target video data processing process;

[0183] The transmission unit 105 is configured to transmit the target screen buffer and the target video source address into the target video data processing process;

[0184] The first reading unit 106 is configured to read the memory occupancy data of the target video data processing process;

[0185] The second judgment unit 107 is configured to judge, according to the memory occupancy data of the target video data processing process, whether there is a situation where the application rendering system has a memory leak resulting in continuous memory increase;

[0186] The first running unit 108 is configured to, when the execution result of the second judgment unit indicates that there is no situation where the application rendering system has a memory leak resulting in continuous memory increase, directly run the main service of the target video data processing process;

[0187] The second reading unit 109 is configured to read the video play kernel queue data;

[0188] The third judgment unit 110 is configured to judge, according to the video play kernel queue data, whether there is a video play kernel instance in the video play kernel queue;

[0189] The fourth judgment unit 111 is configured to, when the execution result of the third judgment unit indicates that there is a video play kernel instance in the video play kernel queue, judge whether there is a target video play kernel instance corresponding to the target video source address in the video play kernel queue;

[0190] The first setting unit 112 is configured to, when the execution result of the fourth judgment unit indicates that there is the target video play kernel instance in the video play kernel queue, take out the target video play kernel instance with the target video source address as the key value;

[0191] The second running unit 113 is configured to run the main service of the target video data processing process to bind the target screen buffer and the target video source address to the video play kernel;

[0192] The third operation unit 114 is configured to run a video playback kernel, perform video data pulling, de-encapsulation, and decoding processing on the target video source address, and then write the target video data into the target screen buffer;

[0193] The display unit 115 is configured to display the target video data in the target screen buffer through the application rendering system.

[0194] As can be seen from the technical solutions introduced above, when it is necessary to stably play the video data to be played on the mobile terminal, the device provided by the embodiment of the present application can start the main process of the target mobile terminal application, enter the video playback page to start the video playback function of the target mobile terminal application; and apply to the application rendering system to obtain the target screen buffer; after obtaining the target screen buffer, it can be determined whether there is a video data processing process in the application rendering system; if there is no video data processing process in the application rendering system, it means that there is no process in the current application rendering system that can process video data, then a first target video data processing process can be created as the target video data processing process for processing the target video data to be played; and after creating the supplementary video data processing process, the target screen buffer and the target video source address are passed into the target video data processing process; at the same time, the memory occupancy data of the target video data processing process can be read; and based on the memory occupancy data of the target video data processing process, it can be further determined whether there is a situation where the application rendering system has a memory leak resulting in continuous memory increase; if there is no situation where the application rendering system has a memory leak resulting in continuous memory increase, it means that directly running the target video data processing process will not cause a failure, then the main service of the target video data processing process can be directly run; and the video playback kernel queue data can be read; after determining the video playback kernel queue data, based on the video playback kernel queue data, it can be further determined whether there is a target video playback kernel instance in the video playback kernel queue; if there is a video playback kernel instance in the video playback kernel queue, it means that there is no need to create a new video playback kernel instance, then it can be further determined whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue; if there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue, the target video source address can be taken as the key value to obtain the corresponding target video playback kernel instance; and the main service of the target video data processing process is run to bind the target screen buffer and the target video source address to the target video playback kernel; the target video playback kernel is run to perform video data pulling, de-encapsulation, and decoding processing according to the target video source address, and then the target video data is written into the target screen buffer; finally, the target video data in the target screen buffer can be presented through the application rendering system.

[0195] The device provided by the embodiment of the present application can utilize the mobile terminal to play videos based on memory allocation, effectively separating the two processes of video interface rendering and video data processing at the process level. The video data processing process reuses data for homologous videos and monitors memory allocation to avoid memory overflow or leakage of data, effectively ensuring stable fluctuations in the memory peak value during mobile video playback, and providing a more stable and reliable video playback method for mobile terminal applications.

[0196] Further optionally, the device may further include:

[0197] A process closing unit, configured to actively close the first target video data processing process and create a second target video data processing process as the target video processing process when the execution result of the second determination unit is that there is a memory leak in the application rendering system resulting in continuous memory increase; and return to execute the operation of passing the target screen buffer and the target video source address into the target video data processing process.

[0198] Further optionally, the device may further include:

[0199] A monitoring unit, configured to initiate monitoring of the memory occupancy space of the target video data processing process and record the memory occupancy space value of the target video data processing process when the execution result of the third determination unit is that there is no video playback kernel instance in the video playback kernel queue; and return to execute the operation of reading the memory occupancy space data of the target video data processing process.

[0200] Further optionally, the device may further include:

[0201] An instance creation unit, configured to create a first target video playback kernel instance when the execution result of the fourth determination unit is that there is no target video playback kernel instance in the video playback kernel queue;

[0202] A second setting unit, configured to set the target video source address as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance;

[0203] An instance adding unit, configured to add the second target video playback kernel instance to the video playback kernel queue and return to execute the operation of taking out the corresponding target video playback kernel instance with the target video source address as the key value.

[0204] Among them, for the specific processing flow of each unit included in the above mobile terminal video playback device, reference may be made to the relevant introduction in the previous part of the mobile terminal video playback method, which will not be elaborated here.

[0205] The mobile terminal video playback device provided by the embodiments of the present application can be applied to mobile terminal video playback devices, such as terminals: mobile phones, computers, etc. Optionally, Figure 3 shows a hardware structure block diagram of a mobile terminal video playback device. Referring to Figure 3 , the hardware structure of the mobile terminal video playback device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4.

[0206] In the embodiments of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 complete mutual communication through the communication bus 4.

[0207] The processor 1 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application, etc.;

[0208] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory, etc., such as at least one disk memory;

[0209] Among them, the memory stores a program, and the processor can call the program stored in the memory. The program is used to: implement each processing flow in the aforementioned terminal mobile terminal video playback solution.

[0210] The embodiments of the present application also provide a readable storage medium. The storage medium can store a program suitable for the processor to execute. The program is used to: implement each processing flow in the aforementioned terminal in the mobile terminal video playback solution.

[0211] Finally, it should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0212] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other.

[0213] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. The various embodiments can be combined with each other. Therefore, the present application will not be limited to these embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for playing video on a mobile terminal, characterized in that, Including: Start the main process of the target mobile terminal application and enter the video playback page to start the video playback function of the target mobile terminal application; Apply to the application rendering system to obtain the target screen buffer; Judge whether there is a video data processing process in the application rendering system; If there is no video data processing process in the application rendering system, create a first target video data processing process as the target video data processing process; Pass the target screen buffer and the target video source address into the target video data processing process; Read the memory occupancy data of the target video data processing process; Based on the memory occupancy data of the target video data processing process, judge whether there is a situation where the application rendering system has a memory leak resulting in continuous memory increase; If there is no situation where the application rendering system has a memory leak resulting in continuous memory increase, directly run the main service of the target video data processing process; Read the video playback kernel queue data; Based on the video playback kernel queue data, judge whether there is a video playback kernel instance in the video playback kernel queue; If there is a video playback kernel instance in the video playback kernel queue, judge whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue; If there is the target video playback kernel instance in the video playback kernel queue, take out the target video playback kernel instance with the target video source address as the key value; Run the main service of the target video data processing process to bind the target screen buffer and the target video source address to the video playback kernel; Run the video playback kernel and perform video data pulling, de-encapsulation, and decoding processing on the target video source address, and then write the target video data into the target screen buffer; Display the target video data in the target screen buffer through the application rendering system; If there is a situation where the application rendering system has a memory leak resulting in continuous memory increase, actively close the first target video data processing process and create a second target video data processing process as the target video processing process; And return to execute the operation of passing the target screen buffer and the target video source address into the target video data processing process.

2. The method according to claim 1, wherein The method further includes: If there is no video playback kernel instance in the video playback kernel queue, initiate memory occupancy monitoring of the target video data processing process and record the memory occupancy value of the target video data processing process; And return to execute the operation of reading the memory occupancy data of the target video data processing process.

3. The method according to claim 1, wherein The method further includes: If there is no target video playback kernel instance in the video playback kernel queue, create a first target video playback kernel instance; Set the target video source address as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance; Add the second target video playback kernel instance to the video playback kernel queue, and return the operation of taking out the target video playback kernel instance with the target video source address as the key value.

4. A mobile terminal video playback device, characterized in that, Including: A startup unit for starting the main process of the target mobile terminal application and entering the video playback page to start the video playback function of the target mobile terminal application; A buffer application unit for applying to the application rendering system to obtain a target screen buffer; A first judgment unit for judging whether there is a video data processing process in the application rendering system; A first creation unit for creating a first target video data processing process as the target video data processing process when the execution result of the first judgment unit is that there is no video data processing process in the application rendering system; A transmission unit for transmitting the target screen buffer and the target video source address into the target video data processing process; A first reading unit for reading the memory occupancy data of the target video data processing process; A second judgment unit for judging whether there is a situation where the memory of the application rendering system continuously increases due to memory leakage based on the memory occupancy data of the target video data processing process; A first running unit for directly running the main service of the target video data processing process when the execution result of the second judgment unit is that there is no situation where the memory of the application rendering system continuously increases due to memory leakage; A second reading unit for reading the video playback kernel queue data; A third judgment unit for judging whether there is a video playback kernel instance in the video playback kernel queue based on the video playback kernel queue data; A fourth judgment unit for judging whether there is a target video playback kernel instance corresponding to the target video source address in the video playback kernel queue when the execution result of the third judgment unit is that there is a video playback kernel instance in the video playback kernel queue; A first setting unit for taking out the target video playback kernel instance with the target video source address as the key value when the execution result of the fourth judgment unit is that there is the target video playback kernel instance in the video playback kernel queue; A second running unit for running the main service of the target video data processing process to bind the target screen buffer and the target video source address to the video playback kernel; A third running unit for running the video playback kernel and performing video data pulling, de-encapsulation, and decoding processing on the target video source address, and then writing the target video data into the target screen buffer; A display unit for displaying the target video data of the target screen buffer through the application rendering system; A process closing unit for actively closing the first target video data processing process and creating a second target video data processing process as the target video processing process when the execution result of the second judgment unit is that there is a situation where the memory of the application rendering system continuously increases due to memory leakage; And return the operation of executing the operation of passing the target screen buffer and the target video source address into the target video data processing process.

5. The device according to claim 4, characterized in that The device further includes: A monitoring unit, configured to initiate monitoring of the memory occupancy space of the target video data processing process and record the memory occupancy space value of the target video data processing process when the execution result of the third determination unit is that there is no video playback kernel instance in the video playback kernel queue; and return the operation of executing the operation of reading the memory occupancy space data of the target video data processing process.

6. The device according to claim 4, characterized in that The device further includes: An instance creation unit, configured to create a first target video playback kernel instance when the execution result of the fourth determination unit is that there is no target video playback kernel instance in the video playback kernel queue; A second setting unit, configured to set the target video source address as the key value of the first target video playback kernel instance to obtain a second target video playback kernel instance; An instance addition unit, configured to add the second target video playback kernel instance to the video playback kernel queue, and return the operation of executing the operation of taking out the corresponding target video playback kernel instance with the target video source address as the key value.

7. A mobile terminal video playback device, characterized in that, Includes: One or more processors, and a memory; Computer-readable instructions are stored in the memory, and when the computer-readable instructions are executed by the one or more processors, the steps of the mobile terminal video playback method according to any one of claims 1 to 3 are implemented.

8. A readable storage medium, characterized in that: Computer-readable instructions are stored in the readable storage medium, and when the computer-readable instructions are executed by one or more processors, one or more processors are caused to implement the steps of the mobile terminal video playback method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Information processing method and device, electronic equipment and storage medium

    CN113918366A

  • Application program management method and electronic equipment

    CN114020652A