# Patent

## Title
Using double buffering for screen sharing

## Abstract

Remote desktop sharing allows a user to access applications and data on a remote computer over a network. An intermediary computer can communicate with a host computer and one or more client computers to facilitate remote desktop sharing. The host can send the intermediary computer an encoded key frame and encoded updates. The intermediary computer can decode the host screen data, and apply subsequent updates to the decoded image so that the intermediary computer has a near live host screen image in a first buffer. A second buffer on the intermediary computer can store an instance of a screen encoder for each client computer that has joined the session and the most current host image that the client computer has. The encoder compares the near live screen image and the stored client computer host image to create an encoded differential screen image update to pass to the client computer.

## Background
BACKGROUND
Remote desktop sharing allows a user to access applications and data on a remote computer over a network. For example, Microsoft® Remote Desktop is a model where one computer “takes control” of a second computer by viewing its desktop session and acting as master for keyboard and mouse input. Similarly, remote meeting software enables a user to meet with other computer users, customers, clients or colleagues via a network such as the Internet in real-time. Networks like the Internet are unpredictable. Heavy traffic on the network can lead to variations in upload and download speeds. Differing network connectivity bandwidth and processing speed of computers connected to the network can also lead to delays in data transmission. Delays in data transmission can result in the client seeing outdated host information.
SUMMARY
In screen sharing, a host computer can connect to an intermediary computer and request the intermediary computer to create a session on the intermediary computer for screen sharing applications with one or more client computers. The host computer can send a current screen image to the intermediary computer. The intermediary computer can store the screen image in a first buffer. One or more client computers can join the session on the intermediary computer. A new instance of a screen encoder can be created on the intermediary computer for each screen sharing client computer in a second buffer. The second buffer can also include the most current version of the host screen image that the client computer has received. The screen encoder uses a near live screen image of the host computer and the contents of the second buffer to create an encoded differential update image data stream to be passed to the client computer.
Because encoding is done on the intermediary computer so that updates are not stored on the intermediary computer, a constant amount of memory can be allocated on the intermediary computer. Because client computer screens are updated using the near live screen image of the host, the amount of bandwidth needed by the client computer can be reduced. Double buffering or a combination of double buffering and maintaining a FIFO (first-in-first-out) queue can be used to implement screen sharing using an intermediary computer.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.



BRIEF DESCRIPTION OF THE DRAWINGS
In the drawings:
FIG. 1a illustrates an example of a system 100 that implements desktop screen sharing in accordance with aspects of the subject matter disclosed herein;
FIG. 1b illustrates an example of a system 100a that implements desktop screen sharing using a FIFO queue in accordance with aspects of the subject matter disclosed herein;
FIG. 1c illustrates an example of a system 100b that implements desktop screen sharing using double buffering in accordance with aspects of the subject matter disclosed herein;
FIG. 1d illustrates an example of a system 100c that implements desktop screen sharing using a FIFO queue and double buffering in accordance with aspects of the subject matter disclosed herein;
FIG. 2 is a flow diagram of an example of a method 200 for desktop screen sharing using double buffering in accordance with aspects of the subject matter disclosed herein; and
FIG. 3 is a block diagram illustrating an example of a computing environment in which aspects of the subject matter disclosed herein may be implemented.



DETAILED DESCRIPTION
Overview
In screen sharing applications including support and maintenance applications, web conferencing and so on, a user has to share his computer screen with a support engineer, or with colleagues and/or other users. Screen sharing can involve a host computer program running on the user computer (host computer), and a client computer program running on the support engineer's computer or other users' computers (client computers). The host computer and the client computers are connected to a network such as a LAN, WAN or the Internet. The computers typically are protected by one or more firewalls. A firewall secures a computer from attacks from an outside network such as the Internet by blocking inbound connections to the protected computer. A firewall allows access to connections that are outbound, for example, from the protected computer to the Internet.
If the host computer is protected by a firewall, an attempt by the client computer to connect to the host computer will be prevented by the firewall because it is an inbound connection. To overcome this limitation and to bypass network security, establishing a connection between the client computer and the host computer can be accomplished indirectly using a third computer as an intermediary between the client computer and the host computer.
In one approach the host computer first sends a snapshot of its entire screen image. This snapshot is called the key frame. After the initial snapshot is sent, a differential screen encoder subsequently sends only the changed parts of the screen image, which have been encoded. Sending only the changed parts of the screen images in an encoded form typically reduces the memory and bandwidth needed to transmit animated screens. One such encoder is a Titanium encoder by Microsoft Research but there are many encoders known in the art. Thus, changed portions of the screen are encoded by the encoder and are sent to the intermediary computer periodically. The intermediary computer can store the encoded screen image updates in a FIFO (first-in-first-out) queue in memory until a client computer requests an update. The client computer receives the updates in the order in which the server received the updates from the host computer and replays them on the client computer.
While this process can sometimes work well, when the network is slow, computer hardware limitations exist or for other reasons, the flow of the encoded information from the host computer to the client computer can slow down. For example, when the client computer is slower than the host computer, the queue on the intermediary computer may grow in size, exhausting or depleting the memory of the intermediary computer. One possible solution is to slow down the sending of updates from the host computer or to request the host computer to send key frames so that intermediate frames can be discarded. Because a key frame includes the content of the entire screen, a key frame is typically bigger and therefore more resource-expensive to transmit over the network. Thus, sending key frames can also slow down a client computer.
Slowing down the update interval on the host computer may not work as expected if the polling interval is miscalculated or if the speed of the client computer fluctuates. Also, if there are multiple clients with different network speeds and different hardware, all the client computers will be slowed down by the client computer with the slowest speed.
In accordance with aspects of the subject matter disclosed herein, a double buffering approach is described in which a host computer's screen image is recreated on the intermediary computer for the session. When encoded data (e.g., key frame data and screen image update data) is passed to the intermediary computer, the intermediary computer can decode the data into its original format and can store the initial key frame received from the host computer in a buffer in memory and can apply the screen image updates to the stored host screen image. As a result, the server has a “near live” screen image of the host computer at all times.
When a client computer joins the screen sharing session, the intermediary computer can create an instance of a screen encoder for the client computer. The screen encoder and the latest version of the screen image that the client computer has can be stored in a second buffer on the intermediary computer. An instance of a screen encoder can be created on the intermediary computer for each client computer that joins the session and a copy of the latest version of the host screen image can be stored in the second buffer for each client computer. When a client computer requests an update, the encoder compares the near live screen image of the host computer in the first buffer with the last version of the host screen image stored in the second buffer for the client computer to create an encoded screen image update to send to the client computer.
Thus, each client computer can work independently with the intermediary computer, requesting screen updates from the intermediary computer as often or as infrequently as it wants, and at its own speed, without holding up any of the other client computers. Moreover, when a client computer connects to the session, the client computer receives a near real-time image of the host computer instead of an initial key frame and all the updates which have to be transmitted over the network, decoded and the updates replayed on the client computer. The FIFO queue that in other approaches stores screen image updates is unnecessary. The amount of memory on the intermediary computer consumed by each client computer is fixed or constant. It does not grow and shrink with the size of the FIFO queue. The approach described above works well for times when network speed is fluctuating and/or when there are multiple client computers that have different network bandwidth and hardware processing speed capabilities. The delay in showing the host computer screen image on the intermediary computer is reduced to the delay that is caused by network latency.
While the approach described above is typically advantageous when the client computer is slower that the host computer, it is possible that it can consume more resources of the intermediary computer, for example, when all the client computers are faster than the host computer or when the speed of the host computer and client computers match. In such an event, a hybrid approach that uses both the FIFO queue and the double buffering approach can be applied or a dynamic algorithm can drive switching between approaches as described more fully below.
Desktop Screen Sharing Using Double Buffering
FIG. 1a illustrates an example of a system 100 for desktop screen sharing in accordance with aspects of the subject matter disclosed herein. All or portions of system 100 may reside on one or more computers such as the computers described below with respect to FIG. 3. System 100 or portions thereof may be provided as a stand-alone system or as a plug-in or add-in.
The computer on which system 100 executes can be an intermediary computer 102 between a host computer 110 and one or more client computers such as client computer 1 112, client computer 2 113, etc. The intermediary computer 102 can be a web server computer or a proxy server or a gateway. If intermediary computer 102 is a web server, intermediary computer 102 lacks software and lacks hardware that bypasses firewall or shared IP limitations that is present on a proxy server or gateway. Intermediary computer 102 may act as an intermediary to enable one computer to “take control” of a second computer by enabling the first computer (a computer on which a client program is running) to view the desktop session of the second computer (a host computer on which a host program is running) and enable the first computer to act as master for input device input (e.g., keyboard input, mouse input, stylus input, etc.) for the second computer. Intermediary computer 102 can be an intermediary computer for web conferencing or application sharing between a host computer 110 and a plurality of client computers such as client computer 1 112, client computer 2 113, etc.
The intermediary computer 102 can include one or more of: a processor (such as processor 142), a memory 144, and one or more modules for desktop screen sharing 104. Other components well known in the art may also be included but are not here shown. It will be appreciated that one or more modules for desktop screen sharing 104 can be loaded into memory 144 to cause one or more processors such as processor 142 to perform the actions attributed to the one or more modules for desktop screen sharing. System 100 can also include one or more of the following: a screen sharing session 106 and a cache 108.
In accordance with aspects of the subject matter disclosed herein, the host computer 110 can connect to an intermediary computer 102 and request the intermediary computer 102 to create a new session such as screen sharing session 106. If the intermediary computer 102 is a web server, the host computer 110 can connect to the web server and request the web server to create a new session such as screen sharing session 106 using secure (HTTPS) and non-secure (HTTP) communications using an HTTP GET or POST command. The web server can receive the communication from the host computer 110 and in response can establish the requested session (e.g., screen sharing session 106) and can return a session-specific identifier for the session to the host computer 110 via an HTTP GET or POST command.
As the web server may have sessions for a number of different users, a session-specific identifier can provide a mechanism to identify the session for this particular host (and any client computers that may join the session). The host computer 110 can use a codec such as but not limited to a screen codec such as Microsoft® Titanium Codec, an audio codec such as Direct Stream Digital, Free Lossless Audio Codec, etc., a text codec such as BiM, Continuous Media Markup Language, etc., a video codec such as Alpary or Blackbird, or any lossy or lossless codec, whether now known or developed in the future. In accordance with aspects of the subject matter disclosed herein, the codec can be used to send encoded screen images and encoded screen image updates to the intermediary computer 102.
A codec is a device or computer program capable of encoding and/or decoding a digital data stream or signal or other data stream or signal. A codec encodes a data stream or signal for transmission, storage or encryption, or decodes it for playback or editing. Codecs can be used in videoconferencing and streaming media applications. For example, a video camera's analog-to-digital converter (ADC) can convert an analog camera's analog signals into digital signals. The digital signals can then be passed through a video compressor for digital transmission or storage. A receiving device can run the signal through a video decompressor and then through a digital-to-analog converter (DAC) for analog display.
In accordance with aspects of aspects of the subject matter disclosed herein, the host computer 110 can use the codec to post an initial encoded screen image and/or differential encoded screen image updates to the web server using an HTTP GET or POST command. Posting of the images can occur at regular (constant) intervals or at variable intervals. Each screen image update can be time stamped for replay in time sequence on the client computer 1 112. The web server can cache screen image and screen image updates in memory as a first-in-first-out (FIFO) list (e.g., in cache 108). The web server can instruct the host computer 110 to change its screen image update intervals or screen resolution.
One or more clients computers such as client computer 1 112, client computer 2 113, etc. can connect to the web server and request to join the screen sharing session 106 identified by the session-specific identifier using an HTTP GET or POST command. The client computers, client computer 1 112, client computer 2 113, etc., can specify the session-specific identifier of the screen sharing session 106 or session management software as known in the art can manage the session initiation between the host computer 110 and the client computers. The client computers, client computer 1 112, client computer 2 113, etc., can request a latest or current screen image from the web server for the screen sharing session 106 identified by the session-specific identifier ID using an HTTP GET or POST command. The client computers, (e.g., client computer 1 112) can also send any user device input events that originated at the client computer 1 112 to the web server using an HTTP GET or POST command.
The web server can keep track of the screen images and screen image updates that were transferred from web server to the client computers and can send only updated screen image data to the client computers using one or more HTTP GET or POST commands. The screen image data sent to the client computer 1 112 can optionally be sent from storage in the FIFO list cache 108. The web server can send all the updated screen image data as one package or can send the updated screen image data in multiple packages. The screens can be sent as a JSON object or in any other way. The client computer 1 112 can process the screen updates received from the web server. The described process can be continued until the screen sharing session 106 is closed. The described process can be used to allow the client computer 1 112 to take control of the host computer 110 and to enable the client computer 1 112 to act as the master of host computer 110 for keyboard and mouse input. The screen sharing session 106 can be closed by the host computer 110 or by the client computer 1 112 or by the web server 102. The described process can be used to allow a group of computers (e.g., client computer 1 112, client computer 2 113, etc.) to collaborate in a screen sharing or application sharing session such as web conferencing with the host computer 110.
The interval of posting screen updates can be varied by the web server depending on the number of screen update packets in the FIFO list waiting to be sent to the client computers using an HTTP GET or POST command. For example, a client computer that is slower that the host computer may cause the FIFO list in cache 108 to become larger than desired. In response the web server can tell the host computer 110 to slow down its update interval (e.g., increase the time interval between updates). Similarly, if the FIFO list in cache 108 becomes very small, either in size or in number of updates, the web server may tell the host computer 110 to increase the speed of the update interval (i.e., decrease the update interval so that more updates are made within a given time period). A formula that determines update interval can be a linear equation where the length of interval is directly proportional to the size or number of pending items in FIFO list.
Alternatively, intermediary computer 102 can be a proxy server or gateway and updates can be applied to the client computers as described with respect to FIG. 1b. 
FIG. 1b illustrates an example of a system 100a for desktop screen sharing in accordance with aspects of the subject matter disclosed herein. All or portions of system 100a may reside on one or more computers such as the computers described below with respect to FIG. 3. System 100a or portions thereof may be provided as a stand-alone system or as a plug-in or add-in.
The computer on which system 100a executes can be an intermediary computer such as intermediary computer 102a between a host computer 110a and one or more client computers such as client computers 1 112a, client computer 2 113a, etc. The intermediary computer 102a can be a web server computer or a proxy server or a gateway as described above with respect to FIG. 1a. 
The intermediary computer 102a can include one or more of: a processor (such as processor 142), a memory such as memory 144, and one or more modules for remote desktop screen sharing using a FIFO queue 104a. Other components well known in the art may also be included but are not here shown. It will be appreciated that one or more modules for remote desktop screen sharing using a FIFO queue 104a can be loaded into memory 144 to cause one or more processors such as processor 142 to perform the actions attributed to one or more modules for remote desktop screen sharing using a FIFO queue 104a. System 100a can also include one or more of the following: a screen sharing session 106a and a cache such as FIFO cache 108a. Host computer 110a may include an encoder 114a to encode data sent to the intermediary computer 102a. Client computers can include a decoder, such as decoder 1 116 on client computer 1 112a and decoder 2 117 on client computer 2 113a to decode encoded data received from intermediary computer 102a. 
In accordance with aspects of the subject matter disclosed herein, the host computer 110a can connect to an intermediary computer 102a and request the intermediary computer 102a to create a new screen sharing session such as screen sharing session 106a. In response intermediary computer 102a can create a screen sharing session 106a and can create a cache such as FIFO cache 108a. The host computer 110a can first send a snapshot of the host's entire screen called the key frame to the intermediary computer 102a. 
The intermediary computer 102a can store the key frame in FIFO cache 108a, e.g., illustrated in FIG. 1b by the key frame 120a of FIFO cache 108a. The key frame can also be retained in the memory of the encoder 114a of the host computer 110a. Changed portions of the screen can be encoded by the encoder 114a and can be sent to the intermediary computer 102a periodically. The intermediary computer 102a can store the encoded differential screen image updates in the FIFO cache 108a in memory until requested by one or more client computers. The encoded differential screen image updates stored in the FIFO cache 108a are illustrated in FIG. 1b by update 1 121a, update 2 122a, update 3 123a, etc. to update N 124a. Although only one session, screen sharing session 106a, is illustrated in FIG. 1b, it will be appreciated that intermediary computer 102a, can establish a number of sessions (not shown) for a number of groups of computers (not shown), assigning session-specific identifiers to different sessions associated with different groups of computers.
A plurality of computers, such as client computer 1 112a, client computer 2 113a, etc., can request to join the session (e.g., screen sharing session 106a) associated with the host computer 110a. In response, the intermediary computer 102a can send each client computer the initial key frame (key frame 120a) followed by the updates in the order in which the intermediary computer 102a received the updates from the host computer 110a. Thus, at any point in time, each client computer that has joined the screen sharing session 106a may have received, decoded and applied a different number of updates, illustrated in FIG. 1b by client computer 1 112a having a pointer 131a to update N 124a and client computer 2 113a having a pointer 132a to update 1 121a. Pointers can be maintained by the intermediary computer 102a or by the client computers attached to the session.
FIG. 1c illustrates an example of a system 100b for desktop screen sharing using double buffering in accordance with aspects of the subject matter disclosed herein. All or portions of system 100b may reside on one or more computers such as the computers described below with respect to FIG. 3. System 100b or portions thereof may be provided as a stand-alone system or as a plug-in or add-in.
The computer on which system 100b executes can be an intermediary computer 102b between a host computer 110b and one or more client computers such as client computer 1 112b, client computer 2 113b, etc. The intermediary computer 102b can be a web server computer or a proxy server or a gateway as described above with respect to FIG. 1a. 
The intermediary computer 102b can include one or more of: a processor (such as processor 142), a memory 144, one or more modules for desktop screen sharing using double buffering 104b. Other components well known in the art may also be included but are not here shown. It will be appreciated that one or more modules for desktop screen sharing using double buffering 104b can be loaded into memory 144 to cause one or more processors such as processor 142 to perform the actions attributed to one or more modules for desktop screen sharing using double buffering 104b. System 100b can also include one or more of the following: a screen sharing session 106b and a first and second buffer represented by buffer 1 140b and buffer 2 142b. Host computer 110b may include an encoder 114b to encode data sent to the intermediary computer 102b. Client computers can include a decoder, such as decoder 1 116b on client computer 1 112b and decoder 2 117b on client computer 2 113b to decode encoded data received from intermediary computer 102b. 
In accordance with aspects of the subject matter disclosed herein, a double buffering approach is described in which a host computer's screen image is recreated on the intermediary computer 102b for the screen sharing session 106b. When encoded screen image update data is received by the intermediary computer 102b, the intermediary computer 102b decodes the update and applies it to the host screen image in memory. As a result, the intermediary computer 102b has an image that is very close to the live screen image of the host computer at all times as described more fully below.
In accordance with aspects of the subject matter disclosed herein, the host computer 110b can connect to an intermediary computer 102b and request the intermediary computer 102b to create a new session such as screen sharing session 106b. In response intermediary computer 102b can create the screen sharing session 106b and create a first buffer, e.g., buffer 1 140b for storing a recreated current image, e.g., image 0 121b for host computer 110b. Buffer 1 140b can also include a decoder such as decoder 0 119b for decoding encoded information received from the host computer 110b. For example, the host computer 110b can passed encoded data representing a key frame to intermediary computer 102b. The intermediary computer 102b can decode the encoded data into its original bitmap format using decoder 0 119b and store the image, e.g., image 0 121b. When encoded data representing an update to the host screen image in memory is received by the intermediary computer 102b, the update can be decoded by decoder 0 119b and applied to the host screen image in memory (image 0 121b) in buffer 140b. As a result, the intermediary computer 102b has a near live screen image of the host computer.
A second buffer, e.g., buffer 2 142b can be created in the memory 144 of intermediary computer 102b. An instance of a screen encoder can be created in buffer 2 142b on the intermediary computer 102b for each client computer that has joined screen sharing screen sharing session 106b. For example, encoder 1 144b can be created in buffer 2 142b on intermediate computer 102b for client computer 1 112b and encoder 2 145b, etc., can be created in buffer 2 142b on intermediate computer 102b for client computer 2 113b, and so on for each client computer that joins screen sharing session 106b. The encoders (e.g., encoder 1 144b, encoder 2 145b, etc.) can use the near live screen image of the host screen, image 121b and a copy of the latest version of the host screen image that the client computer has to create an encoded data stream to be passed to the client computers. For example, encoder 1 144b can create an encoded differential screen update by comparing image 1 130b with image 0 121b for client computer 1 112b when client computer 1 112b connects to the intermediary computer 102b and requests an update and can send the encoded differential screen image to client computer 1 112b. Image 1 130b is then set to image 0 121b. Similarly, encoder 2 145b can create an encoded differential screen update by comparing image 2 131b with image 0 121b for client computer 2 113b when client computer 2 113b connects to the intermediary computer 102b and requests an update and can send the encoded differential screen image to client computer 2 113b. Image 2 131b is then set to image 0 121b. 
Each client computer connected to the session thus can work independently with the intermediary computer 102b at its own speed. As a result, when a client computer connects to the session, the client computer receives a near real-time image of the host computer; each client can request screen updates from the server as often or as infrequently as it wants. A FIFO queue that stores screen image updates on the intermediary computer is unnecessary. The amount of memory used by the first buffer on the intermediary computer is fixed or constant. The amount of memory on the intermediary computer consumed by each client computer is fixed or constant, the total amount of memory on the intermediary computer consumed by all the client computers being proportional to the number of client computers joined to the screen sharing session. The approach described above works well for times when network speed fluctuates and when there are multiple clients that have different network bandwidth and hardware speed. The delay of showing the host screen on the client screen can potentially be reduced to the amount of delay caused by network latencies.
FIG. 1d illustrates an example of a system 100c for desktop screen sharing using both a FIFO queue 108b as described with respect to FIG. 1b and double buffering as described with respect to FIG. 1c in accordance with aspects of the subject matter disclosed herein. The intermediary computer 102c may utilize a dynamic algorithm to switch between using the FIFO queue 108b and the double buffering approach using buffer 1 140b and buffer 2 142b. For example, triggered by some specified factor or combination of factors all the client computers can be switched from using the double buffers to using the FIFO queue, or vice versa. Alternatively, or additionally, one group of client computers can be assigned to the FIFO approach and another group of client computers can be assigned to the double buffering approach. For example, client computers that exceed a processing power threshold (e.g., client computer 2 113b) can be set to use the FIFO queue 108b and all other client computers (e.g., client computer 1 112b) can be set to use the double buffering approach. The performance of the overall system can be monitored and adjusted according to dynamic algorithmic techniques based on the amount of memory usage of the intermediary computer 102c, by the amount of cpu usage and so on.
FIG. 2 is an example of a method 200 for sharing a desktop screen using the double buffering approach described above or a combination of double buffering and a FIFO queue in accordance with aspects of the subject matter disclosed herein. FIG. 2 or portions thereof can describe systems as described with respect to FIGS. 1a-d above. The actions described below can occur in sequences other than those depicted by FIG. 2, as will be appreciated by those of skill in the art. Some of the actions depicted in FIG. 2 may be optional or may be omitted. At 202 an intermediary computer can receive a communication from a host computer requesting a screen sharing session. At 204 the intermediary computer can establish a screen sharing session for the host computer. The intermediary computer may generate a session-specific identifier for the session established for the host computer and may send the session-specific identifier to the host computer.
At 206 the intermediary computer can establish a first buffer for storing a decoder and for storing a copy of the most current screen image the intermediary computer has for the host computer. At 208, the intermediary computer can receive an encoded screen image, such as the initial key frame, a subsequent key frame or an encoded differential screen image update from the host computer. At 210 if the encoded screen information received by the intermediary computer represents a key frame, the intermediary computer can decode the key frame and store the decoded screen image in the first buffer. If the encoded screen information represents a differential screen image update, the intermediary computer can decode the differential screen image update and apply it to the stored decoded screen image in the first buffer.
At 212 a request to join the session can be received by the intermediary computer from one or more client computers. At 214 the intermediary computer can create an instance of an encoder for each client computer that joins the session. The intermediary computer can establish a second buffer to store the decoder and a screen image for each client computer that joins the session. At 216 in response to receiving a request for an update from a client computer, the intermediary computer can compare the latest screen image for the client computer stored in the second buffer and the screen image for the screen sharing session in the first buffer and can send an encoded differential screen image update to the client computer.
Optionally, at 218, triggered by some factor or factors or condition or conditions, a FIFO queue for storing encoded differential screen image updates can be created by the intermediary computer. At 220 a group of client computers can be assigned to perform screen sharing using the FIFO queue while another group of client computers can be set to perform screen sharing using double buffering, as described more fully above. Alternatively, at 222 triggered by some monitored condition or conditions, the mode for screen sharing for all client computers can be switched to FIFO mode and at 224, triggered by some monitored condition or conditions, the mode for screen sharing for all client computers can be switched back to double buffering mode. This process can continue until the screen sharing session is closed.
Example of a Suitable Computing Environment
In order to provide context for various aspects of the subject matter disclosed herein, FIG. 3 and the following discussion are intended to provide a brief general description of a suitable computing environment 510 in which various embodiments may be implemented. While the subject matter disclosed herein is described in the general context of computer-executable instructions, such as program modules, executed by one or more computers or other computing devices, those skilled in the art will recognize that portions of the subject matter disclosed herein can also be implemented in combination with other program modules and/or a combination of hardware and software. Generally, program modules include routines, programs, objects, physical artifacts, data structures, etc. that perform particular tasks or implement particular data types. Typically, the functionality of the program modules may be combined or distributed as desired in various embodiments. The computing environment 510 is only one example of a suitable operating environment and is not intended to limit the scope of use or functionality of the subject matter disclosed herein.
With reference to FIG. 3, a computing device for efficient resumption of co-routines on a linear stack in the form of a computer 512 is described. Computer 512 may include a processing unit 514, a system memory 516, and a system bus 518. The processing unit 514 can be any of various available processors. Dual microprocessors and other multiprocessor architectures also can be employed as the processing unit 514. The system memory 516 may include volatile memory 520 and nonvolatile memory 522. Nonvolatile memory 522 can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM) or flash memory. Volatile memory 520 may include random access memory (RAM) which may act as external cache memory. The system bus 518 couples system physical artifacts including the system memory 516 to the processing unit 514. The system bus 518 can be any of several types including a memory bus, memory controller, peripheral bus, external bus, or local bus and may use any variety of available bus architectures.
Computer 512 typically includes a variety of computer readable media such as volatile and nonvolatile media, removable and non-removable media. Computer storage media may be implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CDROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other transitory or non-transitory medium which can be used to store the desired information and which can be accessed by computer 512.
It will be appreciated that FIG. 3 describes software that can act as an intermediary between users and computer resources. This software may include an operating system 528 which can be stored on disk storage 524, and which can control and allocate resources of the computer system 512. Disk storage 524 may be a hard disk drive connected to the system bus 518 through a non-removable memory interface such as interface 526. System applications 530 take advantage of the management of resources by operating system 528 through program modules 532 and program data 534 stored either in system memory 516 or on disk storage 524. It will be appreciated that computers can be implemented with various operating systems or combinations of operating systems.
A user can enter commands or information into the computer 512 through an input device(s) 536. Input devices 536 include but are not limited to a pointing device such as a mouse, trackball, stylus, touch pad, keyboard, microphone, and the like. These and other input devices connect to the processing unit 514 through the system bus 518 via interface port(s) 538. An interface port(s) 538 may represent a serial port, parallel port, universal serial bus (USB) and the like. Output devices(s) 540 may use the same type of ports as do the input devices. Output adapter 542 is provided to illustrate that there are some output devices 540 like monitors, speakers and printers that require particular adapters. Output adapters 542 include but are not limited to video and sound cards that provide a connection between the output device 540 and the system bus 518. Other devices and/or systems or devices such as remote computer(s) 544 may provide both input and output capabilities.
Computer 512 can operate in a networked environment using logical connections to one or more remote computers, such as a remote computer(s) 544. The remote computer 544 can be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 512, although only a memory storage device 546 has been illustrated in FIG. 4. Remote computer(s) 544 can be logically connected via communication connection 550. Network interface 548 encompasses communication networks such as local area networks (LANs) and wide area networks (WANs) but may also include other networks. Communication connection(s) 550 refers to the hardware/software employed to connect the network interface 548 to the bus 518. Connection 550 may be internal to or external to computer 512 and include internal and external technologies such as modems (telephone, cable, DSL and wireless) and ISDN adapters, Ethernet cards and so on.
It will be appreciated that the network connections shown are examples only and other means of establishing a communications link between the computers may be used. One of ordinary skill in the art can appreciate that a computer 512 or other client device can be deployed as part of a computer network. In this regard, the subject matter disclosed herein may pertain to any computer system having any number of memory or storage units, and any number of applications and processes occurring across any number of storage units or volumes. Aspects of the subject matter disclosed herein may apply to an environment with server computers and client computers deployed in a network environment, having remote or local storage. Aspects of the subject matter disclosed herein may also apply to a standalone computing device, having programming language functionality, interpretation and execution capabilities.
The various techniques described herein may be implemented in connection with hardware or software or, where appropriate, with a combination of both. Thus, the methods and apparatus described herein, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing aspects of the subject matter disclosed herein. In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. One or more programs that may utilize the creation and/or implementation of domain-specific programming models aspects, e.g., through the use of a data processing API or the like, may be implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language, and combined with hardware implementations.
While the subject matter disclosed herein has been described in connection with the figures, it is to be understood that modifications may be made to perform the same functions in different ways.

## Claims

1. A method, comprising:
receiving, at an intermediate computer, a session request from a host computer to initiate a screen sharing session;
in response to receiving the session request, establishing the requested screen sharing session on the intermediary computer;
receiving an encoded key frame from the host computer;
decoding the encoded key frame and storing the decoded key frame in a first buffer on the intermediary computer;
receiving a differential screen image update from the host computer;
decoding the differential screen image update and applying the decoded differential screen image update to the stored key frame in the first buffer to generate and store a near live host screen image in the first buffer;
receiving a communication from at least one client computer of a plurality of client computers, requesting to join the screen sharing session on the intermediary computer;
for each client computer of the plurality of client computers from whom a session join request is received,
transmitting a version of the near live host screen image in the first buffer to the client computer,
generating an instance of an encoder in a second buffer on the intermediary computer, and
storing a copy of the transmitted version of the near live host screen image in the second buffer; and

in response to receiving an update request from the at least one client computer, encoding a differential screen image update at the intermediate computer using the instance of the encoder in the second buffer corresponding to the at least one client computer and transmitting the encoded differential screen image update to the at least one client computer, the differential screen image update comprising a difference between the stored copy of the transmitted version of the near live host screen image in the second buffer and a current version of the near live host screen image stored in the first buffer.

2. The method of claim 1, further comprising:
receiving communications comprising the encoded key frame or the encoded differential screen image update from the host computer in an HTTP GET or POST command.

3. The method of claim 2, further comprising:
wherein the intermediary computer is a web server and is not a proxy server.

4. The method of claim 1, further comprising
wherein, on the intermediary computer, a constant amount of memory is used for the first buffer and wherein an amount of memory proportional to a number of client computers connected to the screen sharing session is used for the second buffer.

5. The method of claim 1, further comprising:
creating a FIFO queue on the intermediary computer and storing encoded screen image updates received from the host computer in the FIFO queue.

6. The method of claim 5, further comprising:
triggered by monitored conditions, switching between storing encoded screen image updates received from the host computer in the FIFO queue and storing the near live host screen image in the first buffer.

7. The method of claim 5, further comprising:
storing encoded screen image updates for a first group of client computers in the FIFO queue and wherein encoded screen image updates for a second group of client computers are generated by comparing the near live host screen image in the first buffer and the stored copy of the version of the host screen image for each client computer in the second group of client computers to generate encoded differential screen image updates for a second group of client computers.

8. A computer system having at least one processor and a memory containing computer-executable instructions which when executed by the processor, cause the at least one processor to:
receive, at an intermediate computer, a session request from a host computer to initiate a screen sharing session;
in response to receiving the session request, establish the requested screen sharing session on the intermediary computer;
receive an encoded key frame from the host computer;
decode the encoded key frame and storing the decoded key frame in a first buffer on the intermediary computer;
receive a differential screen image update from the host computer;
decode the differential screen image update and applying the decoded differential screen image update to the stored key frame in the first buffer to generate and store a near live host screen image in the first buffer;
receive a communication from at least one client computer of a plurality of client computers, requesting to join the screen sharing session on the intermediary computer;
for each client computer of the plurality of client computers from whom a session join request is received, transmit a version of the near live host screen image to the client computer, generate an instance of an encoder in a second buffer on the intermediary computer, and store a copy of the transmitted version of the near live host screen image in the second buffer; and
in response to receive an update request from the at least one client computer, encode a differential screen image update at the intermediate computer using the instance of the encoder in the second buffer corresponding to the at least one client computer and transmit the encoded differential screen image update to the at least one client computer, the differential screen image update comprising a difference between the stored copy of the transmitted version of the near live host screen image in the second buffer and a current version of the near live host screen image stored in the first buffer.

9. The computer system of claim 8, comprising further computer-executable instructions, which when executed cause the at least one processor to:
create a FIFO queue on the intermediary computer and store encoded screen image updates received from the host computer in the FIFO queue.

10. The computer system of claim 8, comprising further computer-executable instructions, which when executed cause the at least one processor to:
use a fixed amount of memory on the intermediary computer for the first buffer and use an amount of memory proportional to a number of client computers joining the screen sharing session for the second buffer.

11. The computer system of claim 9, comprising further computer-executable instructions, which when executed cause the at least one processor to:
store encoded screen image updates for a first group of client computers in the FIFO queue and generate encoded screen image updates for a second group of client computers by comparing the near live host screen image in the first buffer and the stored version of the host screen image for the second group of client computers.

12. The computer system of claim 8, comprising further computer-executable instructions, which when executed cause the at least one processor to:
monitor specified conditions, and in response to the monitoring, switch between storing encoded screen image updates received from the host computer in the FIFO queue and storing the near live host screen image in the first buffer.

13. The computer system of claim 12, comprising further computer-executable instructions, which when executed cause the at least one processor to:
send communications to and receive communications from the host computer and the plurality of client computers via HTTP POST and GET commands.

14. A method, comprising:
receiving, at an intermediate computer, a key frame and a sequence of differential screen image updates from a host computer during a screen sharing session;
applying the received differential screen image updates to the key frame to generate versions of a host screen image of the host computer in a first buffer;
receiving, at the intermediate computer, a join request from a client computer to join the screen sharing session;
in response to receiving the join request, transmitting a version of the host screen image in the first buffer to the client computer, generating and storing an instance of an encoder in a second buffer of the intermediary computer, and storing the transmitted version of the host screen image in the second buffer;
receiving, at the intermediate computer, an update request from the client computer; and
in response to receiving the update request, encoding a differential screen image update at the intermediate computer using the instance of the encoder in the second buffer and transmitting the encoded differential screen image update to the client computer, the differential screen image update comprising a difference between a current version of the host screen image in the first buffer and the stored version of the host screen image in the second buffer.

15. The method of claim 14 wherein applying the received differential screen image updates includes sequentially applying the received differential screen image updates to the key frame image to generate a near live screen image of the host computer.

16. The method of claim 14, further comprising:
subsequent to transmitting the version of the host screen image in the first buffer to the client computer, receiving additional differential screen image updates from the host computer;
generating an updated version of the host screen image in the first buffer based on the received additional differential screen image updates; and
wherein the differential screen image update encoded by the instance of encoder in the second buffer includes a difference between the updated version of the host screen image in the first buffer and the stored version of the host screen image in the second buffer.

17. The method of claim 16, further comprising updating the stored version of the host screen image in the second buffer based on the transmitted differential screen image update encoded by the instance of encoder in the second buffer.

18. The method of claim 14, further comprising storing the received key frame and the differential screen image updates from the host computer on the intermediate computer.

19. The method of claim 14, further comprising:
storing the received key frame and the differential screen image updates from the host computer on the intermediate computer; and
switching between storing the differential screen image updates received from the host computer and storing the versions of the host screen image in the first buffer.

20. The method of claim 14 wherein applying the received differential screen image updates is temporally independent from encoding the differential screen image update at the intermediate computer and transmitting the encoded differential screen image update to the client computer.