WO2019001078A1 - 一种用于在直播软件中加载插件的方法及装置 - Google Patents

一种用于在直播软件中加载插件的方法及装置 Download PDF

Info

Publication number
WO2019001078A1
WO2019001078A1 PCT/CN2018/082304 CN2018082304W WO2019001078A1 WO 2019001078 A1 WO2019001078 A1 WO 2019001078A1 CN 2018082304 W CN2018082304 W CN 2018082304W WO 2019001078 A1 WO2019001078 A1 WO 2019001078A1
Authority
WO
WIPO (PCT)
Prior art keywords
plug
loading
target
main program
plugin
Prior art date
Application number
PCT/CN2018/082304
Other languages
English (en)
French (fr)
Inventor
杨亮
陈少杰
张文明
Original Assignee
武汉斗鱼网络科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2019001078A1 publication Critical patent/WO2019001078A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and apparatus for loading a plug-in in a live broadcast software.
  • the method of loading the plug-in in the application is used to implement the update of the application, but since the plug-in has high requirements on the running environment, when the running environment is unstable, the plug-in is prone to crash, and the plug-in is loaded. Go to the app, causing the app to crash.
  • the embodiment of the invention provides a method and a device for loading a plug-in in a live broadcast software, which solves the technical problem that the method for loading a plug-in in the prior art has poor stability.
  • the present invention provides a method for loading a plug-in in a live broadcast software, comprising:
  • the plug-in loading process is used as a client of a protocol connection, and the main process acts as a server end of the protocol connection, and establishes a remote procedure call protocol connection between the plug-in loading process and the main program process;
  • the main program process is caused to load the target plugin loaded into the plugin loading process.
  • a second aspect of the present invention provides a method for loading a plug-in in a live broadcast software, including:
  • the main program process is caused to load the target plugin loaded into the plugin loading process.
  • the method further includes: calling the target a plugin that causes the main program process to implement the function of the target plugin;
  • the calling the target plugin so that the main program process implements the function of the target plugin, including:
  • the main program process is caused to call the target plugin.
  • the causing the main program process to invoke the target plug-in based on the path includes:
  • the method before the sending the content of the target plug-in to the main process to enable the main process to implement the calling of the target plug-in, the method further includes:
  • the content of the target plug-in includes image information, create a shared memory between the plug-in loading process and the main program process;
  • the content of the target plug-in does not contain image information, the content of the target plug-in is sent to the main process.
  • the method further includes:
  • the main program is caused to read the content of the target plug-in in the shared memory based on the remote procedure call protocol connection.
  • a third aspect of the present invention provides an apparatus for loading a plug-in in a live broadcast software, including:
  • An acquiring module configured to acquire, according to a preset directory, a target plug-in to be loaded into a main program process corresponding to the live broadcast software
  • a module for creating a plug-in loading process by calling a plug-in fetch function with the main program process, and calling the system interface through the plug-in fetch function;
  • connection module configured to use the plug-in loading process as a client of a protocol connection, where the main process acts as a server end of the protocol connection, and establishes a remote procedure call protocol connection between the plug-in loading process and the main program process;
  • a first loading module configured to load the target plug-in into the plug-in loading process
  • a second loading module configured to enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • a fourth aspect of the present invention provides an apparatus for loading a plug-in in a live broadcast software, including:
  • An acquiring module configured to acquire, according to a preset directory, a target plug-in to be loaded into a main program process corresponding to the live broadcast software
  • connection module configured to establish a remote procedure call protocol connection between the plug-in loading process and the main program process
  • a first loading module configured to load the target plug-in into the plug-in loading process
  • a second loading module configured to enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • the apparatus for loading a plug-in in a live broadcast software provided by the present invention further includes a calling module, configured to implement loading, according to the remote procedure call protocol, the loading of the main program process pair to the plug-in After loading the target plug-in in the loading process, calling the target plug-in to enable the main program process to implement the function of the target plug-in;
  • the calling the target plugin so that the main program process implements the function of the target plugin, including:
  • the main program process is caused to call the target plugin.
  • the device provided by the present invention is used to load a plug-in in a live broadcast software, and the calling module is further configured to:
  • the device for loading a plug-in in the live broadcast software provided by the present invention, further comprising: a determining module, configured to send the content of the target plug-in to the main process, so that the main process is implemented Before the call of the target plugin,
  • the content of the target plug-in includes image information, creating a shared memory between the plug-in loading process and the main program process;
  • the content of the target plug-in does not contain image information, the content of the target plug-in is sent to the main process.
  • the apparatus for loading a plug-in in a live broadcast software provided by the present invention further includes a processing module, configured to: if the content of the target plug-in includes image information, in the plug-in loading process and the main After the shared memory is created between the program processes, the content of the target plugin is stored in the shared memory;
  • the main program is caused to read the content of the target plug-in in the shared memory based on the remote procedure call protocol connection.
  • a fifth aspect of the present invention provides a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the following steps:
  • the main program process is caused to load the target plugin loaded into the plugin loading process.
  • a sixth aspect of the invention provides a computer device comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, the processor implementing the program to implement the following step:
  • the main program process is caused to load the target plugin loaded into the plugin loading process.
  • the method of the embodiment of the present invention creates a plug-in loading process by acquiring a target plug-in to be loaded into a main program process corresponding to the live-play software based on a preset directory, and establishing a plug-in loading process between the plug-in loading process and the main program process.
  • Remote procedure call protocol connection loading the target plug-in into the plug-in loading process, and based on the remote procedure call protocol connection, causing the main program process to implement the target loaded into the plug-in loading process The loading of the plugin.
  • the obtained target plug-in to be loaded into the main program process is not directly loaded into the main program process, but is loaded into the created plug-in loading process, and is remotely loaded between the process and the main program process through the plug-in.
  • the procedure calls the protocol connection to implement the loading of the target plug-in by the main program process, that is, the target plug-in is loaded into the plug-in loading process, instead of being directly loaded into the main program process, since different processes adopt different memory address spaces, and thus the target
  • the memory address space of the plug-in is different from the memory address space of the main program process, so that the target plug-in and the main program process can run independently, so that the two do not affect each other, so the stability of loading the plug-in in the main program process can be improved.
  • the target plug-in is directly loaded into the main program process, which can reduce the influence of the target plug-in on the main program process, and avoid the main program process crash caused by the instability of the target plug-in, and solve the loading plug-in in the prior art.
  • the method has technical problems with poor stability.
  • FIG. 1 is a flowchart of a method for loading a plug-in in a live broadcast software according to an embodiment of the present invention
  • FIG. 2 is a flowchart of another method for loading a plug-in in a live broadcast software according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of an apparatus for loading a plug-in in a live broadcast software according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of another apparatus for loading a plug-in in a live broadcast software according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of a computer readable storage medium according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
  • the embodiment of the present application provides a method and an apparatus for loading a plug-in in a live broadcast software, which solves the technical problem that the method for loading a plug-in in the prior art has poor stability.
  • a method for loading a plug-in in a live broadcast software comprising: acquiring a target plug-in to be loaded into a main program process corresponding to the live broadcast software based on a preset directory; creating a plug-in loading process; and loading the plug-in process Establishing a remote procedure call protocol connection between the main program processes; loading the target plugin into the plugin loading process; and causing the main program process to implement loading to the plugin based on the remote procedure call protocol connection The loading of the target plugin in the loading process.
  • the obtained target plug-in to be loaded into the main program process is not directly loaded into the main program process, but is loaded into the created plug-in loading process, and is loaded between the process and the main program process through the plug-in.
  • Remote procedure call protocol connection to achieve the main program process loading of the target plug-in, that is, the target plug-in is loaded into the plug-in loading process, rather than directly loaded into the main program process, because different processes use different memory address space, thus The memory address space of the target plug-in is different from the memory address space of the main program process, so that the target plug-in and the main program process can run independently, and thus the two do not affect each other, so the stability of loading the plug-in in the main program process can be improved.
  • directly loading the target plug-in into the main program process can reduce the influence of the target plug-in on the main program process, and avoid the main program process crash caused by the instability of the target plug-in, and solve the loading in the prior art.
  • the plugin method has technical problems with poor stability.
  • This embodiment provides a method for loading a plug-in in a live broadcast software. As shown in FIG. 1 , the method includes:
  • Step S101 Acquire a target plug-in to be loaded into a main program process corresponding to the live broadcast software based on a preset directory;
  • Step S102 Create a plug-in loading process
  • Step S103 Establish a remote procedure call protocol connection between the plug-in loading process and the main program process
  • Step S104 Loading the target plug-in into the plug-in loading process
  • Step S105 Enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • the live broadcast software is an application for providing a live broadcast service, and the method for loading a plug-in in the live broadcast software provided by the present invention is applied to a Windows system.
  • step S101 is executed to acquire a target plug-in to be loaded into a main program process corresponding to the live broadcast software based on a preset directory.
  • the target plug-in is a live software plug-in.
  • all plugins will be saved to a certain directory, you can use the plugin's save directory as a default directory, and then find the target plugin from the default directory.
  • the implementation further includes filtering out the target plug-ins from all the plug-ins, and first screening out the valid plug-ins from all the plug-ins, and then determining whether the legal plug-ins broadcast the plug-ins of the software type.
  • step S102 is executed to create a plug-in loading process.
  • the plug-in fetch function can be called by the above-mentioned live broadcast software main body, and then the plug-in loading process is created by the plug-in fetch function calling system interface.
  • the plug-in fetch function can be OpenPluginCapture, and then the OpenPluginCapture function internally calls the system. Create a process interface CreateProcess, which can create a plug-in loading process, namely the PluginLoader process.
  • step S103 is executed to establish a remote procedure call protocol connection between the plug-in loading process and the main program process.
  • RPC Remote Procedure Call
  • a remote procedure call protocol connection is a mechanism for inter-process communication, requesting services from a remote computer program over a network without knowing the protocol of the underlying network technology.
  • the RPC protocol assumes the existence of certain transport protocols, such as TCP (Transmission Control Protocol) or UDP (User Datagram Protocol), for carrying information data between communication programs.
  • TCP Transmission Control Protocol
  • UDP User Datagram Protocol
  • the main program of the live broadcast software can be used as the RPC server, and the plug-in loading process is used as the RPC client, and then the communication channel between the two processes is established through the RPC mechanism.
  • step S104 is executed to load the target plug-in into the plug-in loading process.
  • the target plugin can be loaded by the plugin loading process.
  • step S105 is executed to enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • the method provided by the present invention is finally for loading the target plug-in into the live broadcast software, more specifically, the main program process corresponding to the live broadcast software, therefore, the remote program call protocol connection is required to make the main program process Implement loading of the target plugin.
  • the applicant of the present invention directly loads the plug-in into the method of the main program process, and the plug-in and the main program process run in the same process address space, and the operation of the plug-in directly affects the operation of the main program process, however,
  • the plug-in has higher requirements on the running environment. If the running environment is unstable, it is prone to crash, which causes the main program process to crash. Therefore, the above loading method has a technical problem of poor stability.
  • the embodiment of the present invention adopts first loading a target plug-in into a plug-in loading process, and then, based on the remote procedure call protocol connection, causing the main program process to implement loading to the
  • the loading method of the target plug-in in the plug-in loading process because different memory addresses are different in different processes, the memory address space of the target plug-in is different from the memory address space of the main program process, so that the target plug-in and the main program process can It runs independently and thus does not affect each other. Therefore, the stability of loading plug-ins in live broadcast software can be improved.
  • the method further includes: calling the target a plugin that causes the main program process to implement the function of the target plugin;
  • the calling the target plugin so that the main program process implements the function of the target plugin, including:
  • the main program process is caused to call the target plugin.
  • the plug-in is loaded in the live broadcast software to implement the function of the plug-in, so the plug-in needs to be called.
  • the main program process cannot call the target plug-in, so it needs to be called through a remote procedure call protocol connection.
  • the function function of the target plug-in can be Registered into the path of the remote procedure call protocol connection, and then the target program plugin is called by the main program process through the above path.
  • the function function of the target plug-in can be registered by calling the plug-in registration function RpcRegisterProcedure of the RPC API, including but not limited to the following functions: plug-in open function Open, get parameter function GetParameters, read image function ReadVideo, read Audio function ReadAudio, destruction function Destroy, etc.
  • the causing the main program process to invoke the target plug-in based on the path includes:
  • the function of the target plug-in is to obtain audio, it needs to be called first through RPC, then call the get parameter function GetParameters, then call the read audio function ReadAudio, get the audio content, and then send the audio content through RPC. To the main program process.
  • the method further includes: before the sending the content of the target plug-in to the main program process, and causing the main program process to implement the calling of the target plug-in, the method further includes:
  • the content of the target plug-in includes image information, create a shared memory between the plug-in loading process and the main program process;
  • the content of the target plug-in does not contain image information, the content of the target plug-in is sent to the main program process.
  • the plug-in function function of the target plug-in is called by the RPC
  • the plug-in content acquired by the RPC needs to be sent to the main program process, but if the plug-in content includes image information, and the image information has a large capacity, it needs to be transmitted.
  • the amount of bytes is also very large, which affects the performance of the live software loading plugin. Therefore, the embodiment of the present invention improves the loading performance by creating a shared memory manner, so that data transfer between the plug-in loading process and the main program process can be realized by sharing memory, which reduces the cost of the system and improves the performance of the plug-in loading. .
  • the method further includes:
  • the main program is caused to read the content of the target plug-in in the shared memory based on the remote procedure call protocol connection.
  • the content of the plug-in includes image information
  • the plug-in loading process the content of the plug-in is saved to the shared memory, specifically, the image is drawn to the shared memory, and the plug-in loading process can be in the shared memory.
  • the area is written, and the main program process reads in the shared memory area.
  • a shared memory can be created by calling the system's created memory mapping function CreateFileMapping through the plug-in loading process, and the data in the shared memory is obtained through the file mapping object view function MapViewOfFile.
  • the above-mentioned shared memory area in which the plug-in loading process and the main program process share images has been created, and then the data communication process between the two processes through RPC is described in detail.
  • the main program process needs to call the get image function ReadVideo
  • the main program process will call the RpcCallProcedure function
  • the plug-in load process PluginLoader ReadVideo function will be called by the RpcCallProcedure function.
  • the main program process is blocked until it receives the completion from the PluginLoader process. The message is only awakened.
  • the PluginLoader draws the image content, the image content is copied to the shared memory area.
  • the plug-in loading process calls the RpcCompleteProcedureCall function to notify the main program that the ReadVideo function operation is completed, and the main program process is awakened.
  • the main program process calls MapViewOfFile to display the image content in the shared memory.
  • the present application further provides another method for loading a plug-in in a live broadcast software.
  • Embodiment 2 For details, see Embodiment 2.
  • This embodiment provides a method for loading a plug-in in a live broadcast software. Referring to FIG. 2, the method includes:
  • Step S201 Acquire a target plug-in to be loaded into a main program process corresponding to the live broadcast software based on a preset directory;
  • Step S202 Calling a plug-in fetch function by the main program process, and creating a plug-in loading process by using the plug-in fetch function calling system interface;
  • Step S203 The plug-in loading process is used as a client of the protocol connection, and the main process acts as a server connected by the protocol, and establishes a remote procedure call protocol connection between the plug-in loading process and the main program process;
  • Step S204 Loading the target plug-in into the plug-in loading process
  • Step S205 Enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • the present application further provides an apparatus corresponding to the method for loading a plug-in in a live broadcast software according to the first embodiment.
  • an apparatus corresponding to the method for loading a plug-in in a live broadcast software according to the first embodiment.
  • This embodiment provides an apparatus for loading a plug-in in a live broadcast software.
  • the apparatus includes:
  • the obtaining module 301 is configured to acquire, according to the preset directory, a target plug-in to be loaded into a main program process corresponding to the live broadcast software;
  • a module 302 is created for creating a plugin loading process
  • connection module 303 configured to establish a remote procedure call protocol connection between the plug-in loading process and the main program process
  • a first loading module 304 configured to load the target plug-in into the plug-in loading process
  • the second loading module 305 is configured to enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • the apparatus for loading a plug-in in the live broadcast software provided by the embodiment further includes a calling module, configured to implement, according to the remote procedure call protocol connection, the loading of the main program process to the plug-in loading process After loading the target plug-in in the method, the method further includes: calling the target plug-in to enable the main program process to implement the function of the target plug-in;
  • the main program process is caused to call the target plugin.
  • the calling module is further configured to:
  • the device for loading a plug-in in the live broadcast software provided by the embodiment further includes a determining module, configured to send the content of the target plug-in to the main process, so that the main process implements the Before the target plugin is called,
  • the content of the target plug-in includes image information, create a shared memory between the plug-in loading process and the main program process;
  • the content of the target plug-in does not contain image information, the content of the target plug-in is sent to the main process.
  • the apparatus for loading a plug-in in the live broadcast software provided by the embodiment further includes a processing module, configured to: when the content of the target plug-in includes image information, in the plug-in loading process and the main program process After creating shared memory between:
  • the main program is caused to read the content of the target plug-in in the shared memory based on the remote procedure call protocol connection.
  • the present application further provides an apparatus corresponding to the method for loading a plug-in in a live broadcast software according to the second embodiment.
  • an apparatus corresponding to the method for loading a plug-in in a live broadcast software according to the second embodiment.
  • This embodiment provides an apparatus for loading a plug-in in a live broadcast software.
  • the apparatus includes:
  • the obtaining module 401 is configured to acquire, according to the preset directory, a target plug-in to be loaded into a main program process corresponding to the live broadcast software;
  • a creating module 402 configured to create a plug-in loading process by calling a plug-in fetch function with the main program process, and by using the plug-in fetch function calling system interface;
  • connection module 403 configured to use the plug-in loading process as a client of a protocol connection, where the main process acts as a server of a protocol connection, and establishes a remote procedure call protocol connection between the plug-in loading process and the main program process.
  • a first loading module 404 configured to load the target plug-in into the plug-in loading process
  • the second loading module 405 is configured to enable the main program process to load the target plug-in loaded into the plug-in loading process based on the remote procedure call protocol connection.
  • the present application further provides a computer readable medium corresponding to the method for loading a plug-in in a live broadcast software according to the first embodiment.
  • a computer readable medium corresponding to the method for loading a plug-in in a live broadcast software according to the first embodiment.
  • the embodiment provides a computer readable storage medium 500 on which a computer program 511 is stored.
  • the program 511 is executed by the processor, the following steps are implemented:
  • the main program process is caused to load the target plugin loaded into the plugin loading process.
  • the computer readable storage medium 500 is further configured to perform the loading based on the remote procedure call protocol after the main program process loads the target plugin loaded into the plugin loading process. The following steps:
  • the calling the target plugin so that the main program process implements the function of the target plugin, including:
  • the main program process is caused to call the target plugin.
  • the computer readable storage medium 500 further performs the following steps:
  • the computer readable storage medium 500 performs the following steps before performing the step of sending the content of the target plugin to the main process, so that the main process implements the calling step of the target plugin. :
  • the content of the target plug-in includes image information, creating a shared memory between the plug-in loading process and the main program process;
  • the content of the target plug-in does not contain image information, the content of the target plug-in is sent to the main process.
  • the computer readable storage medium 500 is configured to execute, if the content of the target plug-in includes image information, after the shared memory is created between the plug-in loading process and the main program process, step:
  • the main program is caused to read the content of the target plug-in in the shared memory based on the remote procedure call protocol connection.
  • the present application further provides a computer device corresponding to the method for loading a plug-in in a live broadcast software according to the first embodiment.
  • a computer device corresponding to the method for loading a plug-in in a live broadcast software according to the first embodiment.
  • the embodiment provides a computer device, including a memory 601, a processor 602, and a computer program 603 stored in the memory and operable on the processor.
  • a computer device including a memory 601, a processor 602, and a computer program 603 stored in the memory and operable on the processor.
  • the processor 602 executes the program 603, Implement the following steps:
  • the main program process is caused to load the target plugin loaded into the plugin loading process.
  • the computer device further performs the following steps: The target plugin, causing the main program process to implement the function of the target plugin;
  • the calling the target plugin so that the main program process implements the function of the target plugin, including:
  • the main program process is caused to call the target plugin.
  • the foregoing computer device performs the following steps before performing the sending of the content of the target plug-in to the main process, so that the main process implements the calling of the target plug-in:
  • the content of the target plug-in includes image information, create a shared memory between the plug-in loading process and the main program process;
  • the content of the target plug-in does not contain image information, the content of the target plug-in is sent to the main process.
  • the computer device is configured to perform the following steps after the content of the target plug-in includes image information, after the shared memory is created between the plug-in loading process and the main program process:
  • the main program is caused to read the content of the target plug-in in the shared memory based on the remote procedure call protocol connection.
  • the memory 601 can be used to store a computer program 603 comprising software programs, modules and data, and the processor 602 executes the computer program 603 stored in the memory 601 by execution to perform various functional applications and data processing of the computer device.
  • memory 601 can be used to store software programs and modules, and processor 602 executes various functional applications and data processing of computer devices by running software programs and modules stored in memory 601.
  • the memory 601 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function, and the like; the storage data area may store data created according to usage of the computer device, and the like.
  • the memory 601 may include a high speed random access memory, and may also include a nonvolatile memory such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • Processor 602 is a control center for a computer device that connects various portions of the entire computer device using various interfaces and lines, by running or executing software programs and/or modules stored in memory 601, and recalling data stored in memory 601. , performing various functions and processing data of the computer device, thereby performing overall monitoring of the computer device.
  • the processor 602 may include one or more processing units; preferably, the processor 602 may integrate an application processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the method of the embodiment of the present invention creates a plug-in loading process by acquiring a target plug-in to be loaded into a main program process corresponding to the live-play software based on a preset directory, and establishing a plug-in loading process between the plug-in loading process and the main program process.
  • Remote procedure call protocol connection loading the target plug-in into the plug-in loading process, and based on the remote procedure call protocol connection, causing the main program process to implement the target loaded into the plug-in loading process The loading of the plugin.
  • the obtained target plug-in to be loaded into the main program process is not directly loaded into the main program process, but is loaded into the created plug-in loading process, and is remotely loaded between the process and the main program process through the plug-in.
  • the procedure calls the protocol connection to implement the loading of the target plug-in by the main program process, that is, the target plug-in is loaded into the plug-in loading process, instead of being directly loaded into the main program process, since different processes adopt different memory address spaces, and thus the target
  • the memory address space of the plug-in is different from the memory address space of the main program process, so that the target plug-in and the main program process can run independently, so that the two do not affect each other, so the stability of loading the plug-in in the main program process can be improved.
  • the target plug-in is directly loaded into the main program process, which can reduce the influence of the target plug-in on the main program process, and avoid the main program process crash caused by the instability of the target plug-in, and solve the loading plug-in in the prior art.
  • the method has technical problems with poor stability.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

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)

Abstract

一种用于在直播软件中加载插件的方法及装置,其中的方法包括:基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件(S101),创建插件加载进程(S102),在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接(S103),将所述目标插件加载至所述插件加载进程中(S104);基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载(S105)。所述方法解决了现有技术中加载插件的方法存在稳定性较差的技术问题。

Description

一种用于在直播软件中加载插件的方法及装置 技术领域
本发明涉及计算机技术领域,尤其涉及一种用于在直播软件中加载插件的方法及装置。
背景技术
随着计算机技术的发展,电子设备的应用也越来越广泛,电子设备上的应用程序也越来越多,而随着用户对应用程序功能的需求的变化,应用程序的更新变动也较为频繁,当应用程序发生变化时,用户则需要重新下载新的应用程序,这样增加了系统的资源消耗。
为了解决上述问题,采用在应用程序中加载插件的方法,来实现应用程序的更新,但是由于插件对运行环境的要求较高,当运行环境不稳定时,插件容易发生崩溃,而该插件已加载至应用程序中,从而导致应用程序的崩溃。
由此可知,现有技术中加载插件的方法存在稳定性较差的技术问题。
发明内容
本发明实施例提供了一种用于在直播软件中加载插件的方法及装置,用以解决现有技术中加载插件的方法存在稳定性较差的技术问题。
第一方面,本发明提供了一种用于在直播软件中加载插件的方法,包括:
基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
通过所述主程序进程调用插件抓取函数,并通过所述插件抓取函数调用系统接口创建插件加载进程;
将所述插件加载进程作为协议连接的客户端,所述主进程作为协议连接的服务端,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
将所述目标插件加载至所述插件加载进程中;
基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
基于同样的发明构思,本发明第二方面提供了一种用于在直播软件中加载插件的方法,包括:
基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
创建插件加载进程;
在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
将所述目标插件加载至所述插件加载进程中;
基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
可选地,在所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,所述方法还包括:调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
所述调用所述目标插件,使所述主程序进程实现所述目标插件的功能,包括:
将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
基于所述路径,使所述主程序进程调用所述目标插件。
可选地,所述基于所述路径,使所述主程序进程调用所述目标插件包括:
基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用。
可选地,在所述将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用之前,所述方法还包括:
判断所述目标插件的内容是否包含图像信息;
若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程序进程之间创建共享内存;
若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主进程。
可选地,若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后,所述方法还包括:
将所述目标插件的内容存储至所述共享内存中;
基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
基于同样的发明构思,本发明第三方面提供了一种用于在直播软件中加载插件的装置,包括:
获取模块,用于基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
创建模块,用于通过与所述主程序进程调用插件抓取函数,并通过所述插件抓取函数调用系统接口创建插件加载进程;
连接模块,用于将所述插件加载进程作为协议连接的客户端,所述主进程作为协议连接的服务端,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
第一加载模块,用于将所述目标插件加载至所述插件加载进程中;
第二加载模块,用于基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
基于同样的发明构思,本发明第四方面提供了一种用于在直播软件中加载插件的装置,包括:
获取模块,用于基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
创建模块,用于创建插件加载进程;
连接模块,用于在所述插件加载进程和与所述主程序进程之间建立远程过程调用协议连接;
第一加载模块,用于将所述目标插件加载至所述插件加载进程中;
第二加载模块,用于基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
可选的,本发明提供的用于在直播软件中加载插件的装置,还包括调用模块,用于在所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
所述调用所述目标插件,使所述主程序进程实现所述目标插件的功能,包括:
将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
基于所述路径,使所述主程序进程调用所述目标插件。
可选的,本发明提供的用于在直播软件中加载插件的装置,所述调用模块还用于:
基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用。
可选的,本发明提供的用于在直播软件中加载插件的装置,还包括判断模块,用于在所述将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用之前,
判断所述目标插件的内容是否包含图像信息;
若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程 序进程之间创建共享内存;
若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主进程。
可选的,本发明提供的用于在直播软件中加载插件的装置,还包括处理模块,用于若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后,将所述目标插件的内容存储至所述共享内存中;
基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
基于同样的发明构思,本发明第五方面提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现以下步骤:
基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
创建插件加载进程;
在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
将所述目标插件加载至所述插件加载进程中;
基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
基于同样的发明构思,本发明第六方面提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现以下步骤:
基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
创建插件加载进程;
在所述插件加载进程和与所述主程序进程之间建立远程过程调用协议连接;
将所述目标插件加载至所述插件加载进程中;
基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
本申请实施例中的上述一个或多个技术方案,至少具有如下一种或多种技术效果:
本发明实施例的方法,通过基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件,创建插件加载进程,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接,将所述目标插件加载至所述插件 加载进程中,并基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。由于本发明的方法,获取的待加载至主程序进程中的目标插件不是直接加载到主程序进程中,而是加载到创建的插件加载进程中,并通过插件加载进程与主程序进程之间远程过程调用协议连接,来实现主程序进程对目标插件的加载,即目标插件是加载到插件加载进程中,而不是直接加载到主程序进程中,由于不同的进程采用的内存地址空间不同,因而目标插件的内存地址空间与主程序进程的内存地址空间不同,从而目标插件与主程序进程可以独立运行,进而两者之间不会相互影响,故而可以提高在主程序进程加载插件的稳定性,相对于现有技术直接将目标插件加载到主程序进程中而言,可以降低目标插件对主程序进程的影响,避免由于目标插件不稳定而导致的主程序进程崩溃,解决了现有技术中加载插件的方法存在稳定性较差的技术问题。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例中一种用于在直播软件中加载插件的方法的流程图;
图2为本发明实施例中另一种用于在直播软件中加载插件的方法的流程图;
图3为本发明实施例中一种用于在直播软件中加载插件的装置的结构示意图;
图4为本发明实施例中另一种用于在直播软件中加载插件的装置的结构示意图;
图5为本发明实施例中一种计算机可读存储介质的结构示意图
图6为本发明实施例中一种计算机设备的结构示意图。
具体实施方式
本申请实施例通过提供用于在直播软件中加载插件的方法及装置,用以解决现有技术中加载插件的方法存在稳定性较差的技术问题。
本申请实施例中的技术方案,总体思路如下:
一种用于在直播软件中加载插件的方法,包括:基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;创建插件加载进程;在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;将所述目标插件加载至所述插件加载进程中;基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
由于本发明的上述方法,获取的待加载至主程序进程中的目标插件不是直接加载到主程序进程中,而是加载到创建的插件加载进程中,并通过插件加载进程与主程序进程之间远程过程调用协议连接,来实现主程序进程对目标插件的加载,即目标插件是加载到插件加载进程中,而不是直接加载到主程序进程中,由于不同的进程采用的内存地址空间不同,因而目标插件的内存地址空间与主程序进程的内存地址空间不同,从而目标插件与主程序进程可以独立运行,进而两者之间不会相互影响,故而可以提高在主程序进程加载插件的稳定性,相对于现有技术直接将目标插件加载到主程序进程中而言,可以降低目标插件对主程序进程的影响,避免由于目标插件不稳定而导致的主程序进程崩溃,解决了现有技术中加载插件的方法存在稳定性较差的技术问题。
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
实施例一
本实施例提供一种用于在直播软件中加载插件的方法,如图1所示,该方法包括:
步骤S101:基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
步骤S102:创建插件加载进程;
步骤S103:在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
步骤S104:将所述目标插件加载至所述插件加载进程中;
步骤S105:基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
需要说明的是,上述直播软件是用于提供直播业务的应用程序,本发明提供的在直播软件中加载插件的方法应用于Windows系统中。
下面,结合图1详细介绍本申请实施例提供的用于在直播软件中加载插件的方法的实施步骤。
首先,执行步骤S101,基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件。
具体来说,首先需要获取待加载目标插件,具体来说上述目标插件为直播软件插件。一般来说,所有的插件都会保存到一定的目录中,则可以将插件的保存目录作为预设目录,然后从预设目录中查找目标插件。作为优选,本实施还包括从所有的插件中筛选出目标插件,可以首先从所有插件中筛选出合法的插件,然后再判断合法的插件是否直播软件类型的插件。
然后执行步骤S102,创建插件加载进程。
在具体的实施过程中,可以通过上述直播软件主程调用插件抓取函数,然后通过插件抓取函数调用系统接口来创建插件加载进程,上述插件抓取函数可以为OpenPluginCapture,然后OpenPluginCapture函数内部调用系统的创建进程接口CreateProcess,从而可以创建一个插件加载进程,即PluginLoader进程。
接下来执行步骤S103,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接。
具体来说,RPC(Remote Procedure Call),即远程过程调用协议连接,是一种用于进程间通信的机制,通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议。RPC协议假定某些传输协议的存在,如TCP(Transmission Control Protocol传输控制协议)或UDP(User Datagram Protocol用户数据报协议),为通信程序之间携带信息数据。在具体的实施过程中,可以将直播软件主程序进程作为RPC服务器,插件加载进程作为RPC客户端,然后通过RPC机制,建立起两个进程间的通信通道。
接下来执行步骤S104,将所述目标插件加载至所述插件加载进程中。
具体来说,由于前述已经创建了插件加载进程,则可以通过插件加载进程来加载目标插件。
最后执行步骤S105,基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
具体来说,由于本发明提供的方法最终是为了将目标插件加载至直播软件中,更为具体地是直播软件对应的主程序进程中,因此,需要通过远程过程调用协议连接,使主程序进程实现对目标插件的加载。本发明申请人通过长期的实践发现,直接将插件加载到主程序进程的方法中,插件与主程序进程运行在同一个进程地址空间中,插件的运行情况直接影响到主程序进程的运行,然而 插件对运行环境的要求较高,如果运行环境不稳定,则容易出现崩溃,从而导致主程序进程的崩溃,故而上述加载方法存在稳定性较差的技术问题。本发明实施例为了解决上述稳定较差的技术问题,则采用了首先将目标插件加载至插件加载进程中,然后基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载的方法,由于不同的进程采用的内存地址空间不同,因而目标插件的内存地址空间与主程序进程的内存地址空间不同,从而目标插件与主程序进程可以独立运行,进而两者之间不会相互影响,故而可以提高用于在直播软件中加载插件的稳定性。
可选地,在所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,所述方法还包括:调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
所述调用所述目标插件,使所述主程序进程实现所述目标插件的功能,包括:
将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
基于所述路径,使所述主程序进程调用所述目标插件。
具体来说,本发明实施例中在直播软件中加载插件,是为了实现插件的功能,因此需要调用插件。在具体的实施过程中,由于目标插件不是直接加载到主程序进程中,因而主程序进程无法调用目标插件,因此需要通过远程过程调用协议连接来调用,具体地,可以通过将目标插件的功能函数注册到所述远程过程调用协议连接的路径中,然后通过上述路径时主程序进程调用所述目标插件。例如,可以通过调用RPC API的插件注册函数RpcRegisterProcedure将目标插件的功能函数进行注册,上述功能函数包括但不限于下述函数:插件打开函数Open、获取参数函数GetParameters、读取图像函数ReadVideo、读取音频函数ReadAudio、销毁函数Destroy等。
具体地,所述基于所述路径,使所述主程序进程调用所述目标插件包括:
基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
将所述目标插件的内容发送至所述主程序进程,使所述主程序进程实现对所述目标插件的调用。
在具体的实施过程中,如果目标插件的功能是获取音频,则需要通过RPC首先调用,然后调用获取参数函数GetParameters,然后调用读取音频函数ReadAudio,获取音频内容,然后通过RPC将音频的内容发送至主程序进程。
为了提高直播软件加载插件的性能,在所述将所述目标插件的内容发送至所述主程序进程,使所述主程序进程实现对所述目标插件的调用之前,所述方法还包括:
判断所述目标插件的内容是否包含图像信息;
若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程序进程之间创建共享内存;
若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主程序进程。
具体来说,由于通过RPC调用目标插件的插件功能函数后,需将RPC获取的插件内容发送至主程序进程中,但是如果插件内容包括图像信息,而图像信息的容量一般较大,则需要传送的字节量也非常大,从而影响直播软件加载插件的性能。因此,本发明实施例通过创建共享内存的方式来提高加载的性能,这样插件加载进程和主程序进程之间的数据传送可以通过共享内存来实现,减少了系统的代价,提高了插件加载的性能。
进一步地,若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后,所述方法还包括:
将所述目标插件的内容存储至所述共享内存中;
基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
在具体的实施过程中,如果插件内容包括图像信息,则在插件加载进程中,将插件的内容保存至共享内存中,具体而言,是将图像绘制到共享内存,插件加载进程可以在共享内存区域进行写操作,而主程序进程在该共享内存区域进行读操作。这样省去了数据通过RPC的传输过程,使得运行效率比较高效。具体来说,可以通过插件加载进程中通过调用系统的创建内存映射函数CreateFileMapping创建一个共享内存,并通过文件映射对象视图函数MapViewOfFile来获取共享内存中的数据。
具体来说,上述已经创建插件加载进程与主程序进程进行图像共享的共享内存区域,接下来详细介绍两个进程之间通过RPC的数据通信过程。当主程序进程需要调用获取图像函数ReadVideo时,首先主程序进程会调用RpcCallProcedure函数,并通过RpcCallProcedure函数调用插件加载进程PluginLoader的ReadVideo函数,此时主程序进程被阻塞,直到收到来自PluginLoader进程的完成消息时,才被唤醒。而PluginLoader将图像内容绘制完成后,将图像内容拷贝到共享内存区域中。然后插件加载进程调用RpcCompleteProcedureCall函数通知主程序进程ReadVideo函数操作完成,此时主程序进程被唤醒。主程序进程调用MapViewOfFile将共享内存中的图像内容进行显示。从而实现在独立于插件加载进程的直播软件主程序进程中实现插件的功能。
可选地,当要关闭某个插件时,可以通过RpcCallProcedure函数调用PluginLoader进程中的Destroy函数,从而使PluginLoader进程结束运行。
基于同一发明构思,本申请还提供了另一种用于在直播软件中加载插件的方法,详见实施例二。
实施例二
本实施例提供了一种用于在直播软件中加载插件的方法,请参见图2,该方法包括:
步骤S201:基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
步骤S202:通过所述主程序进程调用插件抓取函数,并通过所述插件抓取函数调用系统接口创建插件加载进程;
步骤S203:将所述插件加载进程作为协议连接的客户端,所述主进程作为协议连接的服务端,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
步骤S204:将所述目标插件加载至所述插件加载进程中;
步骤S205:基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
由于上述用于在直播软件中加载插件的方法的相关步骤在实施例一种已作出相关的解释与说明,故在此不再赘述。
基于同一发明构思,本申请还提供了与实施例一用于在直播软件中加载插件的方法对应的装置,详见实施例三。
实施例三
本实施例提供了一种用于在直播软件中加载插件的装置,请参见图3,该装置包括:
获取模块301,用于基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
创建模块302,用于创建插件加载进程;
连接模块303,用于在所述插件加载进程和与所述主程序进程之间建立远程过程调用协议连接;
第一加载模块304,用于将所述目标插件加载至所述插件加载进程中;
第二加载模块305,用于基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
本实施例提供的用于在直播软件中加载插件的装置中,还包括调用模块, 用于在所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,所述方法还包括:调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
基于所述路径,使所述主程序进程调用所述目标插件。
本实施例提供的用于在直播软件中加载插件的装置中,所述调用模块还用于:
基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用。
本实施例提供的用于在直播软件中加载插件的装置中,还包括判断模块,用于在所述将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用之前,
判断所述目标插件的内容是否包含图像信息;
若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程序进程之间创建共享内存;
若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主进程。
本实施例提供的用于在直播软件中加载插件的装置中,还包括处理模块,用于若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后:
将所述目标插件的内容存储至所述共享内存中;
基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
基于同一发明构思,本申请还提供了与实施例二用于在直播软件中加载插件的方法对应的装置,详见实施例四。
实施例四
本实施例提供了一种用于在直播软件中加载插件的装置,请参见图4,该装置包括:
获取模块401,用于基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
创建模块402,用于通过与所述主程序进程调用插件抓取函数,并通过所述插件抓取函数调用系统接口创建插件加载进程;
连接模块403,用于将所述插件加载进程作为协议连接的客户端,所述主 进程作为协议连接的服务端,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
第一加载模块404,用于将所述目标插件加载至所述插件加载进程中;
第二加载模块405,用于基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
基于同一发明构思,本申请还提供了与实施例一用于在直播软件中加载插件的方法对应的计算机可读介质,详见实施例五。
实施例五
请参见图5,本实施例提供了一种计算机可读存储介质500,其上存储有计算机程序511,该程序511被处理器执行时实现以下步骤:
基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
创建插件加载进程;
在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
将所述目标插件加载至所述插件加载进程中;
基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
可选的,上述计算机可读存储介质500在执行所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,还执行下述步骤:
调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
所述调用所述目标插件,使所述主程序进程实现所述目标插件的功能,包括:
将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
基于所述路径,使所述主程序进程调用所述目标插件。
可选的,上述计算机可读存储介质500还执行下述步骤:
基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用。
可选的,上述计算机可读存储介质500在执行所述将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用步骤之前,还执行下述步骤:
判断所述目标插件的内容是否包含图像信息;
若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程 序进程之间创建共享内存;
若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主进程。
可选的,上述计算机可读存储介质500在执行若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后,还执行下述步骤:
将所述目标插件的内容存储至所述共享内存中;
基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
基于同一发明构思,本申请还提供了与实施例一用于在直播软件中加载插件的方法对应的计算机设备,详见实施例六。
实施例六
请参见图6,本实施例提供了一种计算机设备,包括存储器601、处理器602及存储在存储器上并可在处理器上运行的计算机程序603,所述处理器602执行所述程序603时实现以下步骤:
基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
创建插件加载进程;
在所述插件加载进程和与所述主程序进程之间建立远程过程调用协议连接;
将所述目标插件加载至所述插件加载进程中;
基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
可选的,上述计算机设备在所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,还执行下述步骤:调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
所述调用所述目标插件,使所述主程序进程实现所述目标插件的功能,包括:
将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
基于所述路径,使所述主程序进程调用所述目标插件。
进一步的,上述计算机设备中,在所述处理器602执行基于所述路径,使所述主程序进程调用所述目标插件包括时,可以通过下述步骤实现:
基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标 插件的调用。
可选的,上述计算机设备在执行将所述目标插件的内容发送至所述主进程,使所述主进程实现对所述目标插件的调用之前,还执行下述步骤:
判断所述目标插件的内容是否包含图像信息;
若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程序进程之间创建共享内存;
若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主进程。
可选的,上述计算机设备,在执行若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后,还执行下述步骤:
将所述目标插件的内容存储至所述共享内存中;
基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。存储器601可用于存储计算机程序603,上述计算机程序包括软件程序、模块和数据,处理器602通过运行执行存储在存储器601的计算机程序603,从而执行计算机设备的各种功能应用以及数据处理。
在具体的实施过程中,存储器601可用于存储软件程序以及模块,处理器602通过运行存储在存储器601的软件程序以及模块,从而执行计算机设备的各种功能应用以及数据处理。存储器601可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据计算机设备的使用所创建的数据等。此外,存储器601可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。处理器602是计算机设备的控制中心,利用各种接口和线路连接整个计算机设备的各个部分,通过运行或执行存储在存储器601内的软件程序和/或模块,以及调用存储在存储器601内的数据,执行计算机设备的各种功能和处理数据,从而对计算机设备进行整体监控。可选的,处理器602可包括一个或多个处理单元;优选的,处理器602可集成应用处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等。
本申请实施例中提供的技术方案,至少具有如下技术效果或优点:
本发明实施例的方法,通过基于预设目录获取待加载至所述直播软件对应 的主程序进程中的目标插件,创建插件加载进程,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接,将所述目标插件加载至所述插件加载进程中,并基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。由于本发明的方法,获取的待加载至主程序进程中的目标插件不是直接加载到主程序进程中,而是加载到创建的插件加载进程中,并通过插件加载进程与主程序进程之间远程过程调用协议连接,来实现主程序进程对目标插件的加载,即目标插件是加载到插件加载进程中,而不是直接加载到主程序进程中,由于不同的进程采用的内存地址空间不同,因而目标插件的内存地址空间与主程序进程的内存地址空间不同,从而目标插件与主程序进程可以独立运行,进而两者之间不会相互影响,故而可以提高在主程序进程加载插件的稳定性,相对于现有技术直接将目标插件加载到主程序进程中而言,可以降低目标插件对主程序进程的影响,避免由于目标插件不稳定而导致的主程序进程崩溃,解决了现有技术中加载插件的方法存在稳定性较差的技术问题。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明实施例进行各种改动和变型而不脱离本发明实施例的精神和范围。这样,倘若本发明实施例的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (10)

  1. 一种用于在直播软件中加载插件的方法,其特征在于,包括:
    基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
    通过所述主程序进程调用插件抓取函数,并通过所述插件抓取函数调用系统接口创建插件加载进程;
    将所述插件加载进程作为协议连接的客户端,所述主程序进程作为协议连接的服务端,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
    将所述目标插件加载至所述插件加载进程中;
    基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
  2. 一种用于在直播软件中加载插件的方法,其特征在于,包括:
    基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
    创建插件加载进程;
    在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
    将所述目标插件加载至所述插件加载进程中;
    基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
  3. 如权利要求2所述的方法,其特征在于,在所述基于所述远程过程调用协议连接,实现所述主程序进程对加载至所述插件加载进程中的所述目标插件的加载之后,所述方法还包括:调用所述目标插件,使所述主程序进程实现所述目标插件的功能;
    所述调用所述目标插件,使所述主程序进程实现所述目标插件的功能,包括:
    将所述目标插件的功能函数注册到所述远程过程调用协议连接的路径中;
    基于所述路径,使所述主程序进程调用所述目标插件。
  4. 如权利要求3所述的方法,其特征在于,所述基于所述路径,使所述主程序进程调用所述目标插件包括:
    基于所述路径,调用所述目标插件的功能函数,获得所述目标插件的内容;
    将所述目标插件的内容发送至所述主程序进程,使所述主程序进程实现对所述目标插件的调用。
  5. 如权利要求4所述的方法,其特征在于,在所述将所述目标插件的内容 发送至所述主程序进程,使所述主程序进程实现对所述目标插件的调用之前,所述方法还包括:
    判断所述目标插件的内容是否包含图像信息;
    若所述目标插件的内容包含图像信息,则在所述插件加载进程和所述主程序进程之间创建共享内存;
    若所述目标插件的内容不包含图像信息,则将所述目标插件的内容发送至所述主程序进程。
  6. 如权利要求5所述的方法,其特征在于,若所述目标插件的内容包括图像信息,在所述在所述插件加载进程和所述主程序进程之间创建共享内存之后,所述方法还包括:
    将所述目标插件的内容存储至所述共享内存中;
    基于所述远程过程调用协议连接,使所述主程序读取所述共享内存中的目标插件的内容。
  7. 一种用于在直播软件中加载插件的装置,其特征在于,包括:
    获取模块,用于基于预设目录获取待加载至与所述直播软件对应的主程序进程中的目标插件;
    创建模块,用于通过与所述主程序进程调用插件抓取函数,并通过所述插件抓取函数调用系统接口创建插件加载进程;
    连接模块,用于将所述插件加载进程作为协议连接的客户端,所述主程序进程作为协议连接的服务端,在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
    第一加载模块,用于将所述目标插件加载至所述插件加载进程中;
    第二加载模块,用于基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
  8. 一种用于在直播软件中加载插件的装置,其特征在于,包括:
    获取模块,用于基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
    创建模块,用于创建插件加载进程;
    连接模块,用于在所述插件加载进程和与所述主程序进程之间建立远程过程调用协议连接;
    第一加载模块,用于将所述目标插件加载至所述插件加载进程中;
    第二加载模块,用于基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
  9. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该 程序被处理器执行时实现以下步骤:
    基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
    创建插件加载进程;
    在所述插件加载进程与所述主程序进程之间建立远程过程调用协议连接;
    将所述目标插件加载至所述插件加载进程中;
    基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
  10. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现以下步骤:
    基于预设目录获取待加载至所述直播软件对应的主程序进程中的目标插件;
    创建插件加载进程;
    在所述插件加载进程和与所述主程序进程之间建立远程过程调用协议连接;
    将所述目标插件加载至所述插件加载进程中;
    基于所述远程过程调用协议连接,使所述主程序进程实现对加载至所述插件加载进程中的所述目标插件的加载。
PCT/CN2018/082304 2017-06-30 2018-04-09 一种用于在直播软件中加载插件的方法及装置 WO2019001078A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710524053.7A CN107402782A (zh) 2017-06-30 2017-06-30 一种用于在直播软件中加载插件的方法及装置
CN201710524053.7 2017-06-30

Publications (1)

Publication Number Publication Date
WO2019001078A1 true WO2019001078A1 (zh) 2019-01-03

Family

ID=60405163

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/082304 WO2019001078A1 (zh) 2017-06-30 2018-04-09 一种用于在直播软件中加载插件的方法及装置

Country Status (2)

Country Link
CN (1) CN107402782A (zh)
WO (1) WO2019001078A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107402782A (zh) * 2017-06-30 2017-11-28 武汉斗鱼网络科技有限公司 一种用于在直播软件中加载插件的方法及装置
CN110851193A (zh) * 2018-08-01 2020-02-28 深圳市理邦精密仪器股份有限公司 监护设备软件平台插件加载方法、插件运行系统及监护仪
CN110708366A (zh) * 2019-09-24 2020-01-17 深圳市迅雷网络技术有限公司 一种插件进程的管理方法及相关方法和相关装置
CN111209056B (zh) * 2020-01-02 2021-02-19 北京东土科技股份有限公司 功能函数的加载方法、装置、可读存储介质及电子设备
CN113448582B (zh) * 2021-08-27 2021-12-07 统信软件技术有限公司 一种窗口显示方法、计算设备及存储介质
CN113778558A (zh) * 2021-09-15 2021-12-10 北京快来文化传播集团有限公司 基于插件的直播软件扩展方法、设备和存储介质
CN117076159B (zh) * 2023-10-10 2024-01-05 统信软件技术有限公司 插件调用方法及装置、电子设备、计算机可读存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060074975A1 (en) * 2003-07-11 2006-04-06 Computer Associates Think, Inc. System and method for common storage object model
CN102104628A (zh) * 2010-12-29 2011-06-22 北京新媒传信科技有限公司 一种服务器集群系统及其管理方法
CN102222213A (zh) * 2010-07-29 2011-10-19 郑文明 一种基于开放式Web Service架构的分布式视觉计算方法
CN102426537A (zh) * 2011-11-02 2012-04-25 北京数码大方科技有限公司 Cad中外部集成进程调用主程序进程的方法及装置
CN102436507A (zh) * 2011-12-28 2012-05-02 奇智软件(北京)有限公司 一种浏览网页的方法及装置
CN107402782A (zh) * 2017-06-30 2017-11-28 武汉斗鱼网络科技有限公司 一种用于在直播软件中加载插件的方法及装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081709B (zh) * 2009-12-01 2017-05-24 联想(北京)有限公司 一种浏览器插件的禁用方法、装置和终端

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060074975A1 (en) * 2003-07-11 2006-04-06 Computer Associates Think, Inc. System and method for common storage object model
CN102222213A (zh) * 2010-07-29 2011-10-19 郑文明 一种基于开放式Web Service架构的分布式视觉计算方法
CN102104628A (zh) * 2010-12-29 2011-06-22 北京新媒传信科技有限公司 一种服务器集群系统及其管理方法
CN102426537A (zh) * 2011-11-02 2012-04-25 北京数码大方科技有限公司 Cad中外部集成进程调用主程序进程的方法及装置
CN102436507A (zh) * 2011-12-28 2012-05-02 奇智软件(北京)有限公司 一种浏览网页的方法及装置
CN107402782A (zh) * 2017-06-30 2017-11-28 武汉斗鱼网络科技有限公司 一种用于在直播软件中加载插件的方法及装置

Also Published As

Publication number Publication date
CN107402782A (zh) 2017-11-28

Similar Documents

Publication Publication Date Title
WO2019001078A1 (zh) 一种用于在直播软件中加载插件的方法及装置
US8468541B2 (en) Event driven sendfile
WO2019228515A1 (zh) 一种远程过程调用协议自适应方法、相关装置及服务器
TWI486878B (zh) 用以經由處理程序間通訊共享資源之方法、裝置與電腦程式產品
US7269721B2 (en) Method, system, and apparatus for booting with remote configuration data
US8024469B1 (en) System and method for connecting network sockets between applications
US8112537B2 (en) Trickle sync protocol
JP2020530722A (ja) Pduタイプ設定方法、ueポリシー設定方法、および関連エンティティ
WO2016041322A1 (zh) 移动智能终端下转发应用内流量的方法
US8260934B2 (en) Multiplex transport
TW200843438A (en) Out-of-band keep-alive mechanism for clients associated with network address translation systems
US9088462B2 (en) Common web accessible data store for client side page processing
JP2015515660A (ja) ゲートウェイサーバ又はサービスを介してクラウドコンピューティングサービスストレージにアクセスする複数の媒体装置
KR102610823B1 (ko) 네트워크 어드레스 변환을 위한 통신 시스템 및 방법
WO2015062228A1 (zh) 一种访问共享内存的方法和装置
KR101903989B1 (ko) 범용 플러그 앤드 플레이(upnp) 디바이스의 디바이스 기능을 서비스 네트워크 엔티티와 공유하기 위한 방법 및 시스템
WO2020024978A1 (zh) 一种虚拟机迁移装置、方法、设备及可读存储介质
CN112511598A (zh) 一种投屏显示方法、智能终端、存储介质
CN116016667A (zh) 一种云原生平台多种类型注册中心统一治理方法和系统
US11392402B1 (en) Coordinated migration of network-accessible services while maintaining service availability in prior environment
CN110267077A (zh) 离线缓存方法、装置、终端及可读存储介质
US9438638B2 (en) Method for transparently connecting augmented network socket operations
WO2020119608A1 (zh) 基于Spark Shuffle的远程直接内存访问系统及方法
JP2022535949A (ja) モデルファイルのディストリビューション方法、プラットホーム、システム、端末及び可読記憶媒体
WO2017113302A1 (zh) 一种媒体服务代理的方法、设备及系统

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18824343

Country of ref document: EP

Kind code of ref document: A1