CN111897603B - Data distribution method, device, electronic equipment and storage medium - Google Patents
Data distribution method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111897603B CN111897603B CN202010715298.XA CN202010715298A CN111897603B CN 111897603 B CN111897603 B CN 111897603B CN 202010715298 A CN202010715298 A CN 202010715298A CN 111897603 B CN111897603 B CN 111897603B
- Authority
- CN
- China
- Prior art keywords
- multimedia
- multimedia component
- data
- application processes
- application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 261
- 230000008569 process Effects 0.000 claims abstract description 201
- 239000000872 buffer Substances 0.000 claims description 110
- 230000006870 function Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 13
- 238000010586 diagram Methods 0.000 description 11
- 230000000694 effects Effects 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003139 buffering effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Telephone Function (AREA)
Abstract
The application provides a data distribution method, a device, electronic equipment and a storage medium, wherein after receiving a calling instruction for a multimedia component, a processor of the electronic equipment determines whether the multimedia component is called by other application processes; and if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through a native layer of the local framework, and distributing the multimedia data to each application process through the native layer. By adopting the method, each application process can acquire the multimedia data acquired by the same multimedia component, so that a plurality of application processes can be performed simultaneously, the scheduling stability of the application processes in the electronic equipment is improved, and the user experience is improved.
Description
Technical Field
The present disclosure relates to the field of electronic devices, and in particular, to a data distribution method, apparatus, electronic device, and storage medium.
Background
With the development of terminal technology, many application processes in the terminal need to call camera data. However, due to technical limitations of driving and hardware, a single camera can only be opened by one application process at present, and when other processes need to call camera data, the camera cannot be opened again, and only after the previous application process exits, the camera can be used.
In general, the application process may be a Java layer application process or a native layer application process. Aiming at the application process of the Java layer, in order to avoid the situation that the camera can only be opened by one application process, the terminal equipment generally adopts the Java interfaces of all the application processes of the Java layer to package, so that all the Java layer application processes after interface packaging can not directly call the camera, meanwhile, the terminal equipment can cache the camera data acquired by the camera and transmit the camera data to all the Java layer application processes in a distributed mode through the packaged Java interfaces, and therefore all the Java layer application processes can acquire the camera data without directly opening the camera.
However, in some application scenarios where the java interface cannot be encapsulated, the method cannot meet the camera call requirements of certain application processes, so that the application functions of the terminal are limited.
Disclosure of Invention
The embodiment of the application provides a data distribution method, a data distribution device, electronic equipment and a storage medium, wherein a plurality of application processes can obtain multimedia data at the same time.
A data distribution method, comprising:
after receiving a call instruction to the multimedia component, determining whether the multimedia component has been called by other application processes;
if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through the native layer of the local frame, and distributing the multimedia data to each application process through the native layer.
A data distribution apparatus comprising:
the determining module is used for determining whether the multimedia component is called by other application processes after receiving a calling instruction of the multimedia component;
and the distribution module is used for acquiring the multimedia data acquired by the multimedia component through the native layer of the local frame when the multimedia component is called, and distributing the multimedia data to each application process through the native layer.
An electronic device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of:
after receiving a call instruction to the multimedia component, determining whether the multimedia component has been called by other application processes;
if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through the native layer of the local frame, and distributing the multimedia data to each application process through the native layer.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
after receiving a call instruction to the multimedia component, determining whether the multimedia component has been called by other application processes;
if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through the native layer of the local frame, and distributing the multimedia data to each application process through the native layer.
The data distribution method, the device, the electronic equipment and the storage medium, wherein after receiving a calling instruction for the multimedia component, a processor of the electronic equipment determines whether the multimedia component is called by other application processes; if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through a native layer of a local frame of the electronic device, and distributing the multimedia data to each application process through the native layer. After receiving the calling instruction of the multimedia component, the processor firstly determines whether the multimedia component is called by other application processes, so that the situation that the multimedia component is opened again under the condition that the multimedia component is called by other application processes, and system error reporting is caused can be avoided; further, the processor obtains multimedia data collected by the multimedia component through the native layer of the local framework, and distributes the multimedia data to each application process through the native layer, and the native layer is positioned at the bottom layer of the java layer, so that the distributed multimedia data can be obtained no matter the java layer or the native layer is used for calling the application process of the data, and the interfaces of the application processes are not required to be packaged, thereby improving the scheduling stability of the application processes in the electronic equipment and improving the user experience.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is an application environment diagram of a data distribution method in one embodiment;
FIG. 2 is a flow chart of a method of data distribution in one embodiment;
FIG. 3 is a flow chart of a method of data distribution in another embodiment;
FIG. 4 is a flow chart of a method of data distribution in another embodiment;
FIG. 5 is a flow chart of a method of data distribution in another embodiment;
FIG. 6 is a flow chart of a method of data distribution in another embodiment;
FIG. 7 is a flow chart of a method of data distribution in another embodiment;
FIG. 8 is a block diagram of a data distribution device in one embodiment;
FIG. 9 is a block diagram showing the structure of a data distribution apparatus according to another embodiment;
FIG. 10 is a block diagram showing the structure of a data distribution apparatus according to another embodiment;
FIG. 11 is a block diagram showing the structure of a data distribution apparatus according to another embodiment;
FIG. 12 is a block diagram showing the structure of a data distribution apparatus according to another embodiment;
FIG. 13 is a block diagram showing the structure of a data distribution device according to another embodiment;
fig. 14 is a block diagram of an electronic device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Fig. 1 is a schematic view of an application environment of a data distribution method in one embodiment. As shown in fig. 1, the application environment includes an electronic device 100; the electronic device 100 may be a wireless terminal, which may be a device that provides voice and/or other business data connectivity to a user, a handheld device with wireless connectivity, or other processing device connected to a wireless modem. The wireless terminal may be a mobile terminal such as a cellular phone and a computer having a mobile terminal, for example, may be portable, pocket-sized, hand-held, a mobile device built in or on-board the computer, etc. The electronic device includes a processor 110 and a multimedia component 120, where the multimedia component may be a camera, or may be an audio component, and the electronic device may include one or more cameras; the camera can be a front camera or a rear camera. The processor 110 is connected to the multimedia component 120 for enabling distribution of multimedia data collected by the multimedia component 120.
Fig. 2 is a flow chart of a data distribution method in one embodiment. The data distribution method in this embodiment will be described by taking a processor running in fig. 1 as an example. As shown in fig. 2, the data distribution method includes:
s101, after receiving a calling instruction of the multimedia component, determining whether the multimedia component is called by other application processes.
The multimedia component may be a camera in the electronic device or an audio component in the electronic device, and the type of the multimedia component is not limited herein. The electronic device may be a mobile phone terminal, a tablet computer, an AR device, a telephone watch, or the like, and the type of the electronic device is not limited herein.
The application process may be an application process for calling multimedia data from a java layer in the electronic device, for example, mobile phone software in a mobile phone terminal, or an application process for calling multimedia data from a native layer in the electronic device, which is not limited herein. For example, the application process may refer to a program running in the electronic device, a photographing program, an image capturing program, a synchronous positioning map (simultaneous localization and mapping, abbreviated as SLAM) in the AR device, a plane detection algorithm, and other programs, and the type of the application process is not limited herein. In the running process of the application process, multimedia data collected in the multimedia component may need to be called, for example, a photographing program needs to call image data collected by a camera. Because of the limitations of a driver and hardware equipment, when a plurality of application processes need to call the multimedia component at the same time, the multimedia component can only be opened by one application process; if the multimedia component is opened simultaneously in a plurality of application processes, the electronic device will report error information.
When the application process calls the multimedia component, a calling instruction for the multimedia component can be sent to a processor of the electronic device, and the calling instruction can comprise a calling data format or can comprise parameter configuration of the multimedia component, such as corresponding image size when a camera is called; the call instruction may further include an application process identification number (Process Identity Document, abbreviated as PID), and the content of the call instruction is not limited herein.
The processor, upon receiving the above-described call instruction, may first determine whether the multimedia component has been called by another application process. Specifically, the processor may identify, according to the identification field of the call instruction, whether the call instruction is received within a preset duration, so as to determine whether the multimedia component has been called by other application processes; alternatively, the processor may determine whether the multimedia component is invoked by other application processes based on the current state of the multimedia component, e.g., when the multimedia component is a camera, if the camera has been turned on, the processor may determine that the camera has been invoked by other application processes; the determination method is not limited herein.
S102, if the multimedia component is called, acquiring multimedia data acquired by the multimedia component through a native layer of the local framework, and distributing the multimedia data to each application process through the native layer.
On the basis of the steps, if the multimedia component is called by other application processes, the processor does not need to open the multimedia component again at this time, and the multimedia data collected by the multimedia component can be obtained through the native layer of the local frame. The native layer is a bottom layer in the electronic device system and can be connected with each application process in a cross-process manner. For example, the electronic device may include an interface program, where the interface program is configured to perform interface conversion processing on each application process, so that each application process after conversion may be connected with the native layer in a cross-process manner. In addition, the active layer can be connected with the multimedia component to directly acquire the multimedia data acquired by the multimedia component.
After the native layer acquires the multimedia data acquired by the multimedia component, the multimedia data can be distributed to each application process needing to schedule the multimedia component.
Wherein, the multimedia data is data collected by a multimedia component, and when the multimedia component is an audio component, the multimedia data can be audio data; when the multimedia component is a camera, the multimedia data may be image data or video data; the type of the multimedia data is not limited herein.
Specifically, when the processor distributes the multimedia data to each application process, the processor may transmit the multimedia data to each application process, or may compress the multimedia data and then transmit the compressed multimedia data to each application process, which is not limited herein.
According to the data distribution method, after the processor of the electronic equipment receives the calling instruction of the multimedia component, whether the multimedia component is called by other application processes or not is determined; if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through a native layer of a local frame of the electronic device, and distributing the multimedia data to each application process through the native layer. After receiving the calling instruction of the multimedia component, the processor firstly determines whether the multimedia component is called by other application processes, so that the situation that the multimedia component is opened again under the condition that the multimedia component is called by other application processes, and system error reporting is caused can be avoided; further, the processor obtains multimedia data collected by the multimedia component through the native layer of the local framework, distributes the multimedia data to each application process through the native layer, and can obtain the distributed multimedia data no matter through the java layer or the application process of calling the data through the native layer, and does not need to package an interface of the application process, so that the scheduling stability of the application process in the electronic device is improved, and the user experience is improved.
Fig. 3 is a flowchart of a data distribution method in another embodiment, where the embodiment relates to a manner in which the processor distributes multimedia data, and on the basis of the above embodiment, as shown in fig. 3, the step S102 includes:
and S201, writing the multimedia data in the kernel layer in the multimedia component into a first cache area in the active layer.
The first buffer area is used for buffering the multimedia data collected by the multimedia component, and after the multimedia component is opened, the processor can write the multimedia data into the first buffer area in the active layer. The first buffer area may include 1 buffer or a plurality of buffers, which is not limited herein.
S202, configuring a corresponding second cache area for each application process according to the number of application processes calling the multimedia component.
Further, the processor may configure a second buffer area for each application process according to the number of application processes of the multimedia component. The second buffer areas are in one-to-one correspondence with the application processes, and multimedia data can be transmitted to each application process through an application process interface. For example, after receiving the current call instruction, the processor determines that the multimedia component has been called by other 3 application processes, and may configure a new second cache area for the application process corresponding to the call instruction. At this time, the processor may distribute the multimedia data to four application processes through the configured four second buffer areas.
When the processor configures the second cache area for each application process, the sizes of the second cache areas corresponding to different application processes may be the same or different, which is not limited herein.
And S203, distributing the multimedia data in the first buffer area to a second buffer area corresponding to each application process.
On the basis of the steps, the processor can distribute the multimedia data written in the first buffer area to the second buffer areas corresponding to each application process, so that each second buffer area has the multimedia data, and each application process can obtain the multimedia data to complete corresponding operation.
The processor may complete the steps of writing the multimedia data into the first buffer area and distributing the multimedia data in the first buffer area to the second buffer area corresponding to each application process by setting a thread, that is, the processor may write the multimedia data into the first buffer area, and after distributing the multimedia data in the first buffer area to the second buffer area corresponding to each application process, write the multimedia data collected by the multimedia component into the first buffer area again. Alternatively, the processor may complete the above operation through two asynchronous threads, and may write the multimedia data into the first buffer area corresponding to the first thread, and distribute the multimedia data in the first buffer area to the corresponding second thread in the second buffer area corresponding to each application process, where the first thread and the second thread are different. The writing and distributing operations of the multimedia data are completed through two different threads, so that the multimedia data can be written into the first buffer area and the step of distributing the multimedia data to the second buffer area can be performed simultaneously, the transmission frame rate of the multimedia data is ensured, and each application process can obtain the multimedia data more timely.
According to the data distribution method, the processor writes the multimedia data into the first cache area, and then distributes the data in the first cache area to the second cache area corresponding to each application process, so that after the multimedia component is called, the newly added application process can smoothly obtain the multimedia data through the first cache area, and the distribution reliability of the multimedia data is ensured.
Fig. 4 is a flowchart of a data distribution method in another embodiment, where the process of writing multimedia data into the first buffer area by the processor is referred to as S201, which includes:
s301, according to a queue formed by a plurality of buffers, the multimedia data is written into the plurality of buffers.
The first buffer area may include a plurality of buffers; the plurality of buffers may be sequentially arranged into a queue, and the processor may sequentially write the multimedia data into the plurality of buffers. The number of buffers may be a predetermined number, may be 4 or 6, and is not limited herein. The buffer space of the plurality of buffers may be the same or different.
For example, the first buffer area includes 4 buffers, which are bufferA, bufferB, bufferC and bufferD in sequence, and the four buffers sequentially obtain multimedia data from Kernel layers of the multimedia component.
S302, after filling the multimedia data into any buffer, marking the buffer as a filled data state.
In the first buffer area, after any buffer completes the filling of the multimedia data, the buffer may be marked as a filled data state. The filled data state characterizes that the buffer contains multimedia data, and the data can not be written into the buffer any more, so that the written multimedia data in the buffer can be prevented from being covered.
Further, after the buffer is filled with the multimedia data, the multimedia data is sequentially written into the second buffer area according to the sequence of the queue. The processor may write the multimedia data in the buffer into the plurality of second buffer areas simultaneously. After the multimedia data of the buffer is written into the second buffer area, the processor may mark the buffer as an unfilled data state, and perform the multimedia data filling on the buffer again. Wherein the filled data state and the unfilled data state can be marked by different symbols, and the symbols can be letters or numbers. For example, a filled data state may be marked as "1" and an unfilled data state may be marked as "0".
Taking the 4 buffers as an example, after the processor completes data filling of the buffer A, sequentially filling data of the rest buffers; if the current application process for calling the multimedia component is 3, the processor can write the multimedia data in the bufferA into 3 second buffer areas; after the data in the bufferA is written into each second buffer area, the bufferA dequeues, the processor marks the bufferA as an unfilled data state, and returns to acquire the multimedia data from the Kenel layer of the multimedia component.
According to the data distribution method, the processor writes the multimedia data acquired by the multimedia component through the plurality of buffers, so that the actions of writing the multimedia data into the first buffer area and distributing the multimedia data in the first buffer area to the second buffer area can be completed simultaneously, and the transmission frame rate of the multimedia data is ensured. For the case that the first buffer area includes a buffer, after the buffer needs to distribute the multimedia data to the second buffer area, the multimedia data collected again by the multimedia component can be obtained continuously, which is easy to cause data loss. By adopting the method, the integrity of the multimedia data can be improved.
The processor may determine whether the multimedia component has been invoked based on the number of application processes currently invoking the multimedia component. The processor may directly query whether the number of application processes currently calling the multimedia component is 0 after receiving the call instruction for the multimedia component, or may adjust the number of application processes calling the multimedia component after receiving the call instruction, and then determine whether the multimedia component is called, as shown in the following embodiment.
Fig. 5 is a flowchart of a data distribution method in another embodiment, where the process of determining whether a multimedia component is called by another application process by a processor is referred to as S101, where the step S101 includes:
s401, after receiving a call instruction to the multimedia component, adding 1 to the number of application processes currently calling the multimedia component to obtain the adjusted number of application processes.
Specifically, after receiving a call instruction of the multimedia component, the processor may register an application process corresponding to the call instruction, for example, write a PID of the application process into a registry for calling the multimedia component. Further, the processor may add 1 to the number of application processes currently calling the multimedia component, resulting in an adjusted number of application processes.
And S402, if the number of the adjusted application processes is greater than 1, determining that the multimedia component is called by other application processes.
Based on the above steps, the processor may determine whether the multimedia component has been invoked according to the adjusted number of application processes. If the number of the adjusted application processes is greater than 1, determining that the multimedia component has been called by other application processes.
Further, if the number of the adjusted application processes is equal to 1, the processor may determine that the multimedia component is not called by other application processes, and may perform step S403.
S403, if the number of the adjusted application processes is equal to 1, starting a multimedia data acquisition function of the multimedia component.
If the number of the adjusted application processes is equal to 1, the processor can start the multimedia data acquisition function of the multimedia component according to the requirement of the calling instruction. The multimedia data collection function of the multimedia component may include opening the multimedia component, and may further include initializing parameters of the multimedia component and creating a thread for collecting multimedia data of the multimedia component. For example, in the case where the above multimedia component is a camera, the processor may open the camera after determining that the number of adjusted application processes is equal to 1, and initialize parameters of the camera, such as an image size, an acquisition mode, and the like, according to an instruction in the call instruction.
After the processor starts the multimedia data acquisition function of the multimedia component, the processor can continue to write the multimedia data into the first cache area and configure a corresponding second cache area for the application process; and then writing the multimedia data in the first buffer area into a second buffer area corresponding to the application process.
According to the data distribution method, after receiving the calling instruction, the processor adjusts the number of application processes for calling the multimedia component currently, so that the number of application processes for calling the multimedia component currently can be obtained more accurately in real time to determine whether the multimedia component is called; therefore, whether the service function of the multimedia component is started is further determined according to the calling state of the multimedia component, system errors caused by the fact that a plurality of application processes simultaneously start the service function of the multimedia component are avoided, and the running reliability of the electronic equipment is improved.
Fig. 6 is a flowchart of a data distribution method in another embodiment, where the embodiment relates to a manner in which a processor turns off a multimedia component, and on the basis of the above embodiment, as shown in fig. 6, the method further includes:
s501, after receiving a stop call instruction to the multimedia component, acquiring the number of application processes currently calling the multimedia component.
S502, determining whether to close the multimedia component according to the number of application processes.
The stop call instruction refers to stopping the application process, and does not need to call the multimedia data of the multimedia component continuously. The stop call instruction may be an operation instruction for closing the multimedia component in the application process. For example, the multimedia component is a camera in the mobile phone, when the user triggers the operation of exiting photographing, the corresponding application process of photographing is about to stop, and the processor can receive a stop call instruction of the application process to the camera.
After receiving the instruction for stopping the calling, the processor does not directly execute the operation for closing the multimedia component, but obtains the number of application processes currently calling the multimedia component, so as to determine whether to close the multimedia component according to the number. Specifically, the processor may directly read the value of the counted number of application processes, or may determine the number of application processes according to the PID number in the registry of the application processes, which is not limited herein.
The number of application processes currently calling the multimedia component may be an application process corresponding to the stop call instruction, for example, after the processor receives the stop call instruction, the number of application processes calling the multimedia component is directly adjusted, and the number of application processes is reduced by 1.
In another embodiment, since the processor does not execute the response operation on the stop call instruction, the number of application processes may further include an application process corresponding to the stop call instruction; the processor may compare the number of application processes to 1 when determining whether to shut down the multimedia component based on the number of application processes. Optionally, if the number of application processes is 1, the multimedia data acquisition function of the multimedia component is turned off. The number of the application processes is 1, which can indicate that the application process of the multimedia component is currently called, that is, the application process corresponding to the instruction for stopping calling, and the processor can close the multimedia component.
Further, if the number of application processes is greater than 1, the number of application processes currently calling the multimedia component is reduced by 1. Under the condition that the number of the application processes is greater than 1, the fact that more than one application process calls the multimedia component currently is indicated, the processor cannot take the operation of closing the multimedia component, and the situation that other application processes cannot continuously acquire the multimedia data is avoided, so that functions are limited is avoided.
According to the data distribution method, after receiving the instruction for stopping calling the multimedia component, the processor determines whether to close the multimedia component according to the number of application processes for calling the multimedia component at present, so that other application processes for calling the multimedia component can continuously obtain the multimedia data, and smooth progress of a plurality of application processes for calling the multimedia component at the same time is ensured.
In one embodiment, a data distribution method is provided, and on the basis of the above embodiment, as shown in fig. 7, the method includes:
s601, receiving a calling instruction of the multimedia component.
S602, adding 1 to the number of application processes currently calling the multimedia component to obtain the adjusted number of application processes.
S603, determining whether the number of the adjusted application processes is larger than 1; if yes, S605 is executed, and if not, S604 is executed.
S604, starting the multimedia data acquisition function of the multimedia component, and continuing to execute S605.
And S605, writing the multimedia data in the kernel layer in the multimedia component into a first cache area in the active layer.
S606, configuring a corresponding second cache area for each application process according to the number of application processes calling the multimedia component.
S607, distributing the multimedia data in the first buffer area to the second buffer area corresponding to each application process.
The method further comprises the following steps:
s608, receiving a stop call instruction for the multimedia component.
S609, the number of application processes currently calling the multimedia component is obtained.
S610, determining whether the number of application processes is 1, if so, executing S611, and if not, executing S612.
S611, closing the multimedia component.
S612, the number of application processes currently calling the multimedia component is reduced by 1.
The data distribution method is similar to the above embodiment in terms of its implementation principle and technical effects, and will not be described here again.
It should be understood that, although the steps in the flowcharts of fig. 2-7 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2-7 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily occur in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
Fig. 8 is a block diagram showing the structure of a data distribution apparatus according to an embodiment. As shown in fig. 8, the above-mentioned apparatus includes:
a determining module 10, configured to determine, after receiving a call instruction for the multimedia component, whether the multimedia component has been called by another application process;
and the distribution module 20 is configured to obtain, when the multimedia component has been invoked, multimedia data collected by the multimedia component through the native layer of the local framework, and distribute the multimedia data to each application process through the native layer.
In one embodiment, on the basis of the above embodiment, as shown in fig. 9, the above distribution module 20 includes:
a writing unit 201, configured to write multimedia data in a kernel layer of the multimedia component into a first cache area in a native layer;
a configuration unit 202, configured to configure a corresponding second buffer area for each application process according to the number of application processes that call the multimedia component;
and the distributing unit 203 is configured to distribute the multimedia data in the first buffer area to a second buffer area corresponding to each application process.
In one embodiment, on the basis of the above embodiment, as shown in fig. 10, the above writing unit 201 includes:
a writing subunit 2011, configured to write the multimedia data into a plurality of buffers according to a queue formed by the plurality of buffers;
and a marking subunit 2012, configured to mark the buffer as a filled data state after completing the filling of the multimedia data for any buffer.
In an embodiment, based on the foregoing embodiment, the writing subunit 2011 is further configured to sequentially write the multimedia data to the second buffer area in the order of the queue after completing the filling of the buffer with the multimedia data.
In one embodiment, on the basis of the above embodiment, the marking subunit 2012 is further configured to: after the multimedia data of the buffer is written into the second buffer area, marking the buffer as an unfilled data state, and filling the buffer with the multimedia data again.
In one embodiment, on the basis of the above embodiment, as shown in fig. 11, the above determining module 10 includes:
an adjusting unit 101, configured to add 1 to the number of application processes currently calling the multimedia component after receiving a call instruction to the multimedia component, to obtain an adjusted number of application processes;
and the determining unit 102 is configured to determine that the multimedia component has been called by another application process when the adjusted number of application processes is greater than 1.
In one embodiment, on the basis of the foregoing embodiment, as shown in fig. 12, the foregoing apparatus further includes an opening module 30, configured to: and when the number of the adjusted application processes is equal to 1, starting a multimedia data acquisition function of the multimedia component.
In one embodiment, on the basis of the above embodiment, as shown in fig. 13, the apparatus further includes a closing module 40, configured to: after receiving a stop call instruction for the multimedia component, acquiring the number of application processes currently calling the multimedia component; whether to shut down the multimedia component is determined based on the number of application processes.
In one embodiment, on the basis of the above embodiment, the closing module 40 is specifically configured to: and when the number of the application processes is 1, closing the multimedia data acquisition function of the multimedia component.
In one embodiment, on the basis of the above embodiment, the closing module 40 is further configured to: when the number of application processes is greater than 1, the number of application processes currently calling the multimedia component is reduced by 1.
In one embodiment, on the basis of the foregoing embodiment, the multimedia data is written into the first buffer area corresponding to the first thread, the multimedia data in the first buffer area is distributed to the corresponding second thread in the second buffer area corresponding to each application process, and the first thread and the second thread are different.
The data distribution device provided in this embodiment has similar implementation principles and technical effects to those of the above method embodiments, and will not be described herein.
The division of the modules in the data distribution device is merely for illustration, and in other embodiments, the data distribution device may be divided into different modules as needed to perform all or part of the functions of the data distribution device.
The specific limitation of the data distribution apparatus may be referred to as limitation of the data distribution method hereinabove, and will not be described herein. Each of the modules in the data distribution apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
Fig. 14 is a schematic diagram of an internal structure of an electronic device in one embodiment. As shown in fig. 14, the electronic device includes a processor and a memory connected through a system bus. Wherein the processor is configured to provide computing and control capabilities to support operation of the entire electronic device. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program is executable by a processor for implementing a data distribution method provided by the following embodiments. The internal memory provides a cached operating environment for operating system computer programs in the non-volatile storage medium. The electronic device may be any electronic device such as a mobile phone, a tablet computer, a PDA (Personal Digital Assistant ), a POS (Point of Sales), a car-mounted computer, and a wearable device.
It will be appreciated by those skilled in the art that the structure shown in fig. 14 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the electronic device to which the present application is applied, and that a particular electronic device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
The implementation of each module in the data distribution apparatus provided in the embodiments of the present application may be in the form of a computer program. The computer program may be run on an electronic device. Program modules of the computer program may be stored in the memory of the electronic device. The computer program, when executed by a processor, implements the steps of the data distribution method described in the embodiments of the present application: comprising the following steps:
after receiving a call instruction to the multimedia component, determining whether the multimedia component has been called by other application processes;
if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through the native layer of the local frame, and distributing the multimedia data to each application process through the native layer.
The implementation principle and technical effects of the electronic device provided in this embodiment are similar to those of the foregoing method embodiment, and are not described herein again.
Embodiments of the present application also provide a computer-readable storage medium. One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform steps of a data distribution method comprising:
after receiving a call instruction to the multimedia component, determining whether the multimedia component has been called by other application processes;
if the multimedia component is called, acquiring the multimedia data acquired by the multimedia component through the native layer of the local frame, and distributing the multimedia data to each application process through the native layer.
The computer readable storage unit provided in this embodiment has similar implementation principles and technical effects to those of the above method embodiment, and will not be described herein.
A computer program product containing instructions that, when run on a computer, cause the computer to perform a data distribution method.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.
Claims (12)
1. A data distribution method, comprising:
after receiving a call instruction to a multimedia component, determining whether the multimedia component has been called by other application processes;
if the multimedia component is called, according to a queue formed by a plurality of buffer buffers included in a first buffer area in a native frame native layer, writing the multimedia data in a kernel layer in the multimedia component into the plurality of buffers, marking the buffers as filled data states after filling any buffer with the multimedia data, configuring a corresponding second buffer area for each application process according to the number of application processes calling the multimedia component, and distributing the multimedia data in the first buffer area to the second buffer area corresponding to each application process.
2. The method according to claim 1, wherein the method further comprises:
and after the buffer is filled with the multimedia data, the multimedia data are sequentially written into the second buffer area according to the sequence of the queue.
3. The method according to claim 2, wherein the method further comprises:
and after the multimedia data of the buffer is written into the second buffer area, marking the buffer as an unfilled data state, and filling the multimedia data of the buffer again.
4. The method of claim 1, wherein the determining whether the multimedia component has been invoked by another application process after receiving the invocation instruction for the multimedia component comprises:
after receiving a calling instruction for the multimedia component, adding 1 to the number of application processes for calling the multimedia component currently to obtain the adjusted number of application processes;
and if the number of the adjusted application processes is greater than 1, determining that the multimedia component is called by other application processes.
5. The method according to claim 4, wherein the method further comprises:
and if the number of the adjusted application processes is equal to 1, starting a multimedia data acquisition function of the multimedia component.
6. The method according to any one of claims 1-5, further comprising:
after receiving a stop call instruction to the multimedia component, acquiring the number of application processes currently calling the multimedia component;
and determining whether to close the multimedia component according to the number of the application processes.
7. The method of claim 6, wherein determining whether to shutdown the multimedia component based on the number of application processes comprises:
and if the number of the application processes is 1, closing the multimedia component.
8. The method of claim 6, wherein determining whether to shutdown the multimedia component based on the number of application processes further comprises:
if the number of application processes is greater than 1, the number of application processes currently calling the multimedia component is reduced by 1.
9. The method of claim 1, wherein the writing of the multimedia data into a first cache region corresponds to a first thread, and the distributing of the multimedia data in the first cache region to a second cache region corresponding to each application process corresponds to a second thread, the first thread and the second thread being different.
10. A data distribution apparatus, comprising:
the determining module is used for determining whether the multimedia component is called by other application processes after receiving a calling instruction of the multimedia component;
and the distribution module is used for writing the multimedia data in the kernel layer in the multimedia component into a plurality of buffers according to a queue formed by the buffers included in the first buffer area in the native layer of the local frame when the multimedia component is called, marking the buffers as filled data states after filling any buffer with the multimedia data, configuring a corresponding second buffer area for each application process according to the number of application processes calling the multimedia component, and distributing the multimedia data in the first buffer area to the second buffer area corresponding to each application process.
11. An electronic device comprising a memory and a processor, the memory having stored therein a computer program which, when executed by the processor, causes the processor to perform the steps of the data distribution method according to any of claims 1 to 9.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010715298.XA CN111897603B (en) | 2020-07-23 | 2020-07-23 | Data distribution method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010715298.XA CN111897603B (en) | 2020-07-23 | 2020-07-23 | Data distribution method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111897603A CN111897603A (en) | 2020-11-06 |
CN111897603B true CN111897603B (en) | 2024-02-09 |
Family
ID=73189792
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010715298.XA Active CN111897603B (en) | 2020-07-23 | 2020-07-23 | Data distribution method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111897603B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101833520A (en) * | 2009-03-11 | 2010-09-15 | 凹凸电子(武汉)有限公司 | Method for simultaneously utilizing one camera by computer system and a plurality of application programs |
US8588111B1 (en) * | 2012-09-15 | 2013-11-19 | Zoom International S.R.O. | System and method for passive communication recording |
CN106101525A (en) * | 2016-05-31 | 2016-11-09 | 北京奇虎科技有限公司 | Application call dual camera carries out the method and device shot |
CN106792124A (en) * | 2016-12-30 | 2017-05-31 | 合网络技术(北京)有限公司 | Multimedia resource decodes player method and device |
CN108235120A (en) * | 2018-03-23 | 2018-06-29 | 北京潘达互娱科技有限公司 | Live video stream method for pushing, device and electronic equipment |
CN109218630A (en) * | 2017-07-06 | 2019-01-15 | 腾讯科技(深圳)有限公司 | A kind of method for processing multimedia information and device, terminal, storage medium |
CN109862415A (en) * | 2018-11-26 | 2019-06-07 | 努比亚技术有限公司 | A kind of record screen method, double screen terminal and computer readable storage medium |
CN110704201A (en) * | 2018-07-10 | 2020-01-17 | 深圳市优必选科技有限公司 | Multimedia data sharing method and terminal equipment |
CN110704202A (en) * | 2018-07-10 | 2020-01-17 | 深圳市优必选科技有限公司 | Multimedia recording data sharing method and terminal equipment |
CN110753187A (en) * | 2019-10-31 | 2020-02-04 | 芋头科技(杭州)有限公司 | Camera control method and device |
-
2020
- 2020-07-23 CN CN202010715298.XA patent/CN111897603B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101833520A (en) * | 2009-03-11 | 2010-09-15 | 凹凸电子(武汉)有限公司 | Method for simultaneously utilizing one camera by computer system and a plurality of application programs |
US8588111B1 (en) * | 2012-09-15 | 2013-11-19 | Zoom International S.R.O. | System and method for passive communication recording |
CN106101525A (en) * | 2016-05-31 | 2016-11-09 | 北京奇虎科技有限公司 | Application call dual camera carries out the method and device shot |
CN106792124A (en) * | 2016-12-30 | 2017-05-31 | 合网络技术(北京)有限公司 | Multimedia resource decodes player method and device |
CN109218630A (en) * | 2017-07-06 | 2019-01-15 | 腾讯科技(深圳)有限公司 | A kind of method for processing multimedia information and device, terminal, storage medium |
CN108235120A (en) * | 2018-03-23 | 2018-06-29 | 北京潘达互娱科技有限公司 | Live video stream method for pushing, device and electronic equipment |
CN110704201A (en) * | 2018-07-10 | 2020-01-17 | 深圳市优必选科技有限公司 | Multimedia data sharing method and terminal equipment |
CN110704202A (en) * | 2018-07-10 | 2020-01-17 | 深圳市优必选科技有限公司 | Multimedia recording data sharing method and terminal equipment |
CN109862415A (en) * | 2018-11-26 | 2019-06-07 | 努比亚技术有限公司 | A kind of record screen method, double screen terminal and computer readable storage medium |
CN110753187A (en) * | 2019-10-31 | 2020-02-04 | 芋头科技(杭州)有限公司 | Camera control method and device |
Non-Patent Citations (3)
Title |
---|
Online distribution and interaction of video data in social multimedia network;Xiangyang Ji 等;《Multimedia Tools and Applications 》;12941–12954 * |
基于Hadoop的分布式存储与数据分发策略研究;陈泰龙;《中国优秀硕士学位论文全文数据库 信息科技辑》(第1期);I137-15 * |
基于数据分发服务的多学科流程分布式调度研究;宋健;《中国优秀硕士学位论文全文数据库 信息科技辑》(第3期);I138-975 * |
Also Published As
Publication number | Publication date |
---|---|
CN111897603A (en) | 2020-11-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2018443233B2 (en) | Wireless charging method and electronic device | |
WO2018161812A1 (en) | User interface rendering method and device | |
US11853767B2 (en) | Inter-core data processing method, system on chip and electronic device | |
US11281388B2 (en) | Method for managing a multi-system shared memory, electronic device and non-volatile computer-readable storage medium | |
WO2009133675A1 (en) | Display control device and display control method | |
CN105893161A (en) | Method and apparatus for calling resource in software program | |
CN111459541A (en) | Application program packaging method and device, computer equipment and storage medium | |
CN113992854A (en) | Image preview method and device, electronic equipment and computer readable storage medium | |
CN111897603B (en) | Data distribution method, device, electronic equipment and storage medium | |
EP2538321A1 (en) | Program executing apparatus, image processing apparatus and program | |
KR20080101636A (en) | System and method for bridging file systems between two different processors in mobile phone | |
CN106959906A (en) | Information processing method, information processor and electronic equipment | |
CN109902257B (en) | Resource access method, device, computer equipment and storage medium | |
CN113885795B (en) | Data storage method, device, terminal equipment and storage medium | |
CN113784075B (en) | Screen video reading method, system and computing device | |
CN110968471A (en) | Program crash problem reporting method, storage medium, electronic device and system | |
CN110377272B (en) | Method and device for realizing SDK based on TBOX | |
CN113840091B (en) | Image processing method, apparatus, electronic device, and computer-readable storage medium | |
CN115437551A (en) | Data cloning method, device, storage medium and computer program product | |
CN113076049A (en) | Point reading control method, system and equipment | |
CN111104327A (en) | Solid state disk control software testing method, device and system and computer equipment | |
US20230266879A1 (en) | System, method and computer-readable storage medium for direct memory accesses | |
CN113473003B (en) | Image display method and apparatus | |
WO2022206645A1 (en) | Method and apparatus for scrolling to capture screenshot | |
US20240069845A1 (en) | Focus synchronization method and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |