Detailed Description
The invention will be further described with reference to the accompanying figures 1-5.
A multi-terminal on-screen teaching system comprises a teacher terminal, a student terminal, an accelerator, a wireless AP, a large-screen display device and a background server, wherein the wireless AP is accessed to a campus local area network or a wide area internet in a wireless or wired mode, the teacher terminal, the student terminal and the wireless AP are in wireless connection, and the wireless AP and the accelerator are in wired connection;
the wired/wireless network combined mode can well solve the problem of bandwidth bottleneck of a video source sending end under a pure wireless network environment (due to the fact that the number of student terminals is large, if the teacher terminal directly carries out on-screen delivery, due to the fact that the teacher terminal has limited processing capacity and network bandwidth and other problems, low-delay and smooth on-screen playing cannot be achieved), and bandwidth liability capacity of a wired network is fully developed.
The background server is a local server or a cloud server of a network cloud and is used for storing lesson opening information uploaded by the teacher terminal, the lesson opening information comprises parameters including subjects, textbooks, chapters and accelerator IP, when the teacher terminal is started, the background server pushes the lesson opening information to the student terminal, and the student terminal automatically enters a classroom to connect with an accelerator according to the received lesson opening information;
the accelerator is used for the same-screen transmission and large-screen output of screen content and audio data between the teacher terminal and the student terminals, playing various files stored in the accelerator as an independent terminal, and transmitting the screen content and the audio data to the teacher terminal and the student terminals in the same screen.
Wherein, the teacher terminal comprises a screen projection part, a screen control part, a teacher terminal control module and an embedded file service module, the teacher terminal control module is respectively connected with the screen projection part, the screen control part and the embedded file service module for data transmission,
the screen projection part comprises a scanning module, a mouse simulator, a screen recording module, a frame frequency control module, a coding module, a disconnection reconnection module and a communication module;
the screen control part comprises a gesture detection module, a video playing module, a decoding module, a disconnection reconnection module and a communication module;
wherein, the student terminal comprises a screen control part, a student terminal control module and a file management module, the student terminal control module is respectively connected with the screen control part and the file management module for data transmission,
the screen control part comprises a gesture detection module, a video playing module, a decoding module, a disconnection reconnection module and a communication module;
wherein, the accelerator comprises a same-screen accelerator module, a file management module, a screen projection part and a screen split part, the same-screen accelerator module is respectively connected with the file management module, the screen projection part and the screen split part for data transmission,
the screen projection part comprises a mouse detection module, a video playing module, a decoding module and a communication module;
the split screen part comprises a two-dimensional code generation module, a mouse simulator, a screen recording module, a coding module, a flow control module and a communication module;
wherein, the accelerator is a smart device in a classroom, such as a computer or tablet.
The video transmission between each terminal and the accelerator is transmitted by adopting a dynamic block algorithm, the terminals comprise a teacher terminal and a student terminal, in the transmission process, only bitmap blocks where changed pixel points are located need to be transmitted, and the dynamic block algorithm comprises the following specific steps:
step 1, caching a bitmap of a previous scanning moment of a video by a terminal, intercepting a new bitmap at the current moment, establishing a rectangular coordinate system by taking the upper left corner of the bitmap as an origin, the line scanning direction as the positive direction of an X axis and the scanning line increasing direction as the positive direction of a Y axis;
step 2, starting from the origin, scanning along the positive direction of the X, Y axis, judging the scanning condition when the I-th line scanning is finished, if the I-th line finds a pixel change point, recording each pixel change point (P)Ix,PIy) If no pixel change point is found in the I-th line, entering a blocking stage and recording the line number If;
Step 3, passing the pixel change point (P)Ix,PIy) Determining the diagonal coordinates (R) of the transmission rectangleLx,RLy) And (R)Rx,RRy) Wherein, in the step (A),
RLx=MIN(P1x,P2x,...,PIx,...),
RLy=MIN(P1y,P2y,...,PIy,...),
RRx=MAX(P1x,P2x,...,PIx,...),
RLy=MAX(P1y,P2y,...,PIy,...)
wherein, MIN (), MAX () represent the minimum function and the maximum function, respectively;
step 4, after the selection of the transmission rectangle is finished, the I-th orderfStarting at line, starting scanning at N lines, and setting I as If+ N, returning to the step 2, generating a corresponding transmission rectangle, and when I is more than or equal to M, M is the whole row number of the bitmap, and the whole bitmap is scanned completely;
and 5, drawing a transmission rectangle at a designated position according to the diagonal coordinates, displaying a scanning moment buffer bitmap in other areas, rendering the received transmission rectangle to the designated area in the process of terminal display, and displaying the unchanged area at the same time as the last time.
The method can automatically judge the transmission rectangle according to the change area, greatly reduces the transmission data amount, reduces the requirements on network bandwidth and hardware resources, and ensures the real-time performance and the fluency of the same-screen transmission in the teaching process.
Wherein, the bottom layer communication among each terminal, the background server, the large-screen display device and the accelerator adopts an asynchronous input and output system, the communication protocol adopts a TCP protocol, the asynchronous input and output system comprises a channel, a buffer area, a selector and a forward shooting model,
the buffer is a data container, the buffer object is composed of an array for storing data and data read-write attributes, all data transmission is completed through the buffer, the buffer has four attributes for providing information about data elements contained in the buffer, and the attributes include:
capacity: a maximum number of data elements that the buffer can accommodate, the capacity being set at the time of buffer creation and not being able to be changed;
upper limit: the first element of the buffer that cannot be read or written represents a count of the existing elements in the buffer;
position: the index of the next element to be read or written, the position being automatically updated by the corresponding method;
marking: a memo position that is set by calling a mark;
the channel provides a direct connection with the I/O service for effectively transmitting data between the buffer and the file on the other side of the channel, the channel is bidirectional, and the channel can better reflect the real situation of the underlying system;
the selector is for maintaining a set of registered channels, a selection key inside of which encapsulates the registration relationship of a particular channel with a particular selector, the selection key being returned and providing indicia of the registration relationship, the selection key comprising two sets of bits indicating the channel operation of interest for the registration relationship and the operation for which the channel is ready, each selector object maintaining a set of three keys: a set of registered keys, a set of selected keys, a set of cancelled keys, a selector providing a ready selection, the ready selection and the multi-execution enabling a single thread to efficiently manage multiple channels simultaneously;
the proactive model is an asynchronous I/O model, in the proactive model, a terminal initiates I/O operation, an operating system copies network I/O data from a kernel cache region to a terminal region, and when an event separator monitors that I/O operation reading and writing are completed, a terminal thread is informed to process coding and decoding, so that the proactive model can better separate the I/O operation from service operation, and has higher performance.
The proactive model is composed of a processor, an interface and a thread pool,
wherein, the treater includes:
(1) a proactive initiator: the proactive initiator is any entity which initiates asynchronous operation in application, and registers an asynchronous channel which needs to execute asynchronous operation into an asynchronous operation processor, and the asynchronous operation processor calls back a method for completing the asynchronous operation processor after the operation is completed, so as to realize service logic processing;
(2) and a finishing processor: the completion processor interface is used for receiving the call of the asynchronous operation processor;
(3) an asynchronously operating processor: the asynchronous operation processor is responsible for managing a plurality of channels registered thereon, binding the thread pool, and initiating the next operation and issuing a completion notice according to the actual application condition.
Wherein the interface includes:
(1) the device comprises a proactive receiving interface, a monitoring server and an asynchronous operation processor, wherein the proactive receiving interface is used for binding a port, starting monitoring, receiving a request when a client initiates connection to a server, registering an interested operation of a client channel and simultaneously registering the asynchronous operation processor;
(2) the proactive connection interface forms an active connection interface of the client;
(3) the system comprises a proactive channel interface, a proactive receiving interface and a proactive channel interface, wherein the proactive channel interface provides an interface for an actual read-write channel in the network I/O, and the proactive receiving interface receives a connection request of a client and is used for read-write operation from a terminal to a server;
(4) the proactive processing interface manages the channels registered on the proactive processing interface, updates interest events, binds a thread pool and is used for task dispatch, and when I/O operation is completed, a corresponding method in the asynchronous operation processor is called back to be completed.
The asynchronous connection and read-write establishment of the asynchronous input and output system comprises the following steps:
step 1, a proactive initiator of a server monitors a port and registers a proactive group processing interface;
step 2, the terminal initiates a connection request, the proactive group processing interface initiates an asynchronous receiving operation to receive the request from the terminal, and after the receiving operation is completed, a receiving completion method in the completion processor is called;
step 3, initializing a proactive channel interface by the finishing processor, packaging an asynchronous channel entity containing all the attributes of the link by the proactive channel interface, and finishing the read-write operation of two ends of the link through the asynchronous channel entity;
step 4, the event which is interested in the event is registered on the proactive group processing interface by the proactive channel, and after the event is finished, the reading completion method in the completion processor is called back again to complete the processing of the service logic;
step 5, after the link is established, the corresponding proactive channel of the link registers an interested reading event to the proactive group processing interface;
step 6, the terminal sends data;
step 7, the proactive group processing interface monitors the readiness of the I/O event and calls a thread to execute the I/O reading operation;
step 8, after the I/O reading event is finished, the front-shot group processing interface calls a reading completion method of a completion processor to execute decoding, coding and service logic processing;
step 9, registering the interested events of the proactive channel again;
step 10, after the service logic processing is finished, bringing back data to be sent to the terminal to a finishing processor;
step 11, returning the data to the completion processor, and executing the writing operation of the proactive channel;
and step 12, after the proactive group processing interface monitors that the I/O write operation is finished, calling a write completion method of the completion processor, and executing the next logic.
The asynchronous input and output system reads and writes data in a block mode, one data block is consumed in each operation, the data is much faster than the read and write data of one byte, the asynchronous input and output system supports non-blocking I/O operation, and a single thread can effectively manage a plurality of I/O channels simultaneously.
The asynchronous input and output system ensures real-time performance, high concurrency and reliability of communication, and the accelerator is also provided with a flow control module which dynamically adjusts the frequency of sending data according to the load condition of each student terminal communication channel, thereby effectively inhibiting the problem of network congestion.
A multi-terminal one-screen teaching method adopting the system comprises the following steps:
step 1, starting an accelerator, entering a ready state, waiting for the connection between a teacher terminal and each student terminal and the accelerator,
after the accelerator is started, a two-dimensional code containing accelerator IP information is generated and displayed, two service ports (51666 and 51667) are fixedly monitored, connection between the teacher terminal and each student terminal is waited, and the teacher terminal enters a ready state.
The screen projection port (51666 port) is used for displaying screen projection contents of the teacher terminal, and the screen splitting port (51667 port) is used for sharing screen contents of the accelerator.
Step 2, the teacher terminal and each student terminal are connected with the accelerator,
the teacher terminal obtains accelerator IP information by scanning the two-dimensional code and then is connected to a screen projection port of the accelerator, meanwhile, the teacher terminal pushes lesson opening information containing the accelerator IP information to each student terminal through a background server (the teacher terminal and the student terminals can be communicated through other networks), the student terminals are automatically connected to a screen division port of the accelerator, the teacher terminal and each student terminal report terminal equipment information to the accelerator, and the accelerator is associated with a communication channel thereof according to the collected equipment information to establish session management.
The teacher terminal can inquire and manage the session information of the student terminals through the accelerator. The teacher terminal and the student terminals both comprise disconnection reconnection modules, and can be automatically reconnected when the disconnection condition occurs due to unstable network.
Step 3, the teacher terminal performs screen projection processing,
after the teacher terminal is connected to the accelerator, screen recording is started, and recorded contents comprise audio (including MIC and system sound) and video (screen content), wherein the audio is encoded by AAC, and the video is encoded by H264.
Because the frame frequency of the Android native screen is uncontrollable, when the frame dynamic rate is high, the maximum FPS (FramesPerSecond) can reach more than 40 frames, great pressure is caused on the bandwidth, and the requirement of real-time transmission and playing cannot be met, the teacher terminal uses SurfaceView (a view object on the surface layer in Android) as a secondary dump to realize effective frame frequency control, so that the frame frequency can be adjusted freely within the allowable range of hardware performance, the aim of improving the image quality and the fluency under the condition of the same bandwidth is fulfilled, and the recorded content is sent to an accelerator as screen projection content.
Wherein, the parameters related to the encoding and transmission of the frame rate are adjustable, such as code rate, frame rate and resolution.
Step 4, the accelerator displays screen projection processing and screen sharing processing,
after receiving screen projection content sent by the teacher terminal, the accelerator decodes the screen projection content and outputs the decoded screen projection content to a large-screen display device for display; on the other hand, the screen of the accelerator is recorded and encoded in the background (the encoding quality is low compared with that of the teacher terminal, and the encoding can be realized by setting parameters), and the screen is shared and sent to each student terminal.
The screen of the accelerator is recorded and recoded for sharing, rather than the screen projection content sent by the teacher terminal is decoded and recoded for sharing, in consideration of the classroom teaching scene, there is a scene that the desktop of the accelerator is displayed to the student terminal or even the teacher terminal (for example, exe is opened by a PC, teaching and assistance tools, etc.), and at this time, the screen of the accelerator needs to be recorded certainly. In order to avoid processing two actions (screen projection by the teacher end and screen projection by the accelerator), the actions are combined into a processing mode, namely screen recording is carried out on the accelerator.
Generally, as the number of student terminals is large, in order to realize low-delay on-screen display, the encoding parameters adopted by the accelerator terminal are different from the screen recording parameters of the teacher terminal, and if the code rate setting is relatively low. In practical application, in order to adapt to different teaching environments, the coding quality of the accelerator end screen can be determined by setting relevant parameters (code rate, frame rate and resolution) on the same-screen software. When the number of the student terminals is small, the coding quality higher than the number of the student terminals can be set by selecting the related parameters, and when the number of the student terminals is large, the coding quality lower than the number of the student terminals can be set by selecting the related parameters.
Step 5, each student terminal displays a sharing screen and answers the screen,
the student terminal decodes the video data and the audio data received in real time and then plays the video data and the audio data, and the playing of the video stream and the playing of the audio stream can be matched according to time characteristics, for example, a uniform timestamp is generated during recording;
in the process of on-screen, an accelerator detects the connection state of a teacher terminal and each student terminal and the accelerator through heartbeat in real time, when the student terminals are disconnected with the student terminals, inactive student terminal channels can be closed, resources occupied by the student terminals are released, the student terminals can also detect the connection state between the student terminals and the accelerator, when a disconnection condition occurs, the student terminals can close the student terminals, reconnection operation is initiated after a specified time interval until the connection is successful, after the reconnection is successful, the accelerator sends recently reserved key frame information to the student terminals, and then sequentially sends real-time coding information to the student terminals, so that the latest on-screen content can be acquired quickly after the student terminals are disconnected and recovered.
The teacher terminal controls the student terminals to open or close gesture detection through an extension instruction, after the teacher terminal puts in the large screen, students answer the large screen, and the answering process is directly put in the large screen to be displayed.
Specifically, instructions are mutually transmitted between the teacher terminal and the student terminals through the accelerator or without the accelerator, and the specific instructions can be expanded and added at any time according to business requirements.
For example: teacher sends a GestureDetectEnable instruction for appointed student, student terminal receives the instruction after, start gesture detection, the student does the painting brush action on student terminal screen, student terminal transmits student's operating instruction to teacher terminal through the accelerator, teacher terminal carries out the analog operation to student's operating instruction at teacher terminal again, student's action just like this, just draw on teacher's end's drawing board, what put in on the big screen at this moment is teacher's screen, when ending with the screen, after teacher terminal sends the instruction of ending with the screen to each student terminal, student terminal automatic disconnection and accelerator's communication session.
Step 6: the teacher's terminal embeds a file service,
the teacher terminal is embedded with file service, files on the local computer are shared to the accelerator and the student terminals, and the accelerator downloads the files on the teacher terminal through the file management module and then plays the local computer.
The courseware resources of teachers are various, the types of files supported by the mobile terminal are limited, and many times, files which cannot be played by the mobile terminal can be downloaded by the accelerator and then played and displayed, so that the compatibility of the whole system to various files is greatly improved.
And 7: the teacher terminal performs a screen manipulation process,
the teacher terminal can also be used as a terminal for sharing the screen by the accelerator, is connected to a screen splitting port (51667) of the accelerator, starts a gesture detection function, plays a picture of a large screen of the accelerator on the teacher terminal at the moment, and can perform remote operation on the large screen by clicking and double-clicking gestures, such as file opening, video playing and the like.
The above-described embodiment merely represents one embodiment of the present invention, but is not to be construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.