Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
CS 414 – Multimedia Systems Design Lecture 30 – Buffer Management (Part 3) Klara Nahrstedt Spring 2012 CS 414 - Spring 2012 Administrative MP2 posted MP2 Deadline – April 7, Saturday, 5pm. CS 414 - Spring 2012 Covered Aspects of Multimedia Image/Video Capture Audio/Video Perception/ Playback Audio/Video Presentation Playback Image/Video Information Representation Transmission Audio Capture Transmission Compression Processing Audio Information Representation Media Server Storage CS 414 - Spring 2012 A/V Playback Outline VoD Client Buffering Techniques MinBuf MaxBuf CS 414 - Spring 2012 Client/Server Video-on-Demand System CS 414 - Spring 2012 Buffering Strategies at VOD Client Minbuf - minimum buffering strategy Minbuf minimizes buffering requirements at VOD client, but makes more demands on network (throughput and delay guarantees) Maxbuf – maximum buffering strategy Maxbuf buffers more than one unit of information and eases QoS guarantees demands on network Buffering only up to a limit (Bufmax) CS 414 - Spring 2012 Buffering Model ZOi(t) – amount of bits in multimedia object (e.g., Video frame) Oi displayed at time t Cr(t) – amount of bits received at receiver at time t Two buffer states in each buffering strategy: Starvation if Cr(t) ≤ ZOi(t) If Cr(t) > ZOi(t), no starvation at VOD client Overflow if Cr(t) ≥ ZOi(t) + Bufmax CS 414 - Spring 2012 Client Buffer Constraints (Received amount of data Cr(t) should always be between ZOi (t) and ZOi (t) + Bufmax) CS 414 - Spring 2012 Implications of Minbuf Strategy With minbuf strategy – delivery time of a unit of information is the display time of previous unit Minimum Throughput (Th) in bits per time unit required is min buf min Th Z Oi ti ti 1 Delivery time instant of the first unit before start Z Oi of display: t x min buf Thmin CS 414 - Spring 2012 Example (1) Question: Given Video Stream with 320x240 pixels, 20 fps, 8bits per pixel, uncompressed What is the minimal buffer size if Minbuf technique is used? Answer: Buffer Size is of the application frame Z = 76800 bytes if receiving and display operations are done sequentially One can also deploy a dual buffering scheme of 2* Z if receiving and display operations are done concurrently Display Thread Receiving Thread Display Thread Phase 1 ti ti-1 ti-1 ti-2 CS 414 - Spring 2012 ZOi+1 ZOi Phase 2 ZOi-1 ZOi Receiving Thread ti ti+1 Example (2) Question: What is the throughput under the above given video characteristics and minbuf strategy? Answer: MinBuf Throughput needed in end-toend fashion Z = 76800 bytes, 20 fps (50 ms period) ti – ti-1 = 50 ms = 50/1000 sec Throughput = Z/ti – ti-1 = 76800 bytes/ (50/1000 sec) = 1536000 bytes/sec = 12288000 bits/sec = 12000 kbps = 11.71875 Mbps CS 414 - Spring 2012 Implication of Maxbuf Strategy Delivery schedule of VOD server and network may cause that Bufmax bits will be delivered every K seconds, where K = Bufmax/Th, Th – throughput of network Minimum Throughput required ∑ZOi – total size in bits of all objects that will be presented in stream: n max buf Thmin Z i 1 Oi Buf max Stream _ Display _ Duration CS 414 - Spring 2012 Example (1) Question: Given Video frame 320x240 pixels, 8bits/pixel; Video frame rate 20 fps, uncompressed, and Network throughput 8 Mbps Answer: arrival time every k = Bufmax/Throughput = 5.8599375 Mbits/8 Mbps = 0.83242 seconds What is the worst case arrival time of frames if Bufmax is 10 frames (holds ½ second of video frames)? What is the Bufmax size if frames arrive on average every k = 1 second? Answer: Bufmax = k*Throughput = 8 Mbits = 8388608 bits = 1048576 bytes = 13.653 video frames ; round up to 14 frames; Bufmax should be 14 frames if throughput is 8 Mbps and arrival of frames is approximately every 1 CS 414 - Spring 2012 second Example (2) Question: Given video characteristics of 320x240 pixels, 8 bpp, 20 fps, uncompressed, length of the move is 1 minute, Bufmax holds 1 second of frames, what is the minimum throughput we would need if we use MaxBuf strategy? CS 414 - Spring 2012 Example (3) Given video characteristics of 320x240 pixels, 8bpp, 20fps, MJPEG compressed with I frames 50% compression (1:2) of each frame; Question: what would be the arrival time (k) of frames if we have buffer size, holding 1 second frames, and network throughput of 10 Mbps? Question: what would be the minimal throughput needed from the network under above conditions if the video clip would be 30 seconds long? CS 414 - Spring 2012 Example (4) Given MPEG-2 compressed video with GOP of IPBBPBBPBBI, average I frame size of 10KB, average P frame size of 6 KB, and average B frame size of 2 KBytes. Question: What would be the buffer size (express it in bytes and time duration) if network throughput is 4 Mbps and arrival time of each compressed frame is on average every 500 ms? CS 414 - Spring 2012 Standard Video Buffering Video delivered over “deterministic” channel (satellite, cable, digital TV broadcasting) simple Small buffer (minbuf technique) Data arrives to the media player with deterministic delay and rate and infrequent data drops Video delivered over IP networks problematic Big buffers (maxbuf technique) No guarantees in IP networks Streaming servers manage simple buffering Data sent as quickly as possible; when buffer full, (reached predefined threshold), video playback starts and server continues to send data CS 414 - Spring 2012 Implementation Issues Buffers for Uncompressed Periodic Streams Buffers for Compresses Periodic Streams Use circular buffers, but carefully consider the size of buffer unit (depending on MPJEG or MPEG) with maxbuf strategy For MPEG may consider dynamic buffer allocation Buffers for Control Information Use circular buffers as prefetch buffers with maxbuf strategy Use priority queues or FIFO Buffers for Non-RT Data Use maxbuf strategy with static buffer allocation CS 414 - Spring 2012 Implementation Issues Dual-Threshold Buffering (in Flash Media Server) Buffer has two thresholds: When buffer filled with data up to first threshold, start playback After that continue buffering until second, higher threshold Advantage: assures fast start, and at the same time provides fairly high resilience to bandwidth fluctuation CS 414 - Spring 2012 Conclusion Will talk about media server in next lectures CS 414 - Spring 2012