Video recording method and device, electronic equipment and readable storage medium
By detecting the number of hardware abstraction layer buffers and sending video frames when there is enough buffer, the frame loss problem caused by asynchronous input and output of the external chip framework is solved, and the video recording effect is improved.
Patent Information
- Application Number
- CN202411593572.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-11-08
AI Technical Summary
When recording videos, electronic devices are prone to frame loss due to the asynchronous input and output of the external chip frame, resulting in poor video recording.
通过检测硬件抽象层中的缓冲器数量,在缓冲器数量大于或等于某一数量时,控制厂商相机服务框架向硬件抽象层发送录制的视频帧,确保视频帧得到处理,减少丢帧现象。
It effectively reduces frame drop behavior during video recording and improves the effect of recording videos. Even if the input and output are asynchronous, it can ensure that the video frames are processed.
Smart Images

Figure CN119254912A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of electronic equipment, and specifically relates to a video recording method, device, electronic equipment and readable storage medium. Background Art
[0002] At present, when recording videos, electronic devices can improve the recording effect by adding an external integrated circuit (IC) chip in the electronic device. In the external chip framework after adding the external IC chip, the IC driver is integrated on the manufacturer's camera service framework side and is responsible for sending video frames to the external IC chip, while the IC sensor channel is integrated on the hardware abstraction layer (HAL) and is responsible for asynchronously outputting the processing results of the external IC chip on the video frame.
[0003] However, due to the asynchronous input and output process of the above-mentioned plug-in chip framework, frame loss is prone to occur, resulting in poor video recording effect. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a video recording method, device, electronic device and readable storage medium, which can reduce frame loss and improve the effect of recording video.
[0005] In a first aspect, an embodiment of the present application provides a video recording method, the method comprising: during video recording, detecting the number of buffers in a hardware abstraction layer of an electronic device; when the number of buffers is greater than or equal to a first number, sending the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.
[0006] In second aspect, an embodiment of the present application provides a video recording device, which includes a detection module and a sending module; the detection module is used to detect the number of buffers in the hardware abstraction layer of the electronic device during video recording; the sending module is used to send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device when the number of buffers is greater than or equal to a first number.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program / program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0011] In an embodiment of the present application, during the process of recording a video, the number of buffers in the hardware abstraction layer of the electronic device can be detected; and when the number of buffers is greater than or equal to a first number, the recorded video frames are sent to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device. Through this solution, when it is determined that there are enough buffers in the hardware abstraction layer of the electronic device, the manufacturer's camera service framework of the electronic device can be controlled to send the recorded video frames to the hardware abstraction layer, so that the sent video frames can be processed. In this way, even if the input and output asynchronous process of the external chip framework of the IC chip is added, the frame loss behavior can be reduced by controlling the sending timing of the video frames, thereby improving the effect of recording the video. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is a schematic diagram of a plug-in chip framework in the related art;
[0013] Figure 2 It is one of the flow charts of the video recording method provided in the embodiment of the present application;
[0014] Figure 3 This is the second flowchart of the video recording method provided in the embodiment of the present application;
[0015] Figure 4 It is a schematic diagram of the communication between the manufacturer's camera service framework and the hardware abstraction layer through the first variable in the video recording method provided in an embodiment of the present application;
[0016] Figure 5 It is a schematic diagram of the execution logic of the video recording method provided in the embodiment of the present application;
[0017] Figure 6 This is the third flowchart of the video recording method provided in the embodiment of the present application;
[0018] Figure 7 is a schematic diagram of executing a callback function in the video recording method provided in an embodiment of the present application;
[0019] Figure 8 This is the fourth flow chart of the video recording method provided in the embodiment of the present application;
[0020] Fig. 9 It is a schematic diagram of IC chip frame loss in the related art;
[0021] Fig.10 It is a schematic diagram of an IC chip processing frame loss in a video recording method provided in an embodiment of the present application;
[0022] Fig.11 This is the fifth flow chart of the video recording method provided in the embodiment of the present application;
[0023] Fig.12 is a schematic diagram of a video recording device provided in an embodiment of the present application;
[0024] Fig.13 is a schematic diagram of an electronic device provided in an embodiment of the present application;
[0025] Fig.14 It is a hardware schematic diagram of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0027] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0028] The term "indication" in this application can be a direct indication (or explicit indication) or an indirect indication (or implicit indication). A direct indication can be understood as the sender explicitly informing the receiver of specific information, operations to be performed, or request results in the sent indication; an indirect indication can be understood as the receiver determining the corresponding information according to the indication sent by the sender, or making a judgment and determining the operation to be performed or the request result according to the judgment result.
[0029] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".
[0030] The video recording method, device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0031] Currently, when an electronic device records a video, the effect of recording the video can be improved by adding an external IC chip to the electronic device.
[0032] For example, Figure 1 FIG. 1 shows a schematic diagram of an external chip frame after adding an external IC chip. Figure 1 As shown, the IC driver is integrated on the manufacturer's camera service framework side. The manufacturer's camera framework ingests data acquired by the data node in real time, and sends the data to the IC via the manufacturer's camera framework real-time chip data sending node and the display processing unit, wherein the display processing unit has the functions of layer synthesis and image processing; the IC sensor node channel is placed on the HAL side. As a source node, the sensor node receives the output data of the IC and asynchronously outputs the processing result of the IC. It runs independently of the IC driver and is partially decoupled from the HAL.
[0033] However, due to the asynchronous input and output process of the above-mentioned plug-in chip framework, the Internet Service Provider (ISP) queue in the HAL may be empty when the IC outputs a frame, resulting in frame loss. This has a great impact on the post-editing and reprocessing process or the recording stop process, resulting in poor video recording effect.
[0034] In order to solve the above problems, the embodiments of the present application provide a video recording method, device, electronic device and readable storage medium. The video recording method provided by the embodiments of the present application can be applied to the scenario where the user performs video recording.
[0035] In the video recording method provided in the embodiment of the present application, during the process of recording a video, the number of buffers in the hardware abstraction layer of the electronic device can be detected; and when the number of buffers is greater than or equal to a first number, the recorded video frames are sent to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device. Through this scheme, when it is determined that there are enough buffers in the hardware abstraction layer of the electronic device, the manufacturer's camera service framework of the electronic device can be controlled to send the recorded video frames to the hardware abstraction layer, so that the sent video frames can be processed. In this way, even if the input and output asynchronous process of the external chip framework of the IC chip is added, the frame loss behavior can be reduced by controlling the sending timing of the video frames, thereby improving the effect of recording the video.
[0036] It should be noted that the video recording method provided in the embodiments of the present application can be executed by a video recording device, an electronic device, or a functional module in an electronic device, etc. In some embodiments of the present application, an electronic device executing the video recording method is taken as an example to illustrate the video recording method provided in the embodiments of the present application.
[0037] Figure 2 FIG. 1 is a flow chart of a video recording method provided by an embodiment of the present application. Figure 2 As shown, the video recording method provided in the embodiment of the present application may include the following steps 201 and 202.
[0038] Step 201: During video recording, the electronic device detects the number of buffers in the hardware abstraction layer of the electronic device.
[0039] In the embodiment of the present application, the hardware abstraction layer is an interface layer between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on multiple platforms. From the perspective of software and hardware testing, the testing of software and hardware can be completed based on the hardware abstraction layer, making it possible to conduct software and hardware testing in parallel.
[0040] Optionally, in an embodiment of the present application, the above-mentioned buffer can be used to cache video frames so that the chip in the hardware abstraction layer can process the video frames.
[0041] Optionally, in the embodiment of the present application, combined with Figure 2 ,like Figure 3 As shown, the above step 201 can be specifically implemented through the following step 201a.
[0042] Step 201a: During the video recording process, the electronic device detects the value of the first variable through the manufacturer's camera service framework.
[0043] The value of the first variable is used to indicate the number of the buffers, and the value of the first variable is updated in real time by the hardware abstraction layer.
[0044] Optionally, in an embodiment of the present application, the first variable may be a hidle variable created by the electronic device, and the first variable may be used for real-time communication between the manufacturer's camera service framework and the hardware abstraction layer.
[0045] Optionally, in an embodiment of the present application, the initial value of the above-mentioned first variable can be any possible value such as 0, -1 or -2. Before submitting the requested buffer address into the kernel, the above-mentioned hardware abstraction layer can add 1 to the value of the above-mentioned first variable to update the value of the first variable.
[0046] In an embodiment of the present application, since the electronic device can detect the value of the above-mentioned first variable through the manufacturer's camera service framework to obtain the number of the above-mentioned buffers, the first variable can facilitate the manufacturer's camera service framework to obtain the number of the buffers in a timely manner, thereby simplifying the process of obtaining the number of the buffers.
[0047] Optionally, in the embodiment of the present application, the electronic device may also detect the number of the above buffers through the above hardware abstraction layer.
[0048] Step 202: When the number of buffers is greater than or equal to the first number, the electronic device sends the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.
[0049] Optionally, in the embodiment of the present application, the first number may be any value greater than 0, such as 1, 2 or 3.
[0050] It can be understood that when the number of the buffers is greater than or equal to the first number, there are enough buffers in the hardware abstraction layer to cache the video frames.
[0051] Optionally, in an embodiment of the present application, the number of the recorded video frames may be one or more.
[0052] Optionally, in an embodiment of the present application, when the number of the recorded video frames is multiple, the multiple video frames are multiple video frames recorded continuously.
[0053] Optionally, in an embodiment of the present application, when the electronic device detects the value of the above-mentioned first variable through the above-mentioned manufacturer's camera service framework to obtain the number of the above-mentioned buffers, if the number of the buffers is greater than or equal to the above-mentioned first number, the above-mentioned manufacturer's camera service framework can automatically send the recorded video frame to the above-mentioned hardware abstraction layer.
[0054] For example, Figure 4As shown, HAL will add 1 to the count of the first variable (the initial value of the first variable x=0, -1 or -2) before submitting the requested buffer address to the kernel. Then the manufacturer's camera service framework can detect the value of the first variable in real time, and send the recorded video frame to HAL when the value of the first variable is greater than 0. This ensures that HAL does not lose frames; Figure 4 NV12 is a format in the YUV color space, belonging to the YUV420SP (Semi-Planar) format. In this format, the Y component (brightness) and the UV component (chrominance) are stored separately, but the UV component is stored interleaved, that is, the U and V components are arranged alternately.
[0055] For example, Figure 5 As shown, the specific logic of the video recording method provided in the embodiment of the present application is as follows:
[0056] 1. HAL increments the count of the first variable by 1 before submitting the requested buffer address into the kernel.
[0057] 2. When the count of the first variable is greater than 0, the manufacturer camera service framework sends a frame to the display processing unit.
[0058] 3. When a continuous frame delivery ends (video recording stops or flushes), HAL adds 8 to the count of the first variable and notifies the manufacturer's camera service framework to clear all cached and locked video frames.
[0059] This ensures that HAL does not drop frames.
[0060] Optionally, in the embodiment of the present application, combined with Figure 2 ,like Figure 6 As shown, the above step 202 can be specifically implemented through the following step 202a.
[0061] Step 202a: When the number of buffers is greater than or equal to the first number and the manufacturer's camera service framework receives a notification corresponding to the callback function, the electronic device sends the recorded video frame to the hardware abstraction layer through the manufacturer's camera service framework.
[0062] The callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frame function.
[0063] Optionally, in the embodiment of the present application, the above callback function may be a FrameReadyCallback function.
[0064] For example, Figure 7As shown, you can add a FrameReadyCallback function and call it during configuration, and save the FrameReadyCallback function to m_readyCb of HAL.
[0065] Among them, HAL is responsible for calling back to the manufacturer's camera service framework (FrameReady) when the Internet service provider queue meets the requirements.
[0066] Manufacturer camera service framework:
[0067] a. Add a new thread A to execute the function RequestExecutor(), m_requestCV.wait().
[0068] b. Manufacturer's camera framework real-time chip data sending node:: When flushing the request, push each frame request to inflightReqQueue.
[0069] c. When FrameReadyCallback is received, m_requestCV notify is executed to wake up thread A, pop a request from m_inflightReqQueue, and send IC data (DPU->IC) to ensure that the hardware abstraction layer can process a sufficient number of video frame requests before receiving IC data from IFELite, which will not cause frame loss in the hardware abstraction layer.
[0070] d. For scenes such as stopping recording, post-editing or flushing, and stopping sending requests: the flushrequest function of hwcnode will be called, m_requestCV notify will be executed, thread A will be woken up, and the remaining requests will be popped out from m_inflightReqQueue for normal processing.
[0071] In an embodiment of the present application, since the number of the above-mentioned buffers is greater than or equal to the above-mentioned first number, and the above-mentioned manufacturer's camera service framework receives the notification corresponding to the above-mentioned callback function, the electronic device can send the recorded video frames to the above-mentioned hardware abstraction layer through the manufacturer's camera service framework. Therefore, direct interaction between the manufacturer's camera service framework and the hardware abstraction layer can be achieved through the same process, thereby reducing calling overhead.
[0072] Optionally, in the embodiment of the present application, combined with Figure 2 ,like Figure 8 As shown, the above step 202 can be specifically implemented by the following step 202b, and after step 202b, the video recording method provided in the embodiment of the present application can also include the following steps A to C.
[0073] It should be noted that IC chips may also cause frame loss due to hardware defects. Fig. 9 As shown in the figure, the frame with the timestamp of Req 21 being 133 is dropped by the IC chip, and the frame T=166 that is normally output later is filled into Req 21, which results in a permanent misalignment of one frame between the input image and the output image. After the frame is lost, the buffer and metadata obtained by the subsequent processing of the IC chip are misaligned. Even if the request for the latest data to be filled is returned in the form of an error to restore the misalignment, the actual frame loss will be more serious.
[0074] Step 202b: When the number of buffers is greater than or equal to the first number, the electronic device sends at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework.
[0075] The first information includes at least one of a timestamp and a request identifier.
[0076] Optionally, in an embodiment of the present application, the at least two video frames are continuously recorded video frames.
[0077] Optionally, in an embodiment of the present application, the first information may be used to determine whether a video frame is lost.
[0078] Step A: The electronic device receives the video frames and the first information corresponding to each video frame sent by the manufacturer's camera service framework through the chip in the hardware abstraction layer.
[0079] Optionally, in an embodiment of the present application, the above-mentioned chip may be an IC chip.
[0080] Step B: The electronic device determines the lost video frame among the at least two video frames based on the first information corresponding to each video frame through the chip.
[0081] For example, taking the above-mentioned first information including a request identifier as an example, assuming that the above-mentioned chip receives a video frame with a request identifier a+2 after receiving a video frame with a request identifier a, then it can be determined that the video frame with a request identifier a+1 is lost.
[0082] Step C: The electronic device processes the received video frame through the chip and sends the processed video frame to the manufacturer's camera service framework.
[0083] The lost video frame among the at least two video frames is sent to the manufacturer's camera service framework in an erroneous form.
[0084] Optionally, in an embodiment of the present application, the video frame is sent in an erroneous form, that is, the video frame is directly set as an error and then sent.
[0085] For the specific method of processing the video frame through the chip, please refer to the relevant description in the related technology. In order to avoid repetition, it will not be described here.
[0086] For example, the verification method can be agreed with the IC chip in the HAL, and the input and output metadata can be added with a timestamp or a request identifier. When IFELite receives the video frame and metadata, it can determine whether it is abnormal based on the timestamp or the request identifier. Fig.10 As shown, the output of Req 11 is lost. According to the timestamp, it can be determined that the video frame belongs to Req 10 and Req 12, so that the processing results of Req 10 and Req 12 can be returned to the manufacturer's camera service framework respectively, and when the 11+N frame is returned, Req11 is returned to the manufacturer's camera service framework in an error form, so that it can be ensured that the data returned by the IC chip is the same frame as the data returned to the manufacturer's camera service framework. Among them, N is the maximum number of waiting frames to prevent Req 11 from not returning. After that, it can be ensured that the frames after the lost frame match the metadata, and the effect processing is normal.
[0087] In the embodiment of the present application, since the lost video frames can be determined based on the first information corresponding to each video frame, and the lost video frames are sent in an erroneous form when the processing results of the video frames are returned, it can be ensured that the data sent by the chip and the data received by the camera service framework of the above-mentioned manufacturer are the same frame, thereby ensuring that the frame after the frame loss matches the metadata, effectively suppressing the recording of dropped frames and improving the video recording effect.
[0088] In the video recording method provided in the embodiment of the present application, when it is determined that there is enough buffer in the hardware abstraction layer of the electronic device, the manufacturer's camera service framework of the electronic device can be controlled to send the recorded video frames to the hardware abstraction layer so that the sent video frames can be processed. In this way, even if the input and output asynchronous process of the plug-in chip framework of the IC chip is added, the frame loss behavior can be reduced by controlling the sending timing of the video frame, thereby improving the effect of recording the video.
[0089] Optionally, in the embodiment of the present application, combined with Figure 3 ,like Fig.11 As shown, after the above step 202, the video recording method provided in the embodiment of the present application may further include the following step 203.
[0090] Step 203: The electronic device updates the value of the first variable to the first value through the hardware abstraction layer.
[0091] Among them, when the value of the above-mentioned first variable is the above-mentioned first value, the first variable is used to notify the above-mentioned manufacturer camera service framework to clear the cached video frames.
[0092] Optionally, in the embodiment of the present application, the first numerical value may be any possible numerical value such as 6, 7 or 8.
[0093] Optionally, in the embodiment of the present application, the above-mentioned first value may be preset by the system, or may be arbitrarily set by the user according to actual usage requirements.
[0094] Exemplarily, after the electronic device sends the recorded continuous video frames to the hardware abstraction layer through the manufacturer's camera service framework, the hardware abstraction layer can add 8 to the numerical value of the first variable to update the numerical value of the first variable to the first numerical value, so as to notify the manufacturer's camera service framework to clear the cached video frames in order to cache the newly recorded video frames.
[0095] In the embodiment of the present application, since the electronic device can update the value of the above-mentioned first variable to the above-mentioned first value to notify the above-mentioned manufacturer's camera service framework to clear the cached video frames, it is possible to enrich the interaction function between the manufacturer's camera service framework and the above-mentioned hardware abstraction layer by updating the value of the first variable, so as to facilitate timely clearing of cached data and processing of newly recorded video frames.
[0096] The above-mentioned method embodiments, or various possible implementation methods in each method embodiment, can be executed separately, or, under the premise that there is no contradiction, can also be executed in combination with each other. The specific implementation can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.
[0097] The video recording method provided in the embodiment of the present application can be executed by a video recording device. In the embodiment of the present application, the video recording device provided in the embodiment of the present application is described by taking the video recording method executed by the video recording device as an example.
[0098] like Fig.12 As shown, an embodiment of the present application provides a video recording device 10 , which may include a detection module 11 and a sending module 12 .
[0099] The detection module 11 can be used to detect the number of buffers in the hardware abstraction layer of the electronic device during video recording. The sending module 12 can be used to send the recorded video frame to the hardware abstraction layer through the manufacturer camera service framework of the electronic device when the number of buffers is greater than or equal to the first number.
[0100] In one possible implementation, the detection module 11 can be specifically used to detect the value of the first variable through the above-mentioned manufacturer's camera service framework; wherein the value of the first variable is used to indicate the number of the above-mentioned buffers, and the value of the first variable is updated in real time by the above-mentioned hardware abstraction layer.
[0101] In a possible implementation, the video recording device 10 may further include an update module. The update module may be used to update the value of the first variable to a first value through the hardware abstraction layer after the sending module 12 sends the recorded video frame to the hardware abstraction layer through the manufacturer camera service framework of the electronic device; wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer camera service framework to clear the cached video frame.
[0102] In one possible implementation, the sending module 12 can be specifically used to send the recorded video frame to the above-mentioned hardware abstraction layer through the manufacturer's camera service framework when the number of the above-mentioned buffers is greater than or equal to the above-mentioned first number and the above-mentioned manufacturer's camera service framework receives a notification corresponding to the callback function; wherein the callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frame function.
[0103] In a possible implementation, the video recording device 10 may further include a receiving module and a processing module. The sending module 12 may be specifically used to send at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the above-mentioned manufacturer's camera service framework, and the first information includes at least one of a timestamp and a request identifier. The receiving module may be used to receive the video frames and the first information corresponding to each video frame sent by the manufacturer's camera service framework through the chip in the hardware abstraction layer after the sending module 12 sends at least two video frames and the first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework. The processing module may be used to determine the lost video frame among the at least two video frames through the chip based on the first information corresponding to each video frame; and process the received video frame through the chip, and send the processed video frame to the manufacturer's camera service framework, wherein the lost video frame among the at least two video frames is sent to the manufacturer's camera service framework in an erroneous form.
[0104] In the video recording device provided in the embodiment of the present application, the video recording device can control the manufacturer's camera service framework of the electronic device to send the recorded video frames to the hardware abstraction layer when it is determined that there are enough buffers in the hardware abstraction layer of the electronic device, so that the sent video frames can be processed. In this way, even if the input and output asynchronous process of the plug-in chip framework of the IC chip is added, the frame loss behavior can be reduced by controlling the sending timing of the video frame, thereby improving the effect of recording the video.
[0105] The video recording device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0106] The video recording device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0107] The video recording device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and achieve the same technical effect. To avoid repetition, it will not be described here.
[0108] like Fig.13 As shown, an embodiment of the present application also provides an electronic device 100, including a processor 101 and a memory 102, wherein the memory 102 stores programs or instructions that can be executed on the processor 101, and when the program or instructions are executed by the processor 101, the various steps of the above-mentioned video recording method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0109] It should be noted that the electronic devices in the embodiments of the present application include mobile electronic devices and non-mobile electronic devices.
[0110] Fig.14 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0111] like Fig.14As shown, the electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.
[0112] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.14 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0113] Among them, processor 1010 can be used to detect the number of buffers in the hardware abstraction layer of the electronic device during the process of recording video; and when the number of buffers is greater than or equal to the first number, send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.
[0114] In one possible implementation, the processor 1010 can be specifically used to detect the value of a first variable through the above-mentioned manufacturer's camera service framework; wherein the value of the first variable is used to indicate the number of the above-mentioned buffers, and the value of the first variable is updated in real time by the above-mentioned hardware abstraction layer.
[0115] In one possible implementation, the processor 1010 may also be used to update the value of the first variable to a first value through the hardware abstraction layer after sending the recorded video frame to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device; wherein, when the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frame.
[0116] In one possible implementation, the processor 1010 can be specifically used to send the recorded video frame to the above-mentioned hardware abstraction layer through the manufacturer's camera service framework when the number of the above-mentioned buffers is greater than or equal to the above-mentioned first number and the above-mentioned manufacturer's camera service framework receives a notification corresponding to the callback function; wherein the callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send the recorded video frame function.
[0117] In a possible implementation, the processor 1010 may be specifically configured to send at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework, wherein the first information includes at least one of a timestamp and a request identifier. The processor 1010 may also be configured to receive the video frames and the first information corresponding to each video frame sent by the manufacturer's camera service framework through a chip in the hardware abstraction layer after sending at least two video frames and the first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework; and determine the lost video frame among the at least two video frames through the chip based on the first information corresponding to each video frame; and process the received video frame through the chip, and send the processed video frame to the manufacturer's camera service framework, wherein the lost video frame among the at least two video frames is sent to the manufacturer's camera service framework in an erroneous form.
[0118] In the electronic device provided in the embodiment of the present application, the electronic device can control the manufacturer's camera service framework of the electronic device to send the recorded video frames to the hardware abstraction layer when it is determined that there are enough buffers in the hardware abstraction layer of the electronic device, so that the sent video frames can be processed. In this way, even if the input and output asynchronous process of the plug-in chip framework of the IC chip is added, the frame loss behavior can be reduced by controlling the sending timing of the video frame, thereby improving the effect of recording the video.
[0119] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and at least one of other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0120] The memory 1009 can be used to store software programs and various data. The memory 1009 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1009 may include a volatile memory or a non-volatile memory, or the memory 1009 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1009 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0121] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1010.
[0122] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned video recording method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0123] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0124] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned video recording method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0125] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0126] An embodiment of the present application provides a computer program / program product, which is stored in a storage medium. The program / program product is executed by at least one processor to implement the various processes of the above-mentioned video recording method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0127] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0129] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A video recording method, characterized in that: The method comprises: During video recording, detecting the number of buffers in a hardware abstraction layer of the electronic device; In a case where the number of the buffers is greater than or equal to the first number, the recorded video frames are sent to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device.
2. The method according to claim 1, characterized in that The detecting the number of buffers in the hardware abstraction layer of the electronic device comprises: Detecting a value of a first variable through the manufacturer camera service framework; The value of the first variable is used to indicate the number of the buffers, and the value of the first variable is updated in real time by the hardware abstraction layer.
3. The method according to claim 2, characterized in that After sending the recorded video frame to the hardware abstraction layer through the manufacturer camera service framework of the electronic device, the method further includes: Updating the value of the first variable to a first value through the hardware abstraction layer; When the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.
4. The method according to claim 1, characterized in that When the number of the buffers is greater than or equal to the first number, sending the recorded video frames to the hardware abstraction layer through the manufacturer camera service framework of the electronic device includes: When the number of the buffers is greater than or equal to the first number and the manufacturer camera service framework receives a notification corresponding to the callback function, sending the recorded video frame to the hardware abstraction layer through the manufacturer camera service framework; The callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send a recorded video frame function.
5. The method according to any one of claims 1 to 4, characterized in that The sending of the recorded video frame to the hardware abstraction layer through the manufacturer camera service framework of the electronic device includes: Sending at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the manufacturer camera service framework, where the first information includes at least one of a timestamp and a request identifier; After sending at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the manufacturer camera service framework, the method further includes: Receive, through the chip in the hardware abstraction layer, the video frames sent by the manufacturer's camera service framework and the first information corresponding to each video frame; Determine, by the chip, a lost video frame among the at least two video frames based on first information corresponding to each video frame; The chip processes the received video frame and sends the processed video frame to the manufacturer's camera service framework, wherein the lost video frame among the at least two video frames is sent to the manufacturer's camera service framework in an erroneous form.
6. A video recording device, characterized in that: The device comprises a detection module and a sending module; The detection module is used to detect the number of buffers in the hardware abstraction layer of the electronic device during the video recording process; The sending module is used to send the recorded video frames to the hardware abstraction layer through the manufacturer's camera service framework of the electronic device when the number of the buffers is greater than or equal to the first number.
7. The device according to claim 6, characterized in that The detection module is specifically used to detect the value of the first variable through the manufacturer camera service framework; The value of the first variable is used to indicate the number of the buffers, and the value of the first variable is updated in real time by the hardware abstraction layer.
8. The device according to claim 7, characterized in that The device also includes an update module; The updating module is configured to update the value of the first variable to a first value through the hardware abstraction layer after the sending module sends the recorded video frame to the hardware abstraction layer through the manufacturer camera service framework of the electronic device; When the value of the first variable is the first value, the first variable is used to notify the manufacturer's camera service framework to clear the cached video frames.
9. The device according to claim 6, characterized in that The sending module is specifically configured to send the recorded video frame to the hardware abstraction layer through the manufacturer's camera service framework when the number of the buffers is greater than or equal to the first number and the manufacturer's camera service framework receives a notification corresponding to the callback function; The callback function is executed by the hardware abstraction layer and is used to notify the manufacturer's camera service framework to send a recorded video frame function.
10. The device according to any one of claims 6 to 9, characterized in that The device also includes a receiving module and a processing module; The sending module is specifically configured to send at least two video frames and first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework, where the first information includes at least one of a timestamp and a request identifier; The receiving module is used to receive the video frames sent by the manufacturer's camera service framework and the first information corresponding to each video frame through the chip in the hardware abstraction layer after the sending module sends at least two video frames and the first information corresponding to each video frame to the hardware abstraction layer through the manufacturer's camera service framework; The processing module is used to determine the lost video frame among the at least two video frames based on the first information corresponding to each video frame through the chip; and process the received video frame through the chip, and send the processed video frame to the manufacturer's camera service framework, wherein the lost video frame among the at least two video frames is sent to the manufacturer's camera service framework in an erroneous form.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the video recording method according to any one of claims 1 to 5 are implemented.
12. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the video recording method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Image processing system and method, electronic equipment, readable storage medium and chip
CN116957906A
Frequency modulation method and related device
CN118450239A
Image processing method, electronic equipment and computer readable storage medium
CN118646948A
Car multimedia system and method for scanning metadata using the system
KR1020130131152A
Video decoder error handling
US20090213938A1
