Data calling method and device, equipment, storage medium and product
By using data interaction channels to communicate between the data calling process and the data collection process during program development, the problem of low development efficiency caused by code integration is solved, and efficient data interaction and independent process operation are achieved.
Patent Information
- Application Number
- CN202310282557.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2024-09-13
AI Technical Summary
During the program development process, after calling the program content of open source software, the code needs to be recompiled and integrated, resulting in reduced development efficiency and reduced human-computer interaction efficiency.
By running the data calling process in the first application and communicating with the data collection process in the second application, the data interaction channel is used for data interaction, avoiding code integration, and achieving the sending and receiving of target data.
It improves the efficiency of program development, avoids the integration of program content codes of different processes, and ensures that each part of the process runs independently without affecting each other.
Smart Images

Figure CN118642784A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a data calling method, device, equipment, storage medium and product. Background Art
[0002] In the process of program development, in addition to independently compiling program content, it is often necessary to call corresponding program content of other open source software, and integrate the independently compiled program content and the called program content to obtain the target data process for executing the target task.
[0003] In the related art, after calling the program content of other open source software, the program content is usually recompiled and integrated with the independently compiled program content to generate the target program content.
[0004] However, in the related art, the method of integrating the called program content and the independently compiled program content into codes increases the workload of developers, reduces the efficiency of human-computer interaction and also reduces the efficiency of program development. Summary of the invention
[0005] The embodiments of the present application provide a data calling method, device, equipment, storage medium and product, which can improve program development efficiency. The technical solution is as follows.
[0006] In one aspect, a data calling method is provided, the method comprising:
[0007] Run a data calling process in the first application and a data collection process in the second application, wherein the data calling process is used to call the target data collected by the second application, and the data collection process is a process in the second application used to collect data generated during the operation of the terminal, the data calling process is connected to a first interaction interface of a data interaction channel, and the data collection process is connected to a second interaction interface of the data interaction channel;
[0008] Receiving, through the first interactive interface, a data calling request sent by the data calling process;
[0009] Sending the data call request to the data collection process through the second interactive interface, and receiving the target data fed back by the data collection process;
[0010] The first interactive interface sends the target data to the data calling process, and the first application is used to call the target data to implement the target function.
[0011] On the other hand, a data calling device is provided, the device comprising:
[0012] A running module, used to run a data calling process in a first application and a data collection process in a second application, wherein the data calling process is used to call target data collected by the second application, and the data collection process is a process in a plurality of processes in the second application used to collect data generated during the operation of the terminal, wherein the data calling process is connected to a first interaction interface of a data interaction channel, and the data collection process is connected to a second interaction interface of the data interaction channel;
[0013] A receiving module, configured to receive a data calling request sent by the data calling process through the first interactive interface;
[0014] The sending module is used to send the data call request to the data acquisition process through the second interactive interface, and receive the target data fed back by the data acquisition process; the first interactive interface sends the target data to the data calling process, and the first application is used to call the target data to realize the target function.
[0015] In some embodiments, the receiving module includes:
[0016] A calling unit is used to call the write interface of the data interaction channel to receive the data calling request when the data calling process writes the data calling request through the first interaction interface.
[0017] In some embodiments, the sending module is also used to write the data call request into the data interaction channel; send a communication signal to the data acquisition process based on the data interaction channel and the data call request; and send the data call request to the data acquisition process by calling the reading interface of the data interaction channel through the second interaction interface based on the communication signal.
[0018] In some embodiments, the sending module is also used to send a communication connection request to the data acquisition process in response to the data calling process, determine the communication connection relationship between the data calling process and the data acquisition process based on the communication connection request; and generate the data interaction channel based on the communication connection relationship.
[0019] In some embodiments, the sending module is further used to send interface indication information of the second interaction interface to the data acquisition process through the data interaction channel.
[0020] In some embodiments, the apparatus further comprises:
[0021] An acquisition module is used to acquire the second application, which includes program codes corresponding to the multiple processes respectively; and to acquire target program codes corresponding to the data acquisition process from the program codes corresponding to the multiple processes respectively, wherein the target program codes are used to realize independent operation of the data acquisition process.
[0022] In some embodiments, the apparatus further comprises:
[0023] The access module is used to compile the target program code corresponding to the data acquisition process into a static library file to access the data acquisition process, and the static library file is used to isolate the target program code from other program codes.
[0024] In some embodiments, the data acquisition process is further used to perform a serialization operation on the target data to obtain serialized data corresponding to the target data;
[0025] The receiving module is further used to receive the serialized data fed back by the data acquisition process and the data type corresponding to the serialized data; and deserialize the serialized data based on the data type to obtain the target data.
[0026] In some embodiments, the data interaction channel includes n data interaction sub-channels, wherein the i-th data interaction sub-channel corresponds to the i-th first interaction interface and the i-th second interaction interface, wherein n and i are positive integers.
[0027] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement a data calling method as described in any of the above-mentioned embodiments of the present application.
[0028] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement a data calling method as described in any of the above-mentioned embodiments of the present application.
[0029] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data calling method described in any of the above embodiments.
[0030] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0031] When the data calling process in the first application and the data collection process in the second application are running at the same time, the data calling process is connected to the first interactive interface of the data interaction channel, and the data collection process is connected to the second interactive interface of the data interaction channel. The data calling request sent by the data calling process can be received through the first interactive interface, and after the data calling request is sent to the data collection process through the second interactive interface, the target data fed back by the data collection process is received, and then the target function is realized by calling the target data through the first application. That is, after the data calling process and the data collection process are connected to generate a data interaction channel through communication, the reception and sending of the target data are realized according to the interactive interface, which can not only avoid the code integration of the program contents of different processes to improve the development efficiency, but also enable each part of the process to run independently without affecting each other. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0033] Figure 1 It is a schematic diagram of a data acquisition process calling method provided by an exemplary embodiment of the present application;
[0034] Figure 2 It is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;
[0035] Figure 3 is a flow chart of a data calling method provided by an exemplary embodiment of the present application;
[0036] Figure 4 is a flow chart of a data calling method provided by another exemplary embodiment of the present application;
[0037] Figure 5 It is a schematic diagram of the data collection process components provided by an exemplary embodiment of the present application;
[0038] Figure 6 This is a schematic diagram of a cross-process call implemented by Mojo provided by an exemplary embodiment of the present application;
[0039] Figure 7 is a schematic diagram of a data calling method provided by an exemplary embodiment of the present application;
[0040] Figure 8 is a structural block diagram of a data calling device provided by an exemplary embodiment of the present application;
[0041] Fig. 9 is a structural block diagram of a data calling device provided by another exemplary embodiment of the present application;
[0042] Fig.10 It is a schematic diagram of the structure of a server provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0044] First, a brief introduction is given to the terms involved in the embodiments of the present application.
[0045] OBS software: Open Broadcaster Software (OBS) is an open source cross-platform streaming media and recording software developed by the OBS Project, providing real-time source and device capture, scene composition, encoding, recording, and broadcasting.
[0046] GNU General Public License (GPL): is a widely used free software license that gives end users the freedom to run, study, share and modify software. Currently there are three versions: GPLv1, GPLv2, and GPLv3, with different modifications in details.
[0047] Inter-Process Communication (IPC): refers to the technology or method of transmitting data or signals between at least two processes or threads.
[0048] In the related art, OBS software is an open source live broadcast tool, which is generally composed of an interface module, a collection module, and a streaming module. The collection module in OBS software is widely referenced by other applications. The most common and direct solution is to use the interface module independently developed by the target application as the front-end interaction, and then introduce the collection module of OBS software as the back-end support by code integration or static linking or dynamic linking.
[0049] However, direct citation of OBS software is the simplest and most cost-effective technical solution. However, as an open source software, OBS software clearly states in its open source statement that it uses the GPLv2 open source agreement. The GPL agreement states that any secondary development or compilation version of software works that follow the agreement must inherit the agreement, and there are also opinions that static links and dynamic links also violate the GPL agreement. Although the view is still controversial, it must be admitted that the existing technical solutions have great open source risks, and with the increasing number of open source dispute cases in recent years, the risks of the existing solutions far outweigh their practicality.
[0050] For illustration, please refer to Figure 1 , which shows a schematic diagram of a data acquisition process calling method provided by an exemplary embodiment of the present application, such as Figure 1 As shown, the data acquisition process 101 is extracted separately from the program code corresponding to the OBS software, and then connected to the inter-process communication module to be compiled into an executable file, so that the data acquisition process 101 can be used as a callable process. In addition, the first application includes a data calling process 102, and the data calling process 102 is connected to the first interactive interface of the data interaction channel, and the data acquisition process 101 is connected to the second interface of the data interaction channel, so that the data acquisition process 101 and the data calling process 102 can call the data acquisition process 101 through the data interaction channel to obtain the output result of the data acquisition process 101, thereby avoiding code integration of the program codes corresponding to the data calling process and the data acquisition process, thereby improving program development efficiency.
[0051] First, the implementation environment of this application is introduced. Figure 2 , which shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application, such as Figure 2 As shown, the implementation environment includes a terminal 210.
[0052] In the embodiment of the present application, the data collection process is implemented as a process in the OBS software installed in the terminal 210, that is, the data call process is implemented in the terminal. In another feasible case, the data call process can also be implemented in the server, which is not limited.
[0053] The terminal 210 runs a first application 211 and a second application 212, wherein the first application 211 includes a data calling process, and the second application 212 includes a data collection process, wherein the data calling process accesses a first interactive interface of a data interaction channel, and the data collection process accesses a second interactive interface of the data interaction channel. The terminal 210 receives a data calling request sent by the data calling process through the first interactive interface, sends the data calling request to the data collection process through the second interactive interface, and receives target data fed back by the data collection process, wherein the first interactive interface is used to send the target data to the data calling process, so that the first application 211 calls the target data to realize the target function.
[0054] Among them, terminal 210 is at least one of the terminals such as smart phones, tablet computers, portable laptop computers, desktop computers, smart speakers, smart wearable devices, smart voice interaction devices, smart home appliances, and vehicle-mounted terminals, and the server is used to implement command operation scenarios in the fields of smart transportation, vehicle-mounted terminals, and the Internet of Things.
[0055] It is worth noting that the above-mentioned server can be implemented as a cloud server in the cloud, where cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or local area network to achieve data calculation, storage, processing, and sharing.
[0056] In some embodiments, the above server can also be implemented as a node in a blockchain system.
[0057] It is worth noting that the data calling method provided in the embodiment of the present application can be implemented by the terminal 210 alone, by the server alone, or by the terminal 210 and the server in collaboration.
[0058] Among them, when the terminal 210 and the server collaborate to implement the solution provided by the embodiment of the present application, the terminal 210 and the service can be directly or indirectly connected via wired or wireless communication, which is not limited by the embodiment of the present application.
[0059] It should be noted that before collecting relevant data of users and during the process of collecting relevant data of users, this application can display a prompt interface, pop-up window or output voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining relevant data of users after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining relevant data of users are terminated, that is, the relevant data of users are not obtained. In other words, all user data collected by this application are collected with the consent and authorization of the user, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0060] In combination with the above-mentioned noun introduction and implementation environment, the data calling method provided in the embodiment of the present application is described, and the method is completed by executing the server as an example. For schematic illustration, please refer to Figure 3 , which shows a flow chart of a data calling method provided by an exemplary embodiment of the present application, the method includes the following steps.
[0061] Step 310: Run the data calling process in the first application and the data collecting process in the second application.
[0062] Among them, the data calling process is used to call the target data collected by the second application. The data collection process is a process among multiple processes in the second application that is used to collect data generated during the operation of the terminal. The data calling process accesses the first interaction interface of the data interaction channel, and the data collection process accesses the second interaction interface of the data interaction channel.
[0063] Illustratively, the first application is an application currently running in the terminal, wherein the first application is an independently developed application, that is, the program code in the first application is independently compiled.
[0064] Illustratively, the second application is an application currently running in the terminal. The second application is an application authorized for public use, that is, the program code in the second application is a pre-compiled open source code.
[0065] In some embodiments, the data calling process in the first application refers to a process that calls data in other processes, wherein a process refers to the process in which the program code in the application runs.
[0066] In some embodiments, the data collection process in the second application program refers to a program code with a data collection function that is currently in the process of running.
[0067] Illustratively, the second application includes multiple processes, and different processes implement different functions, such as: playback process (a process with content playback function), streaming process (a process with data streaming function), display process (a process with content display function), and data acquisition process (a process with data generation function).
[0068] Illustratively, the program code corresponding to the data collection process in the second application is obtained from the program code corresponding to the second application.
[0069] Optionally, the process of obtaining the program code corresponding to the data collection process includes at least one of the following methods:
[0070] 1. The program codes corresponding to the processes of different functions in the second application are respectively stored in their respective corresponding folders, so the program code corresponding to the data collection process is directly called from the folder set;
[0071] 2. Obtain the overall program code corresponding to the second application, as well as the code usage instructions corresponding to the overall program code, determine the program code corresponding to the data acquisition process from the overall program code according to the code usage instructions, and delete the program code corresponding to other processes.
[0072] It is worth noting that the above process of obtaining the program code is only an illustrative example and is not limited to this in the embodiments of the present application.
[0073] Optionally, the data calling process actively applies to call the target data collected by the data collection process, that is, the data calling process actively sends a data calling request to the data collection process, requesting to call the target data; or, after the data collection process collects the target data, it actively sends the collected target data to the data calling process, and there is no limitation on this.
[0074] In some embodiments, the data interaction channel is used to indicate that data can be transmitted between the data calling process and the data collection process, including the data calling process sending data to the data collection process and the data calling process receiving data sent by the data collection process.
[0075] In another feasible case, the data interaction channel can also realize message transmission between the data calling process and the data collection process. For example, the data calling process sends data collection instruction information to the data collection process through the data interaction channel to instruct the data collection process to collect data at a specified time.
[0076] Optionally, there are one or more data interaction channels between the data calling process and the data collection process, wherein when there are multiple data interaction channels between the data calling process and the data collection process, different data interaction channels are used to perform different types of data transmission. Wherein, when there are multiple data interaction channels, it is implemented as including multiple data interaction sub-channels between the data calling process and the data collection process.
[0077] Schematically, when there is at least one data interaction channel between the data calling process and the data collection process, each data interaction channel corresponds to two interaction interfaces, namely a first interaction interface and a second interaction interface. Therefore, the data calling process is connected to the first interaction interface, and the data collection process is connected to the second interaction interface, so that the data calling process can receive / send data or messages through the first interaction interface, and the data collection process can receive / send data or messages through the second interaction interface.
[0078] In another feasible case, the data calling process is connected to the second interactive interface, and the data collecting process is connected to the first interactive interface, which is not limited.
[0079] Optionally, when there are multiple data interaction channels between the data calling process and the data collection process, the two interaction interfaces corresponding to each data interaction channel are independently set; or, there are at least two data interaction channels sharing a pair of interaction interfaces, which is not limited.
[0080] In another feasible situation, there are data collection processes in multiple applications, and there are data interaction channels between the data calling process in the first application, that is, the data calling process in the first application can interact with multiple different data collection processes.
[0081] Step 320: Receive a data calling request sent by the data calling process through the first interactive interface.
[0082] In some embodiments, the data call request is used to request to call the target data collected by the data collection process.
[0083] Optionally, the data call request is received in at least one of the following ways:
[0084] 1. When the first application has a demand for using target data, receiving a data call request sent by a data call process in the first application through a first interactive interface;
[0085] 2. Receive a data calling request sent by the data calling process through the first interactive interface at every specified time interval.
[0086] It is worth noting that the above-mentioned method for receiving the data call request is only an illustrative example and is not limited to this in the embodiments of the present application.
[0087] Optionally, the data calling process directly uses the first interactive interface to write a data calling request, that is, the first interactive interface has data writing / data reading functions; or, the data calling process calls the write interface through the first interactive interface, and writes the data calling request through the write interface, that is, there is an interface association relationship between the first interactive interface and the write interface / read interface.
[0088] Step 330: Send the data call request to the data collection process through the second interactive interface, and receive the target data fed back by the data collection process.
[0089] The first interactive interface sends the target data to the data calling process, and the first application is used to call the target data to implement the target function.
[0090] Optionally, the data collection process collects target data after receiving a data call request, that is, when the data collection process completes collecting the target data, it feeds back the collected target data to the data call process; or, after the data collection process completes collecting the target data in advance, it receives a data call request. At this time, the data collection process can directly feed back the collected target data to the data call process.
[0091] In some embodiments, the data collection process receives the data call request through the second interactive interface.
[0092] Optionally, the data acquisition process directly reads the data call request through the second interactive interface, that is, the second interactive interface has data writing / data reading functions; or, the data acquisition process calls the reading interface through the second interactive interface, and reads the data call request through the reading interface, that is, the second interactive interface has an interface association relationship with the write interface / read interface.
[0093] Optionally, the target data transmission method includes at least one of the following transmission methods:
[0094] 1. Receive the target data fed back by the data collection process through the second interactive interface, and directly transmit the target data through the data interactive channel, so that the data calling process reads the target data through the first interactive interface;
[0095] 2. After receiving the target data fed back by the data acquisition process through the second interactive interface, write the target data into the communication channel, transmit the data through the communication channel, and send a communication signal to the data calling process according to the communication channel, so that after the data calling process receives the communication signal, it obtains the target data through the first interactive interface, wherein the communication channel is the underlying channel for data communication between the data acquisition process and the data calling process, that is, the data interaction channel is used to send and receive data / messages, and data transmission is now in the communication channel.
[0096] It is worth noting that the above-mentioned method for transmitting target data is only an illustrative example and is not limited to this in the embodiments of the present application.
[0097] In some embodiments, after the data calling process receives the target data through the first interactive interface, the first application program implements the target function by using the target data.
[0098] In summary, the data calling method provided by the embodiment of the present application can receive the data calling request sent by the data calling process through the first interactive interface, and send the data calling request to the data collecting process through the second interactive interface, and then receive the target data fed back by the data collecting process, and then call the target data through the first application to realize the target function. That is, after the data calling process and the data collecting process are connected to each other through a communication connection to generate a data interaction channel, the sending and receiving of the target data is realized according to the interactive interface, which can not only avoid the code integration of the program contents of different processes to improve the development efficiency, but also enable each part of the process to run independently without affecting each other.
[0099] In an optional embodiment, the data call request is implemented by calling the write interface through the first interactive interface. For example, please refer to Figure 4 , which shows a flow chart of a data calling method provided by an exemplary embodiment of the present application, such as Figure 4 As shown, the method includes the following steps.
[0100] Step 410, obtaining a second application.
[0101] The second application includes program codes corresponding to a plurality of processes respectively.
[0102] Illustratively, the second application is a pre-developed open source program, so program codes corresponding to the multiple processes included in the second application are publicly available.
[0103] In this embodiment, taking the second application program implemented as OBS software as an example, the OBS software includes program codes corresponding to the interface display process, the data collection process, and the data streaming process, respectively.
[0104] Optionally, in the process of obtaining the second application, the program code in the second application is not divided according to each functional process. Therefore, in this case, the program code is divided into program codes corresponding to different processes according to the program functions, so that the program code corresponding to the data acquisition process can run independently.
[0105] Optionally, in the process of acquiring the second application, the program code of the second application has been divided according to various functional processes.
[0106] Step 420: Obtain the target program code corresponding to the data acquisition process from the program codes corresponding to the multiple processes.
[0107] Among them, the target program code is used to realize the independent operation of the data acquisition process.
[0108] In some embodiments, independent operation means that only the code content corresponding to the target program code is currently running, and other code content in the second application is in a non-running state. That is, the second application currently only includes a data acquisition process.
[0109] Illustratively, after the program code of the second application is obtained, the target program code corresponding to the data acquisition process is extracted from the program code of the second application.
[0110] Optionally, when the program code in the second application is not divided according to functional processes, the program code corresponding to the data collection process is stripped from the program code of the second application according to the division of the functional processes of the second application, and the program code corresponding to other functional modules in the original second application is deleted to serve as the target program code corresponding to the data collection process.
[0111] Optionally, when the program code in the second application has been divided according to each functional process, the program code corresponding to the data acquisition process in the division result is directly obtained.
[0112] It is worth noting that during the application process, other processes can be called according to user needs, so the program codes corresponding to other processes can be obtained.
[0113] In another feasible case, the target program code corresponding to the data acquisition process is encapsulated into the kernel state, and the program code corresponding to the data calling process is encapsulated into the user state to achieve code isolation.
[0114] In another feasible situation, the target program code corresponding to the data acquisition process is run in the virtual machine, and the program code corresponding to the data calling process is output through the virtual machine to achieve code isolation.
[0115] Step 430: Run the data calling process in the first application and the data collecting process in the second application.
[0116] Among them, the data calling process is used to call the target data collected by the second application. The data collection process is a process among multiple processes in the second application that is used to collect data generated during the operation of the terminal. The data calling process accesses the first interaction interface of the data interaction channel, and the data collection process accesses the second interaction interface of the data interaction channel.
[0117] Schematically, in order to realize the process communication between the data calling process and the data collection process, a designated inter-process communication module is selected so that the data collection process includes a collection function module and an inter-process communication module.
[0118] Among them, the acquisition function module refers to the function module used by the data acquisition process to acquire target data, and the cross-process communication module refers to the module used to implement the cross-process communication function between the data calling process and the data acquisition process.
[0119] For illustration, please refer to Figure 5 , which shows a schematic diagram of a data collection process component provided by an exemplary embodiment of the present application, such as Figure 5 As shown, for the data collection process, it includes a collection function module 510 and an inter-process communication module 520 .
[0120] In some embodiments, the target program code corresponding to the data acquisition process is compiled into a static library file and connected to the data acquisition process. The static library file is used to isolate the target program code from other program codes.
[0121] In this embodiment, the target program code is compiled into a static library file and connected to the data acquisition process, so that the target program code will not be changed arbitrarily during the program running process, thereby realizing operation isolation.
[0122] In some embodiments, the data interaction channel includes n data interaction sub-channels, wherein the i-th data interaction sub-channel corresponds to the i-th first interaction interface and the i-th second interaction interface, wherein n and i are positive integers.
[0123] In this embodiment, the data interaction channel includes multiple data interaction sub-channels, so each data interaction sub-channel includes an independent first interaction interface and a second interaction interface, that is, the first interaction interface and the second interaction interface corresponding to different data interaction sub-channels are different.
[0124] In this embodiment, a target communication module (Mojo) is used to implement cross-process communication. Since the program development protocol restrictions of Mojo are relatively loose, Mojo is called through dynamic linking during data transmission between the data calling process and the data acquisition process.
[0125] The following is a detailed description of Mojo.
[0126] Mojo supports data communication between multiple processes. Each process is equivalent to a communication node. Mojo forms a communication network and performs data communication through the underlying channels of the Mojo system. Mojo can be used as an IPC bridge to connect two different processes, allowing the two processes to send / receive instructions or information through Mojo's application layer interface.
[0127] For illustration, please refer to Figure 6 , which shows a schematic diagram of implementing a cross-process call through Mojo provided by an exemplary embodiment of the present application, such as Figure 6 As shown, currently the data collection process 601 and the calling process 602 and the calling process 603 are connected in communication through Mojo610, so that the data communication between the data collection process 601, the calling process 602 and the calling process 603 is realized through Mojo610.
[0128] In this embodiment, in order to realize data interaction between the data calling process and the data collection process, the Mojo library is first connected to the data calling process and the data collection process in a dynamic link manner, and then the interaction interface encapsulated by Mojo is called to realize cross-process communication.
[0129] Step 440: When the data calling process writes a data calling request through the first interactive interface, the writing interface of the data interactive channel is called to receive the data calling request.
[0130] Illustratively, the first interaction interface and the second interaction interface are two interfaces corresponding to a data interaction channel, respectively. The data interaction channel is a channel for transmitting data between a data calling process and a data collection process.
[0131] In some embodiments, for a single data interaction channel, the two interfaces corresponding to the data interaction channel are fixed interaction interfaces of the data interaction channel, that is, when the interaction interface receives data, data is transmitted only through the data interaction channel.
[0132] In this embodiment, a message pipe is selected as the data interaction channel. The message pipe has two handles, which are respectively used as the first interaction interface and the second interaction interface corresponding to the data interaction channel. The subsequent data calling process and the data collection process receive and send data through the first interaction interface and the second interaction interface.
[0133] In some embodiments, in response to the data calling process sending a communication connection request to the data collection process, the communication connection relationship between the data calling process and the data collection process is determined based on the communication connection request; and a data interaction channel is generated based on the communication connection relationship.
[0134] In this embodiment, the Mojo environment is initialized during the process of running the data calling process and the data collection process, and the data calling process and the data collection process are communicatively connected through the invitation mechanism (Invitation mechanism) in Mojo. First, take the data calling process as the inviting process and the data collection process as the invited process as an example (the data calling process can also be the invited process and the data collection process as the inviting process) for explanation. The data calling process sends a communication connection request to the data collection process. After the data collection process receives the communication connection request, the communication connection relationship between the data calling process and the data collection process is established through Mojo, and the data collection process and the data calling process are connected in series.
[0135] After the data collection process and the data calling process are successfully connected in series (i.e., the Invitation connection is successful), a data interaction channel Message Pipe is first created. The interface indication information corresponding to the second interaction interface corresponding to the data interaction channel is sent to the data collection process through the first interaction interface of the data interaction channel, so that the data collection process accesses the second interaction interface according to the interface indication information, and data is transmitted between the data calling process and the data collection process through the data interaction channel. That is, the interface indication information of the second interaction interface is sent to the data collection process through the data interaction channel.
[0136] When the data calling process sends a data calling request to the data collecting process, the data calling request is written by calling the writing interface of the data interaction channel through the first interaction interface.
[0137] In a feasible case, when a new data interaction channel needs to be established between the data calling process and the data collection process, the interface indication information of the interaction interface corresponding to the new data interaction channel is sent through the existing data interaction channel to establish it. In one example, the interface indication information of the second interaction interface corresponding to the target interaction channel sent by the data calling process is received through the first interaction interface, and the interface indication information is sent to the data collection process through the second interaction interface, so that after the data collection process receives the interface indication information, it accesses the second interaction interface of the target interaction channel according to the interface indication information.
[0138] Step 450: write the data call request into the data interaction channel.
[0139] In this embodiment, the data call request is written into the data interaction channel through Mojo.
[0140] Step 460: Send a communication signal to the data acquisition process based on the data interaction channel and the data call request.
[0141] In this embodiment, after the data call request is written into the data interaction channel through Mojo, the data acquisition process connected to the other end of the data interaction channel will receive the communication signal corresponding to the data call request.
[0142] The communication signal is used to indicate to the data collection process that there are other processes currently sending communication information / instructions / data to it.
[0143] Optionally, when the data calling process sends different information / data / instructions, the communication signals sent to the data acquisition process are the same or different.
[0144] Step 470: Based on the communication signal, the second interactive interface calls the reading interface of the data interactive channel to send a data calling request to the data acquisition process.
[0145] The data call request can be obtained by calling the reading interface corresponding to the data interaction channel through the second interaction interface according to the communication signal.
[0146] Optionally, the process of the data calling process / data collection process accessing the data interaction channel includes a write interface and a read interface, wherein the write interface is used to write data / instructions / messages, and the read interface is used to read data / instructions / messages.
[0147] Step 480: Receive target data fed back by the data collection process.
[0148] In some embodiments, the data collection process is further used to perform a serialization operation on the target data to obtain serialized data corresponding to the target data. The serialized data and the data type corresponding to the serialized data fed back by the data collection process are received; and the serialized data is deserialized based on the data type to obtain the target data.
[0149] In this embodiment, when the data acquisition process receives a data call request, it is necessary to feed back the collected target data to the data calling process. Before the feedback, in order to ensure the security of data transmission, the target data is serialized to generate a binary data stream, and the binary data stream and data type are written into the binary data stream and data type through the second interactive interface calling the write interface of the data interaction channel, and data is transmitted through the data interaction channel. Then, the data calling process calls the read interface of the data interaction channel through the first interactive interface to read out the binary data stream and data type, and deserializes the binary data stream according to the data type to restore it to the target data.
[0150] In this embodiment, after the data calling process and the data collecting process are connected, the data calling process and the data collecting process jointly define a serialization transmission protocol, and implement serialization and deserialization operations according to the defined serialization transmission protocol.
[0151] In summary, the data calling method provided by the embodiment of the present application can receive the data calling request sent by the data calling process through the first interactive interface, and send the data calling request to the data collecting process through the second interactive interface, and then receive the target data fed back by the data collecting process, and then call the target data through the first application to realize the target function. That is, after the data calling process and the data collecting process are connected to each other through a communication connection to generate a data interaction channel, the sending and receiving of the target data is realized according to the interactive interface, which can not only avoid the code integration of the program contents of different processes to improve the development efficiency, but also enable each part of the process to run independently without affecting each other.
[0152] In this embodiment, by calling the functional interface (write interface / read interface) of the data interaction channel through the first interaction interface, the transmission of data content can be realized on the basis of clearly defining the data interaction channel for data transmission, thereby improving the accuracy of cross-process data transmission.
[0153] In this embodiment, after writing the data call request into the data interaction channel, a communication signal is sent to the data acquisition process according to the data interaction channel and the data call request, so that the data acquisition process calls the reading interface of the data interaction channel through the second interaction interface according to the communication signal to read the data call request, thereby improving the security of data transmission across processes.
[0154] In this embodiment, before data transmission, a communication connection relationship between the data calling process and the data acquisition process is suggested, so that a data interaction channel is generated according to the communication connection relationship, which can ensure the effectiveness of channel establishment.
[0155] In this embodiment, the interface indication information of the second interactive interface is sent to the data acquisition process through the data interaction channel, so that the data acquisition process can directly access the second interactive interface according to the interface indication information, thereby improving the accuracy and efficiency of interface access.
[0156] In this embodiment, by determining the target program code corresponding to the data acquisition process from the program code of the second application program, code isolation is achieved, thereby improving the independence and security of process operation.
[0157] In this embodiment, code isolation can also be achieved by compiling the target program code into a static library file and connecting it to the data acquisition process.
[0158] In this embodiment, the security of data transmission can be guaranteed through serialization and deserialization operations.
[0159] For illustration, the data collection process is the OBS collection process as an example. For illustration, please refer to Figure 7 , which shows a schematic diagram of a data calling method provided by an exemplary embodiment of the present application, such as Figure 7 As shown, the method includes the following contents.
[0160] The data calling process 710 in the first application and the data collection process 720 in the second application are currently running, and data is transmitted between the data calling process 710 and the data collection process 720 via the data interaction channel 730 created by the Mojo library. Therefore, the data calling process 710 can send / receive data through the data interaction channel 730, and similarly, the data collection process 720 can send / receive data through the data interaction channel 730, wherein the data calling process 710 accesses the first interaction interface of the data interaction channel 730, and the data collection process 720 accesses the second interaction interface of the data interaction channel 730.
[0161] The first application is implemented as social software, the second application is video capture software, and the data calling process 710 refers to calling the video captured by the data capture process 720 in the second application to live broadcast the content. Since the social software is an independently developed running program, the data capture process 720 in the second application is called through the following method to capture the video for live broadcast, avoiding code integration of the program code corresponding to the social software and the program code corresponding to the video capture software.
[0162] Taking the data acquisition process 720 sending the target video frame data to the data calling process 710 as an example, before sending the target video frame data, the target video frame data structure is first reconstructed according to the serialization transmission protocol, constructed into a structure defined in the serialization transmission protocol, and then the relevant code of the serialization transmission protocol is called to serialize it into a binary data stream. The data writing interface of Mojo's data interaction channel 730 is called through the second interaction interface to write the binary data stream and the corresponding data type into the data interaction channel 730, and the binary data stream and the corresponding data type are transmitted to the data calling process 710 through the data interaction channel 730. The specific implementation method is to send a communication signal to the data calling process 710.
[0163] After receiving the communication signal, the data calling process 710 calls the reading interface of the data interaction channel 730 through the first interaction interface to read the binary data stream and the corresponding data type, deserializes the binary data stream according to the data type and restores it into the target video frame data, and uses the target video frame data to achieve the target task.
[0164] In summary, the data calling method provided by the embodiment of the present application can receive the data calling request sent by the data calling process through the first interactive interface, and send the data calling request to the data collecting process through the second interactive interface, and then receive the target data fed back by the data collecting process, and then call the target data through the first application to realize the target function. That is, after the data calling process and the data collecting process are connected to each other through a communication connection to generate a data interaction channel, the sending and receiving of the target data is realized according to the interactive interface, which can not only avoid the code integration of the program contents of different processes to improve the development efficiency, but also enable each part of the process to run independently without affecting each other.
[0165] Figure 8 is a structural block diagram of a data calling device provided by an exemplary embodiment of the present application, such as Figure 8 As shown, the device comprises:
[0166] An operation module 810 is used to run a data calling process in a first application and a data collection process in a second application, wherein the data calling process is used to call target data collected by the second application, and the data collection process is a process in a plurality of processes in the second application used to collect data generated during the operation of the terminal, wherein the data calling process is connected to a first interaction interface of a data interaction channel, and the data collection process is connected to a second interaction interface of the data interaction channel;
[0167] A receiving module 820, configured to receive a data calling request sent by the data calling process through the first interactive interface;
[0168] The sending module 830 is used to send the data call request to the data acquisition process through the second interactive interface, and receive the target data fed back by the data acquisition process; the first interactive interface sends the target data to the data calling process, and the first application is used to call the target data to realize the target function.
[0169] In some embodiments, Fig. 9 As shown, the receiving module 820 includes:
[0170] The calling unit 821 is used to call the write interface of the data interaction channel to receive the data calling request when the data calling process writes the data calling request through the first interaction interface.
[0171] In some embodiments, the sending module 830 is also used to write the data call request into the data interaction channel; send a communication signal to the data acquisition process based on the data interaction channel and the data call request; and send the data call request to the data acquisition process by calling the reading interface of the data interaction channel through the second interaction interface based on the communication signal.
[0172] In some embodiments, the sending module 830 is also used to send a communication connection request to the data acquisition process in response to the data calling process, determine the communication connection relationship between the data calling process and the data acquisition process based on the communication connection request; and generate the data interaction channel based on the communication connection relationship.
[0173] In some embodiments, the sending module 830 is further used to send interface indication information of the second interaction interface to the data acquisition process through the data interaction channel.
[0174] In some embodiments, the apparatus further comprises:
[0175] The acquisition module 840 is used to acquire the second application, which includes program codes corresponding to the multiple processes respectively; acquire the target program code corresponding to the data acquisition process from the program codes corresponding to the multiple processes respectively, and the target program code is used to realize independent operation of the data acquisition process.
[0176] In some embodiments, the apparatus further comprises:
[0177] The access module 850 is used to compile the target program code corresponding to the data acquisition process into a static library file and access the data acquisition process. The static library file is used to isolate the target program code from other program codes.
[0178] In some embodiments, the data acquisition process is further used to perform a serialization operation on the target data to obtain serialized data corresponding to the target data;
[0179] The receiving module 820 is further configured to receive the serialized data fed back by the data acquisition process and the data type corresponding to the serialized data; and deserialize the serialized data based on the data type to obtain the target data.
[0180] In some embodiments, the data interaction channel includes n data interaction sub-channels, wherein the i-th data interaction sub-channel corresponds to the i-th first interaction interface and the i-th second interaction interface, wherein n and i are positive integers.
[0181] In summary, the data calling device provided by the embodiment of the present application can receive the data calling request sent by the data calling process through the first interactive interface, and send the data calling request to the data collecting process through the second interactive interface, when the data calling process in the first application and the data collecting process in the second application are simultaneously run. Then, the target data fed back by the data collecting process is received, and the target function is realized by calling the target data through the first application. That is, after the data calling process and the data collecting process are connected to each other through communication to generate a data interaction channel, the sending and receiving of the target data is realized according to the interactive interface, which can not only avoid the code integration of the program contents of different processes to improve the development efficiency, but also enable each part of the process to run independently without affecting each other.
[0182] It should be noted that the data calling device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data calling device provided in the above embodiment and the data calling method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0183] Fig.10 The following is a schematic diagram showing the structure of a server provided by an exemplary embodiment of the present application. Specifically:
[0184] The server 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The server 1000 also includes a mass storage device 1006 for storing an operating system 1013, application programs 1014, and other program modules 1015.
[0185] The mass storage device 1006 is connected to the central processing unit 1001 through a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1006 and its associated computer readable media provide non-volatile storage for the server 1000. That is, the mass storage device 1006 may include a computer readable medium (not shown) such as a hard disk or a compact disc read only memory (CD-ROM) drive.
[0186] Without loss of generality, computer-readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media are not limited to the above. The above-mentioned system memory 1004 and mass storage device 1006 can be collectively referred to as memory.
[0187] According to various embodiments of the present application, the server 1000 can also be connected to a remote computer on the network through a network such as the Internet. That is, the server 1000 can be connected to the network 1012 through the network interface unit 1011 connected to the system bus 1105, or the network interface unit 1011 can be used to connect to other types of networks or remote computer systems (not shown).
[0188] The above-mentioned memory also includes one or more programs, and the one or more programs are stored in the memory and configured to be executed by the CPU.
[0189] An embodiment of the present application also provides a computer device, which includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the data calling method provided by the above-mentioned method embodiments.
[0190] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the data calling method provided by the above-mentioned method embodiments.
[0191] The embodiment of the present application also provides a computer program product, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any of the data calling methods described in the above embodiments.
[0192] Optionally, the computer readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a solid state drive (SSD), or an optical disk. Among them, the random access memory may include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0193] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0194] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data calling method, characterized in that: The method comprises: Run a data calling process in the first application and a data collection process in the second application, wherein the data calling process is used to call the target data collected by the second application, and the data collection process is a process in the second application used to collect data generated during the operation of the terminal, the data calling process is connected to a first interaction interface of a data interaction channel, and the data collection process is connected to a second interaction interface of the data interaction channel; Receiving, through the first interactive interface, a data calling request sent by the data calling process; Sending the data call request to the data collection process through the second interactive interface, and receiving the target data fed back by the data collection process; The first interactive interface sends the target data to the data calling process, and the first application is used to call the target data to implement the target function.
2. The method according to claim 1, characterized in that: The receiving, through the first interactive interface, the data calling request sent by the data calling process includes: In the case where the data calling process writes the data calling request through the first interactive interface, the write interface of the data interactive channel is called to receive the data calling request.
3. The method according to claim 2, characterized in that The sending the data call request to the data collection process through the second interactive interface includes: Writing the data call request into the data interaction channel; Sending a communication signal to the data acquisition process based on the data interaction channel and the data call request; Based on the communication signal, the reading interface of the data interaction channel is called through the second interaction interface to send the data calling request to the data acquisition process.
4. The method according to claim 3, before writing the data call request into the data interaction channel, further comprising: In response to the data calling process sending a communication connection request to the data acquisition process, determining a communication connection relationship between the data calling process and the data acquisition process based on the communication connection request; The data interaction channel is generated based on the communication connection relationship.
5. The method according to claim 4, characterized in that The method further comprises: Interface indication information of the second interactive interface is sent to the data acquisition process through the data interaction channel.
6. The method according to any one of claims 1 to 5, characterized in that: Before running the data calling process in the first application and the data collecting process in the second application, the method further includes: Acquire the second application, where the second application includes program codes corresponding to the multiple processes respectively; The target program code corresponding to the data acquisition process is obtained from the program codes corresponding to the multiple processes respectively, and the target program code is used to realize the independent operation of the data acquisition process.
7. The method according to claim 6, characterized in that The method further comprises: The target program code corresponding to the data acquisition process is compiled into a static library file and connected to the data acquisition process. The static library file is used to isolate the target program code from other program codes.
8. The method according to any one of claims 1 to 5, characterized in that: The data acquisition process is also used to perform a serialization operation on the target data to obtain serialized data corresponding to the target data; The receiving the target data fed back by the data collection process includes: Receive the serialized data and the data type corresponding to the serialized data fed back by the data collection process; The serialized data is deserialized based on the data type to obtain the target data.
9. The method according to any one of claims 1 to 5, characterized in that: The data interaction channel includes n data interaction sub-channels, wherein the i-th data interaction sub-channel corresponds to the i-th first interaction interface and the i-th second interaction interface, wherein n and i are positive integers.
10. A data calling device, characterized in that: The device comprises: A running module, used to run a data calling process in a first application and a data collection process in a second application, wherein the data calling process is used to call target data collected by the second application, and the data collection process is a process in a plurality of processes in the second application used to collect data generated during the operation of the terminal, wherein the data calling process is connected to a first interaction interface of a data interaction channel, and the data collection process is connected to a second interaction interface of the data interaction channel; A receiving module, configured to receive a data calling request sent by the data calling process through the first interactive interface; The sending module is used to send the data call request to the data acquisition process through the second interactive interface, and receive the target data fed back by the data acquisition process; the first interactive interface sends the target data to the data calling process, and the first application is used to call the target data to realize the target function.
11. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the data calling method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the data calling method according to any one of claims 1 to 9.
13. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the data calling method as claimed in any one of claims 1 to 9.
