Patent Publication Number: US-2005120038-A1

Title: Data structure for data streaming system

Description:
The present invention relates to a data structure suitable for storing audio and video content to be streamed over IP (Internet Protocol) networks. In particular, the present invention is suitable for use with a system where the available bit rate is inherently variable due to physical network characteristics and/or contention with other traffic. For example, the present invention is suitable for multimedia streaming to mobile handheld terminals, such as PDAs (Personal Digital Assistants) via GPRS (General Packet Radio Service) or 3G networks.  
      New data network access technologies such as cable and ADSL (Asymmetric Digital Subscriber Line) modems, together with advances in compression and the availability of free client software are driving the growth of video streaming over the Internet. The use of this technology is growing exponentially, possibly doubling in size every six months, with an estimated half a billion streams being served in 2000. However, user perception of Internet streaming is still coloured by experiences of congestion and large start-up delays.  
      Current IP networks are not well suited to the streaming of video content as they exhibit packet loss, delay and jitter (delay variation), as well as variable achievable throughput, all of which can detract from the end-user&#39;s enjoyment of the multimedia content.  
      Real-time video applications require all packets to arrive in a timely manner. If packets are lost, then the synchronisation between encoder and decoder is broken, and errors propagate through the rendered video for some time. If packets are excessively delayed, they become useless to the decoder, which must operate in real-time, and are treated as lost. Packet loss, and its visual effect on the rendered video, is particularly significant in predictive video coding systems, such as H.263. The effect of packet loss can be reduced, but not eliminated, by introducing error protection into the video stream. It has been found that such resilience techniques can only minimise, rather than eliminate, the effect of packet loss.  
      In the case of a sustained packet loss, indicating a long-term drop in throughput, the streaming system needs to be able to reduce its long term requirements. This commonly means that the bit-rate of the streamed media must be reduced.  
      Standard compression technologies, such as H.263 and MPEG-4, can be managed to provide a multimedia source that is capable of changing its encoding rate dynamically. A video source having such properties is described herein as an elastic source, i.e. one that is capable of adapting to long-term variations in network throughput. This is commonly achieved by providing a continuously adaptive video bit-rate. This is possible because unlike audio codecs, video compression standards do not specify an absolute operating bit-rate.  
      Video streaming systems may be designed to provide an encoded stream with varying bit rate, where the bit rate adapts, in response to client feedback, instantly to the available network bandwidth. Such a system could be made to be network-friendly, by controlling the transmission rate such that it reduces rapidly in the case of packet loss, and increases slowly at other times.  
      However, this solution is not practical for two reasons. Firstly, real-time video encoding usually requires a large amount of processing power, thus preventing such a solution from scaling to support many users. Secondly, the end-user perception of the overall quality will be adversely affected by rapid variations in instantaneous quality.  
      For unidirectional streaming applications, the delay between the sender and receiver is only perceptible at start-up. Therefore, common techniques trade delay for packet loss and jitter. Provided the average throughput requirements of the video stream match the average available bandwidth the receiver buffer size can be dimensioned to contain the expected variation in delay.  
      Market-leading streaming systems are believed to use significant client-side buffering to reduce the effects of jitter that may be encountered in the Internet.  
      While this helps, it also introduces large start-up delays, typically between 5 and 30 seconds, as the buffer fills. These systems also include technologies that allow the client to adapt to variations in available bandwidth. Although the details of these techniques are not publicly available, it is suspected that they generally use multi-data rate encoding within single files (SNR scalability), and intelligent transmission techniques such as server-side reduction of the video picture rate to maintain audio quality. Such large amounts of buffering could conceivably allow a significant proportion of packets to be resent, although these re-transmissions themselves are subject to the same network characteristics. The decision to resend lost data is conditional on this and several other factors. Such techniques are generally only applicable to unicast transmissions. Multicast transmission systems are typically better served by forward error correction or receiver-based scalability such as RLM and RLC. S. McCanne, ‘Receiver driven layered multicast’, Proceedings of SIGCOMM 96, Stanford. Calif. August 1996. L. Vicisano, L. Rizzo and J. Crowcroft, ‘TCP-like congestion control for layered multicast data transfer’, Infocom &#39;98.  
      The use of a buffer as described above allows a system to overcome packet loss and jitter. However, it does not overcome the problem of there being insufficient bit rate available from the network. If the long term average bit rate requirements of the video material exceeds the average bit rate available from the network, the client buffer will eventually be drained and the video renderer will stop until the buffer is refilled. The degree of mismatch between available network bit rate and the rate at which the content was encoded determines the frequency of pausing to refill the buffer.  
      As described above, most video compression algorithms, including H.263 and MPEG-4, can be implemented to provide a continuously adaptive bit rate. However, once video and audio have been compressed, they become inelastic, and need to be transmitted at the encoded bit-rate.  
      Whilst network jitter and short term variations in network throughput can be absorbed by operating a buffer at the receiver, elasticity is achieved only when long-term variations in the network throughput can also be absorbed.  
      Layered encoding is a well-known technique for creating elastic video sources. Layered video compression uses a hierarchical coding scheme, in which quality at the receiver is enhanced by the reception and decoding of higher layers, which are sequentially added to the base representation. At any time, each client may receive any number of these video layers, depending on their current network connectivity to the source. In its simplest implementation, this provides a coarse-grain adaptation to network conditions, which is advantageous in multicast scenarios. Layered video compression has also been combined with buffering at the client, to add fine-grain adaptation to network conditions. However, it has been shown that layered encoding techniques are inefficient, and will typically require significantly more processing at the client which causes particular problems when dealing with mobile devices, which are likely to have reduced processing capability.  
      Transcoding is another well-known technique for creating elastic video sources. It has been shown that video transcoding can be designed to have much lower computational complexity than video encoding. However, the computational complexity is not negligible, and so would not lead to a scalable architecture for video streaming.  
      According to one aspect of the present invention, there is provided a data structure for storing a data source for a streaming system, the data source including a plurality of encoded data streams, each of the plurality of data streams being an independent representation of data from the data source encoded at a different resolution to the other of the plurality of data streams, the data structure comprising a header a stream data structure for each of the encoded data streams and one or more packets of the encoded data streams, the header being linked to one of the stream data structures, wherein each stream data structure includes a header, a link to a next stream data structure and a link to a first packet of the encoded data stream.  
      A suitable system and method for using the data structure is described in detail below. The complexity of the data structure is a consequence of packets from potentially many streams being interleaved, and of the need to support switching and recovery. Navigation from packet to packet is necessarily by pointers since, in general, packets which are consecutive within a stream will not be stored contiguously within the file. Writing of switching and recovery packets requires that precise details of source and destination packets be recorded. Switching between streams during playback requires firstly the identification of the next available switching packet, followed by playback of the remaining packets from the “from” stream, playback of the switching packets, then the playback of packets from the “to” stream from the appropriate point. Furthermore it is preferable that there is no appreciable delay when switching between streams.  
      Preferably, the plurality of encoded data streams are video data streams. Audio data may be encoded as a data stream.  
      The stream data structures for video and audio data streams may include bit rate encoding data for the respective data streams.  
      The data source may further comprise a switching stream defining a plurality of switching points for switching between one of the video data streams and another of the video data streams, the data stream structure for the switching data stream including data on video streams and packets to and from which switching is possible.  
      The header of the data structure may include a link to the last stream data structure. The header of a stream data structure may include a link to the last packet of the encoded data stream.  
      The present invention permits scaling the transmission bit rate of the compressed video in dependence on changing network conditions.  
      In the described system, a produced audio-visual stream does not have to be transmitted at a single fixed bit rate, thus the data structure must support this allowing transmission at whatever rate the network instantaneously supports.  
      The system and data structure has been shown to perform well over a GPRS network, making good use of the available network bandwidth, to provide satisfactory multimedia quality.  
      The system and data structure have been designed to overcome the characteristics of IP networks, and in particular mobile IP networks, to provide users with multimedia of consistent quality with minimal start-up delay. 
    
    
      An example of the present invention will now be described in detail, with reference to the accompanying Figures, in which:  
       FIG. 1  is a schematic diagram of an audio-visual data streaming system for use with the present invention;  
       FIG. 2  is a schematic diagram of a video encoding hierarchy used in the system of  FIG. 1 .  
       FIG. 3  is a schematic diagram of a video encoding architecture that allows mismatch free switching between video streams to be achieved.  
       FIG. 4  is a schematic diagram of a client-server architecture suitable for use in the system of  FIG. 1 ;  
       FIGS. 5   a  and  5   b  are, respectively, diagrams illustrating standard TKPT transport packet structure and a variation of that structure implemented for the system of  FIG. 1 ; and,  
       FIGS. 6   a - 6   c  are schematic diagrams illustrating aspects of a data structure comprising an audio-visual data stream in accordance with an embodiment of the present invention.  
    
    
       FIG. 1  is a schematic diagram of an audio-visual data streaming system for use with an embodiment of the present invention.  
      The server  10  receives encoded multimedia content either directly from an encoder  20  or from a file  30 , and serves this content to one or more clients  40 - 60 . The server  10  scales to support many clients  40 - 60  accessing many pieces of content independently as it performs little processing, just selecting packets for onward transmission. No encoding or transcoding of media is performed in the server  10 .  
      In principle, the server  10  operates in the same way for both live streams, provided from the encoder  20 , and for pre-encoded streams from the file  30 . In this particular embodiment, streaming of live media is described. Differences in streaming media from pre-encoded files are discussed in later embodiments.  
      The server  10  includes a number of circular buffers  70 - 90 . For each client  40 - 60  there is one instance of a packet transmitter  100 . The packet transmitter  100  determines when and from which buffer  70 - 90  the next packet is read, reads the chosen packet and sends it to the respective client over a network connection  110 .  
      A semi-reliable network connection  110  is required from the server  10  to each respective client  40 - 60  to ensure that almost all packets sent are received, therefore minimising disturbances to user-perceived quality. Buffers ( 120 ,  130 ) are therefore used at the respective ends of the network connection  110  to allow retransmissions of lost packets. The network connection  110  is also desired to be network friendly, that is, to allow the bit rate used to be increased when congestion is not experienced, and to be drastically reduced when congestion occurs.  
      Whilst the system components are illustrated and described as a combination of integrated and separate components, it will be appreciated that different configurations could be used. For example, an external encoder  20  and/or file store  30  could be used. Equally, the buffers  130  are likely to be integral to the client devices  40 - 60 .  
       FIG. 2  is a schematic diagram of a video encoding hierarchy used in the system of  FIG. 1 . The encoder  20  encodes live or stored multimedia content into an elastic encoded representation. Audio is encoded at low bit rate into a single encoded bit stream, and hence is in itself inelastic. However, as audio typically requires a smaller bit rate than video, provided the video is encoded in an elastic fashion, then the combined encoding of audio and video can be considered to be elastic.  
      Audio is encoded using the AMR (Adaptive Multi-Rate) encoder at 4.8 kbit/s. Video is encoded into an elastic representation. In a manner similar to layering, the encoder  20  creates a hierarchy of independent video streams. Instead of building this hierarchy by making each stream dependent on all streams lower in the hierarchy, each stream is encoded independently. Such a hierarchy is well-known, being referred to as ‘simulcast’.  
      Although audio data has been described as being encoded using a low bit rate AMR scheme, other AMR encoding rates, and other encoding standards such as MP3, could also be supported. Encoded audio at various rates could be organised in a hierarchy of independent streams in a similar manner to that described below for video, but with the simplification of switching between encoded representations from the fact that each audio frame is typically coded independently.  
      The video hierarchy, created using an extension to the ITU-T standard H.263, includes an intra stream  200 , to allow random access to video streams, and one or more play streams  210   a ,  210   b , for ordinary viewing of the content. Each play stream  210   a ,  210   b  is encoded at a different bit rate, thus allowing a given client  40 - 60  to receive at a rate appropriate for its current network connection  110  to the server  10 . The hierarchy also contains switching streams  220 ,  230 ,  240  which allow switching from the intra stream  200  to the lowest rate play stream  210   a , and between play streams.  
      Since the encoding algorithms employ motion-compensated prediction, switching between bitstreams at arbitrary points in a play stream, although possible, would lead to visual artifacts due to the mismatch between the reconstructed frames at the same time instant of different bit streams. The visual artifacts will further propagate in time.  
      In current video encoding standards, perfect (mismatch-free) switching between bit streams is possible only at the positions where the future frames/regions does not use any information previous to the current switching location, i.e., at access pictures. Furthermore, by placing access pictures at fixed (e.g. 1 sec) intervals, VCR functionalities, such as random access or “Fast Forward” and “Fast Backward” (increased playback rate) for streaming video content, are achieved.  
      A user can skip a portion of video and restart playing at any access picture location. Similarly, increased playback rate, i.e., fast-forwarding, can be achieved by transmitting only access pictures.  
      It is, however, well known that access Pictures require more bits than the motion-compensated predicted frames. Thus, the intra stream  200  and switching streams  220 ,  230 ,  240  are used. The main property of switching streams is that identical pictures can be obtained even when different reference frames are used.  
      The main purpose of the hierarchy is to allow the server  10  to transmit a play stream  210   a  or  210   b  to a client  40 - 60  to achieve an optimal balance between building up a buffer of received data at the client  40 - 60  to provide resilience to packet loss and sudden drops in network throughput, and providing the best play stream  210   a  or  210   b  to the client  40 - 60  depending on the highest bit rate that its network connection  110  instantaneously supports.  
      The intra stream  200  is a series of intra coded pictures ( 201 ,  202 ) that are used to provide random access and recovery from severe error conditions. The play streams  210   a ,  210   b  include predictively coded pictures ( 211   a ,  212   a ,  213   a ,  214   a ,  215   a ;  211   b ,  212   b ,  213   b ,  214   b ,  215   b ) which may be bi-directionally predicted, and may be predicted from multiple reference pictures. The play streams  210   a ,  210   b  also include periodic access Pictures  216   a ,  217   a ;  216   b ,  217   b . The switching streams  220 ,  230 ,  240  consist of a series of linking Pictures ( 221 ,  222 ;  231 ,  232 ;  241 ,  242 ).  
      The circular buffers  70 - 92  are designated for each stream type, one for each intra ( 70 ), play ( 80 ,  85 ) and switching ( 90 ,  91 ,  92 ) stream for each piece of content.  
      When a client  40  first connects to the server  10 , the server  10  locates an appropriate intra picture (for example, intra picture  201 ) from the circular buffer  70  storing the intra stream, and sends this to the client  40 . The server  10  then selects the linking picture ( 221 ) to switch from the intra stream  220  to the play stream  210   a  with the lowest encoding bit rate, and then continue to serve from that play stream ( 213   a  onwards).  
      The transmission of packets to the client  40  is an independent process, with the rate of transmission depending on the state of the network and the transmission protocol used. However, the intention is that initially the transmission rate is greater than the encoding bit rate of the play stream  210   a  with the lowest encoding bit rate. This will allow the client  40  to start decoding and presenting media to the user immediately at the point that data is received and decoded, while also allowing the client  40  to build up excess compressed media data in its decoding buffer.  
      At the point where an access picture (such as access picture  217   a  in the above example), the client  40  and/or server  10  may determine that a different play stream is more suitable (for example due to increased or decreased network capacity). In the above example, switching from the low rate play stream  210   a  to the higher rate play stream  210   b  is accomplished by the server  10  transmitting the link picture  232  instead of access picture  217   a . The link picture  232  links to play stream picture  215   b  of the higher rate play stream  210   b  allowing the client  40  to receive that play stream. Switching to a play stream of decreased bit rate is accomplished in a similar manner.  
      Three methods of encoding linking pictures have been investigated. Each method provides different compromises between the accumulation of drift from switching, the cost in terms of bit rate of the actual switching, and the impact on the quality of the individual play streams caused by encoding regular pictures of a type that allow drift-free low bit rate switching.  
      1. Predictively Coded Linking Pictures  
      In the first method, linking pictures are generated as Predicted pictures. They are coded in a manner such that when reconstructed they are similar, in the sense of having for example a small mean square difference, to the reconstruction of the simultaneous access picture in the destination play stream. Access pictures can be coded as Predicted pictures. The number of bits used to encode the linking pictures determine how well matched the reconstructed linking picture is to the reconstructed access picture, and hence determines the amount of drift that would occur as a result of switching. However, drift will accumulate on each occurrence of switching.  
      2. Intra Coded Linking Pictures  
      In the second method, linking pictures are generated as intra pictures. They are coded in a manner such that when reconstructed they are similar, in the sense of having for example a small mean square difference, to the reconstruction of the simultaneous access picture in the destination play stream. Access pictures can be coded as Predicted pictures. The number of bits used to encode the linking pictures determines how well matched the reconstructed linking picture is to the reconstructed access picture, and hence the amount of drift that would occur as a result of switching. However, for a given amount of mismatch, an intra coded linking picture would usually require many more bits than a predictively coded linking picture. The use of intra coding for linking pictures prevents the accumulation of drift.  
      3. Quantised-Source Coded Linking Pictures  
      In the third method, linking pictures are coded with a technique based on the concept described in “VCEG-L27, A proposal for SP-frames, submitted by Marta Karczewicz and Ragip Kurceren at the ITU-Telecommunications Standardization Sector Video Coding Experts Group&#39;s Twelfth Meeting: Eibsee, Germany, 9-12 Jan., 2001, available at ftp://standard.pictel.com/video-site/” referred to herein as Quantised-Source pictures.  
      The encoding architecture for Quantised-Source pictures is shown in  FIG. 3 . The source picture and the motion compensated prediction are independently quantised in steps  300  and  310  respectively, with the same quantiser index, and transformed, before being subtracted in step  320  and variable length encoded in step  330 . The reconstructed picture is formed by adding, in step  340 , the output of subtractor  320  and the output of quantisation and transformation  310 , and inverse transforming and inverse quantising the result in step  350 . The reconstructed picture is stored in Picture Store  360 . The result is that the reconstructed picture is simply the quantised source picture, and is independent of the motion compensated prediction. Hence a given source picture can be reconstructed identically when predicted from different reference pictures, and hence drift free switching is enabled. The motion compensated prediction is not irrelevant, as it reduces the entropy of the signal to be variable length encoded and hence reduces the number of bits produced by encoding a picture.  
      Access pictures are also coded as Quantised-Source pictures, with an identical selection of coding modes, intra or inter, and quantiser choice, as the linking picture. This ensures that the linking picture reconstructs identically to the simultaneous access picture in the destination play stream.  
      The number of bits required to encode the linking pictures is determined by the encoding of the corresponding access picture. The number of bits used to encode the access picture depends on how the quantisation is performed, but in general is more than the number of bits used to encode Predicted pictures and less than the number of bits used to encode Intra pictures. This is because encoding is more efficient than intra encoding due to the use of prediction, but not as efficient as normal prediction due to the quantisation of the prediction error. Hence the use of Quantised-Source pictures allows drift free switching but at the expense of less efficient encoding of the play stream.  
      Quantised-Source pictures are encoded with the same H.263 syntax as predicted pictures, with the exception that they are distinguished from predicted pictures by setting the first three bits of MPPTYPE to the reserved value of “ 110 ”.  
      The periodic encoding of Quantised-Source pictures can cause a beating effect in stationary areas of pictures. This is explained as follows. In normal predictive coding, stationary areas of the picture which have already been encoded as a reasonable representation of the source picture are not modified. In the encoding of such areas in Quantised-Source pictures, the prediction must be quantised, and if done with the quantiser index used for non-stationary areas of the picture, makes the region change, possibly making it worse, but in any case, changing it. This changing is the beating effect.  
      This is overcome by noting that when the prediction for an area of the picture provides a good enough representation of the source, there is no need to transmit information, and hence change the area. So when an access picture is encoded as a Quantised-Source picture, a test is performed to determine whether information about the area would have been transmitted if the picture had been encoded as a Predicted picture rather than a Quantised-Source picture. If no information would have been transmitted, the quantiser index used by the quantisation of steps  300  and  310  and inverse quantisation of step  350  is set to a small value, the output of subtractor  320 , commonly known as the prediction error, is set to zero, thus this area of the newly reconstructed picture is equal to the corresponding area of the previous reconstructed picture quantised with a fine quantiser. In H.263 and other standards, the range of quantiser index is from 1 (fine) to 31 (coarse). By referring to a small index, a value typically of 8 or less is meant. This minimises unnecessary changes to the reconstructed picture while minimising the amount of information that must be transmitted. There will however be a cost in bit rate in the corresponding linking picture, where the prediction error is unlikely to be zero, but the same fine quantiser must be used.  
       FIG. 4  is a schematic diagram of a client-server architecture suitable for use in the system of  FIG. 1 .  
      The client  40  includes a network buffer  130 , a decoding buffer  41  and a decoder  42 . The server  10  includes circular buffers  70 ,  80 ,  90  as discussed above, and a packet transmitter  100  and network buffer  120  for each client.  
      The client  40  keeps the server  10  informed of the amount of information in its decoding buffer  41  and the rate at which it is receiving data. The server  10  uses this information to determine when to switch between play streams. For example, when the client  40  has accumulated more than a threshold of data, say 15 seconds of data in its decoding buffer  41  and the client  40  is receiving at a rate greater than or equal to the encoding rate of the next higher play stream in the hierarchy, the server  10  can switch the client&#39;s packet transmitter  100  to the next higher play stream at the next linking picture.  
      Similarly, when the amount of data accumulated by the client  40  in its decoding buffer  41  falls to less than a threshold, the server  10  can switch the client&#39;s packet transmitter  100  to the next lower play stream at the next linking picture.  
      The overall effect is that the transmission rate varies in a network-friendly fashion according to the state of congestion in the network, but due to the accumulation of data in the client&#39;s decoding buffer  41 , the user perceives no change in quality as a result of short term changes in transmission rate. Longer term changes in transmission rate are handled by switching to a stream with a different encoding rate, to allow increased quality when the network allows it, and to reduce quality, without stalling presentation or presenting corrupted media to the user, when the network throughput drops.  
      The decoding buffer  41  at the client is used to reduce the impact of network performance variations on the quality of media presented to the user. The network characteristics that the buffer is designed to handle fall into three categories: packet jitter, packet loss and variable throughput. In practice these three network characteristics are not independent, all being associated with network congestion, and in the case of mobile networks, with degradation at the physical layer.  
      By de-coupling the transmission rate from the media encoding rate, the client&#39;s decoding buffer  41  can be filled when network conditions are favourable, to provide resilience for times when network conditions are not so good.  
      The accumulation of tens of seconds of data in the decoding buffer  41 , allows packet jitter (delay variations) of the same magnitude to be masked from the user. In practice this masks all packet jitter, as larger amounts of jitter are better classified as temporary connection drop-outs, which are handled by the error recovery process described below.  
      By accumulating data in the decoding buffer  41 , time is available for the retransmission of lost packets before they are needed for decoding. Again, by dimensioning the decoder buffer  41  to contain more data than some multiple of the round trip delay, there is time for a small number of retransmission attempts to recover from packet loss. This allows recovery from most instances of packet loss without affecting decoded media quality, and makes the connection semi-reliable.  
      Finally, again by accumulating data in the decoding buffer  41 , the client  40  can sustain consistent media quality for some time when the receiving bit rate is less than the encoding bit rate, and for some time when the receiving rate has dropped to zero.  
      As the data is streamed to the client  40  at a rate independent of the encoding rate, and buffered in the decoding buffer  41 , it is necessary for decoding of data to be correctly timed, rather than simply to decode and present as fast as possible. Timestamps are used for this purpose, as well as for the synchronisation of audio and video.  
      Due to network variations, the amount of data in the client&#39;s decoding buffer  41 , measured in bytes, may vary with time. In addition, the amount of data in the decoding buffer  41 , measured in terms of the length of media presentation time it represents, would also vary with time. This has implications for streaming of live content: it is not possible to build up data in the decoding buffer  41  if the first data sent to the client  40  is sent with minimal delay from the time it was captured and encoded. Hence, the first data that is sent to the client  40  must be old data, that is, data representing events that took place some time before the client  40  connected to the server  10 . Then as the decoding buffer  41  fills, the most recent data in it becomes more and more recent, while the media presented to the user remains at a constant delay from the actual time of occurrence.  
      The server buffers encoded data in its circular buffers  70 ,  80 ,  90 , for a constant period of time after encoding so that when a client  40  connects to the server  10 , ‘old’ data is available for streaming to the client  40 . As the client&#39;s decoding buffer  41  fills, the reading points from the circular buffers  70 ,  80 ,  90  get nearer to the newest data in these buffers.  
      The optimal sizing of the circular buffers  70 ,  80 ,  90 , and the client decoding buffer  41 , is preferably such that each can contain the same amount of data, measured in terms of the media presentation time it represents.  
      The network buffers  120 ,  130  respectively in the server  10  and client  40  are used by a transport protocol implementing the semi-reliable data connection. Typically, data is retained in the server&#39;s network buffer  120  until it, and all earlier data, have been acknowledged to have been received at the client  40 . Similarly, data would be removed from the client&#39;s network buffer  130  when it, and all earlier data have been successfully received and passed to the decoding buffer  41 . Consequently, the server  10 , by knowing the data that remains in its own network buffer  120 , knows what data has been successfully received by the client  40 , within bounds given by the uni-directional transmission delay.  
      This implies that no feedback from client  40  to server  10 , beyond that needed by the transport protocol itself, is needed for the server  10  to know how much data has been received by the client  40 , so that it can make decisions about switching between play streams.  
      The presence of an accumulation of data in the client&#39;s decoding buffer  41  provides resilience to a number of network impairments, such as jitter, packet loss and variable throughput. Clearly, it is not possible to recover from all network impairments unless the decoding buffer  41  is dimensioned to contain the whole media content and presentation is delayed until all data is received. As this case is not streaming, but downloading, a strategy to recover from serious network impairments is needed.  
      At times when the network throughput drops to a level below the encoding rate of the lowest rate play stream for a considerable length of time, the amount of data in the decoding buffer  41  will reduce and will eventually become zero. At this time, presentation to the user will stop. However, circular buffer filling will continue at the server  10 . Consequently, when the network recovers to a state in which transmission of the lowest rate play stream is again possible, the next data required by the client  40  will most likely not be in the server&#39;s circular buffer  70 ,  80 ,  90 , as it would have been overwritten by more recent data.  
      To recover from this situation, the server  10  must restart streaming as if a new connection had been made from the client: it must find a point in the intra stream, and start streaming from it, and then switch through the linking stream into the lowest rate play stream. The effect on the user will be the loss of media from the time that the decoding buffer  41  became empty to the time when the server starts to send the intra stream.  
      The server  10  will be aware of the client&#39;s decoding buffer  41  becoming empty as it is aware of when the client started to decode and of how much data has been successfully received. It will therefore be able to restart at an intra stream picture without the need for a specific message from the client. However, to provide resilience to the system, for example to recover from the effect of different clock speeds in the server and the client, a control message is sent from the client  40  to the server  10  in this situation.  
      In principle, streaming from file is identical to live streaming. In practice, it is somewhat simpler. There is no need for Circular Buffers  70 ,  80 ,  90  as data can be read from file as and when needed. The server  10  however uses the same techniques to fill up the decoding buffer  41  at the client  40  and to switch between play streams. In the case of the decoding buffer  41  becoming empty, there is no need to restart at a later point in the content with an intra stream picture, as presentation can resume when the network throughput again becomes sufficient: the user simply perceives a period in which no media is presented.  
      Trick modes, such as fast forward, fast reverse and random access, become possible by use of the intra stream.  
      By writing ‘old’ data in the circular buffers  70 ,  80 ,  90  to file just before being overwritten, the problem described above of the decoding buffer  41  becoming empty, and the user missing content until recovery with an intra stream picture occurs, can be avoided, as data for streaming to the client will always be available: it will have to be read from file rather than from the circular buffers  70 ,  80 ,  90 .  
      Such functionality would also allow a client to pause the presented media for an indefinite period of time, and continue streaming afterwards. It would also allow the user to fast forward after such a pause to catch up with the live stream.  
      An implementation of the transport protocol tested in the above mentioned client-server architecture is based on the ISO TCP transport protocol TPKT, which is described in detail in RFC-2126 by Y. Pouffary, “ISO Transport Service on top of TCP (ITOT)”.  
      The standard TPKT protocol defines a header illustrated in  FIG. 5   a , followed by a payload. The packet length indicates the combined length of header and payload in octets.  
      In the implementation used for the above described system, TPKT is extended to have a header, an example of which is illustrated in  FIG. 5   b , followed by a payload. The packet length indicates the combined length of header, timestamp if present, and payload in octets. T is a bit that indicates whether the timestamp is present, and M is a bit that indicates whether the payload contains audio or video information.  
      As stated above, timestamps are required for the correct timing of decoding of data. Information embedded in packet headers include the length of the packet, a timestamp for the data in the packet, and a stream identifier.  
      The stream identifier is provided to allow audio and video to be multiplexed into a single TCP connection. This is to ensure synchronisation of audio and video transmission. If separate TCP connections are used, it is possible that they will respond slightly differently to network characteristics and will achieve different throughputs, which would result eventually in vastly different amounts of data in the client&#39;s decoding buffers, measured in terms of presentation time. Although these differences could be managed, the issue is totally avoided by using a single TCP connection and multiplexing audio and video with the same presentation time in neighbouring packets. In fact, adding audio to a video only system simply requires the sending of audio packets at the same time as the associated video: no further control is necessary.  
      The server  10  attempts to send packets as quickly as possible. Initially, a number of packets are sent back-to-back regardless of the network capacity, as they are simply building up in the server&#39;s network buffer  120 . When the network buffer  120  becomes full, the rate at which packets can be sent to the network buffer  120  matches the rate of transmission over the network, with the transmission process being limited by blocking calls to the socket send function.  
      The transmission rate is also limited when the amount of data buffered at the client reaches a threshold, for example 30 seconds. When the client&#39;s decoding buffer  41  has this much data, the server  10  restricts the transmission rate to maintain this level of fullness.  
      Network throughput is estimated by counting bytes that have been sent to the network buffer  120 , subtracting from this the size of the network buffer, and dividing by the time since the start of transmission. Shorter term estimates of network throughput are calculated using two counts of bytes transmitted and two measures of the time taken to send them, calculating the throughput from one pair, and switching between then periodically, resetting the pair no longer being used to zero. For example, if resetting occurs every 200 seconds, the network throughput is estimated over a period that varies from 200 seconds immediately after resetting to 40 seconds just before resetting again.  
      This technique works satisfactorily provided the server  10  is attempting to stream as quickly as possible. But as mentioned above, when the amount of data in the decoding buffer  41  exceeds a threshold, the server  10  restricts its transmission rate to maintain a constant buffer fill. In this case, the network throughput would be estimated as the encoding bit rate of the current play stream. When in this state, the network may be capable of transmitting a higher rate play stream than the one currently being streamed, but the server  10  does not switch because it can not make a true estimate of the network throughput because of its own rate limiting. To escape from this state, the server will periodically ignore the client decoding buffer fullness threshold, and stream at full rate for a given period of time or given amount of data. It records the number of bytes sent to the network buffer  120  and the time taken, starting when the network buffer  120  becomes full, as detected by a blocking call to the send function. It then estimates the achievable throughput, and uses that to determine whether to switch to a higher rate play stream.  
      As stated earlier, by knowing the data held in its network buffer  120 , the server  10  implicitly knows which data has been received by the client  40  and delivered to its decoding buffer  41 . This information can then be used to determine when to switch between play streams, and when to invoke the error recovery procedures. However, visibility of the contents and fullness of the server&#39;s network buffer  120  in most socket implementations is not supported. In order to monitor the contents of the network buffer  120 , a mirror buffer  120   a  is implemented. The mirror buffer  120   a  does not store the actual data sent to the network buffer  120 , but instead stores only the number of bytes sent and the timestamp of the data. Knowing the size of the network buffer  120 , and assuming it is always full, the server  10  has access to the timestamp of the oldest data in the network buffer  120  via the mirror buffer  120   a , which is approximately the same as the timestamp of the newest data in the client&#39;s decoding buffer  41 .  
      In testing, it has been found that the assumption that the network buffer  120  at the server  10  is always full is correct at most times. This is because the transmission process is controlled to send as quickly as possible to the network buffer  120 . If the network buffer  120  becomes less than full, the effect is to underestimate the amount of data at the client  40 , which in most cases is safe, as the major problem is seen as exhaustion of data at the client  40  rather than overflow. In practice, the decoding buffer  41  can be dimensioned to be larger than the largest amount of data it needs to store. In any case, if the decoding buffer  41  becomes full the client  40  stops reading from the network buffer  130  which in turn stops the server network buffer  120  from emptying and transmission stops.  
      To determine the exact amount of data in the client&#39;s decoding buffer  41 , the server also needs to know the timestamp of the data packet that the client is currently decoding and presenting. The server  10  calculates this using two assumptions: firstly that the client  40  starts decoding immediately after the server  10  sends the first packet; and secondly, that the client&#39;s clock does not drift significantly from the server&#39;s clock in the duration of streaming.  
      In practice both assumptions have been found to be valid. The client  40  is designed to start decoding immediately on receipt of data, and so any error on the server&#39;s estimated presentation time would result in an underestimate for the amount of data in the decoding buffer  41 , which as explained above is not a problem. Drift between the client&#39;s and server&#39;s clocks during a typical streaming session is most likely to be negligible compared to the amounts of data being buffered. For example, with a difference of 100 parts per million, it would take 10000 seconds, or nearly three hours, for a drift of one second to occur. In the rare case of a large amount of drift accumulating, the client  40  can warn the server  10  by use of a control message, such as the one described earlier that is sent for decoding buffer underflow.  
      The server  10  initially streams the play stream with the lowest bit rate, to allow the client  40  to decode and present media to the user immediately while also building up the level of data in the decoding buffer  41  to provide resilience to network impairments. If the network has sufficient capacity to support transmission of a higher rate play stream, the server  10  should, at an appropriate moment in time, switch to streaming a higher rate play stream.  
      There are many possible strategies that could be used to determine when to switch to a higher rate play stream. Preferably, the client  40  should have sufficient data in its decoding buffer  41  to be able to continue decoding and presenting media for a predetermined period of time, say 15 seconds. It is also preferred that network throughput that has been achieved in the recent past, measured over, say, the most recent 60 seconds, should be sufficient to sustain streaming of the play stream to be switched to indefinitely; that is, the recently achieved network throughput rate should be greater than or equal to the bit rate of the play stream. The aim is to avoid frequent switching between streams as this can be more annoying to the user than constant quality at the lower rate.  
      In order to achieve this aim, it is preferred that the switching down decision includes hysteresis relative to the switching up decision. For example, switching down to the next lower bit rate play stream could be triggered when the client  40  no longer has sufficient data in its decoding buffer  41  to be able to continue decoding and presenting media for a specified period of time, say 8 seconds. In the case of a configuration with three or more play streams, and the currently streamed play stream being the third or even higher rate play stream, this strategy does not result in an immediate drop to the bottom of the hierarchy, as access pictures only occur periodically, and it is hoped that the decoding buffer fullness would recover after a first switch down so that a second switch down would not be necessary.  
       FIGS. 6   a - 6   c  are schematic diagrams of aspects of a data structure for storing an audio-visual data source in accordance with an embodiment of the present invention.  
      The main data structure shown in  FIG. 6   a  permits the storage in a single file of multiple audio play streams, an Intra video stream, and multiple video Play and Switching streams.  
      As the audio visual data source created and used in the present invention has a number of encoded streams that could be transmitted at any one time to a client, storage in a conventional sequential file is not possible. For example, in the case of video, a particular source picture may be encoded in each play stream, and may also be encoded in the Intra stream and some or all of the Switching streams.  
      The file contains a data structure, an example of which is illustrated in  FIG. 6   a , followed by stream data. The data structure includes a header  600  containing information about the number and type of streams (audio, video, switching etc). For the first and last instances of each type of stream it also includes pointers  610 - 680  (expressed as offsets from the beginning of the file) to the header for the respective stream.  
      Each pointer  620 - 680  points to a stream data structure which includes a stream header  700 , containing a pointer  710  to the next stream header of the same type, a pointer  720 ,  730  to the first and last packets of the stream respectively. Each stream type uses a specific stream header type, however certain elements are common to all stream header types: a stream identification number  705 , a pointer  710  to the next stream header of the same type and pointers  720 ,  730  to the first and last packets of the stream respectively. An example stream header containing only these common elements is illustrated in  FIG. 6   b . Play and audio stream headers additionally contain the bit rate at which the stream was encoded. Switching stream headers contain the stream identifiers of the play streams from and to which the Switching stream enables switching.  
      Each stream consists of a sequence of packets, each represented by a packet data structure, an example of which is illustrated in  FIG. 6   c . Each packet data structure includes a packet header  800  and a payload  810 . The header includes data including a pointer  801  to the next packet in the stream, a timestamp  802 , a packet sequence number  803 , packet size  804 , and a frame number  805  (i.e. the sequence number of the video picture or audio frame which the packet, perhaps together with other packets, represents). Switching packets additionally contain the sequence numbers of packets in from- and to-Play streams between which they allow bit rate switching to take place. The switch stream packet header effectively defines a switching point and contains the sequence number of the last packet to be played from the “from” stream before switching and the first to be played from the “to” stream after switching. Sequence numbers begin at O, and are never negative. The use of pointers to assist in navigation between streams when switching is possible, although this approach has not been followed in this particular embodiment.  
      The pointers to the last stream data structure and the last packet are useful when appending to a file, as they provide immediate access to the points at which, the file must be extended, without the need to search through the whole file.  
      The complexity of the data structure is a consequence of packets from potentially many streams being interleaved, and of the need to support switching and recovery. Navigation from packet to packet is necessarily by pointers since, in general, packets which are consecutive within a stream will not be stored contiguously within the file. Writing of switching and recovery packets requires that precise details of source and destination packets be recorded. Switching between streams during playback requires firstly the identification of the next available switching packet, followed by playback of the remaining packets from the “from” stream, playback of the switching packets, then the playback of packets from the “to” stream from the appropriate point. Furthermore there must be no appreciable delay when switching between streams.  
      In tests, both file-based and live streaming scenarios were investigated using the BTCellnet™ GPRS network. A desktop Pentium PC was used to run the encoder and Server. The client was a Compaq iPaq™ connected with via an infra-red link to a Motorola Timeport™ GPRS mobile telephone.  
      In a video-only configuration, two switching streams were used, with bit rates of 6 kbit/s and 12 kbit/s.  
      The system performed as expected. Transmission starts with the intra stream and then switches to the 6 kbit/s play stream, where it stays for some time, accumulating data in the client as a result of actually transmitting faster than 6 kbit/s. Then when sufficient data has been accumulated, and the short term average receiving rate is more than 12 kbit/s, it switches to the higher rate play stream.  
      At times during a lengthy session, occasional switches back to the lower rate play stream occur as a result of reduced network throughput. And very rarely, media presentation is interrupted because of a significant period during which the network could not deliver data to the client.  
      The overall effect is for most sessions, the user can view continuous media presentation, with occasional changes in quality, but no distortions of the type usually associated with bit errors and packet loss. Only very rarely are complete pauses in media presentation observed as a result of severe network impairments and loss of throughput.