TELKOM NIKA Indonesia n  Journal of  Electrical En gineering   Vol.12, No.6, Jun e  201 4, pp. 4314 ~ 4 3 2 1   DOI: 10.115 9 1 /telkomni ka. v 12i6.501 5          4314     Re cei v ed O c t ober 3 1 , 201 3; Revi se d Ja nuar y 3, 201 4 ;  Accepte d  Ja nuary 25, 20 1 4   Development of Video On Demand Server Based on   LiveMedia and Improved Cycle Patch Algorithm      Guimei Bai  Dep a rtment of Comp uter and  Information En gin eeri ng,  Lu o y a ng Institute o f  Science an T e chnolog y,   Hen an L uoYa n g , 4710 23, Ch i n a   email: b a ig uim e ie du@ 16 3.co     A b st r a ct   The disadv ant age of  patch ing algor ithm  is   that  the gener ating m u ltic ast  flow dis o rder   and cycle  patch algorithm  solv ed t he above pr oblem s .  Im proved Bat c h proc essing  cycle patch al gorithm  has bett e r   treatment effec t  for large sca l e  e m er gency r equ est, and  ha s a go od effect  in de man d  on  de ma nd for h o t   progr a m s or pr ime ti me, ca effectively i n cr ease th e n u m b e r of users. T h e mai n  f unctio n  of the L i veM edi a   library   is i m p l emente d  on a   vari ety  of medi types  a n d  co din g  for m at sup port. T h e p aper  pr ese n ts  deve l op ment o f  video on  de mand serv er bas ed on L i veM edi a and i m prov e d  cycle patch  a l gorit hm. The t e st  curve showed that patch cycle algori thm  can provide serv ice for m o r e   us ers in the same  bandwidth, can  effectively incr ease the  nu mb er of concurre n t  users.     Ke y w ords :  Liv e Media, video  on demand ser v er, cycle patc h     Copy right  ©  2014 In stitu t e o f  Ad van ced  En g i n eerin g and  Scien ce. All  rig h t s reser ve d .       1. Introduc tion  Re sea r ch o n  stre amin media  sche d u ling al go rith m mainly  ref e rs to the  re sea r ch of  data stream  transmissio mode, the b a si c flow i s  sent uni ca st, multica s t or  broa dcast, th ese   basi c  tran smi ssi on m ode s have thei o w advant ag es and disad v antage s,  th eir com b inati o n   may con s titute a new  sche duling alg o rit h m.  The  co re p r o b lem of m a th ematical  mod e l of video  o n  dem and i s :  formal  de scription of  use r  be havio r of large-scale video  on  deman d sy stem, distrib u tion pattern of  use r  be havi o r,  conte n t and  time, and  establi s h correspon ding  mathemati c al  model. Stream sche dul ing  algorith m  is  essentially o n -de m an d re sou r ce an al ysis and distribution of use r  comm a n d   pro c e ss.  Vid eo o n  d e ma nd m a thema t ical m odel  i s  the  theo re tical b a si o f  VOD  strea m   sched uling al gorithm.   In this p ape r, the re se arch  achi eveme n ts  on  on eself, so rt out  the developm ent context   of video  on d e mand  st rea m ing m edia  sche duling   alg o rithm, the  a d vantage an d di sadvant a ges  are  com pare d  and  analy z ed, and  pro p o se s a  ne w sche duling  alg o rithm, an d the con s tru c tion of  a video on  deman d serv er ba se d on  open  sou r ce cod e  [1]. The main  work i n cl ude s:  the   stru cture of  VOD  system  at p r esent,  analyzes  thei r adva n tage s and  di sadva n tage s; net work  transmissio n and control p r otocol for st reami ng  med i a are de scri bed in detail,  analyze s  their  cha r a c teri stics; the multim edia codin g  format  i s  stu d ied, analy z e d  their respe c tive scope  of  appli c ation;  sche duling  alg o rithm fo streaming  m edi a to do  an  in-depth  analysi s , compa r i s o n  of   their re sp ecti ve characte ri stics, and p r opo se a ne w sche dulin g  algorithm, a nd the algo rithm  wa s simul a te d and the re sults.  LiveMedia  can b e  divid e d  into th ree   parts:  the  RTP libra ry, L i veMedia li brary an strea m ing m edia ap plications, the mai n  functi on of  RTP databa se is u s in g RTP protocol  to  compl e te the  data tran smi s sion, the mai n  function  of  the LiveMedi a libra ry is im plemente d  on   a   variety of media types an d  codin g  forma t  suppo rt, applicatio n exa m ple is mai n l y  used for  sh ows   su ch a s  RTP  libra ry develo p ment of stre aming me dia  appli c ation s .   The  cycle  pa tch alg o rithm  is d e si gned  to disord er  to avoid Pat c hin g  Algo rithm in  a   multica s t stre am gen eratio n, limiting the maxi mum  numbe r of m u ltica s t stre a m . However,  the   numbe r of m u ltica s t flow redu ce s;  the p a tch  stre am n u mbe r  is  bou nd to g r eatly increa se. How to   effectively re duce the  p a tch  stream  nu mber will   be   the focus of  this im prove d  algo rithm. T h e   Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  2302-4 046     De velo pm ent of Video On Dem and Server Based on  LiveM edia a n d  Im proved  (Guim e i Bai)  4315 pape r pre s e n t s developm e n t of video on deman d server b a sed on LiveMedi a  and improv ed   cycle p a tch al gorithm.       2. The Res e a r ch of Impro v ed C y c l e Patch  Algorithm  Patch algo rith m into the user buffer an d patch  solve u s er joi n s the  multica s t stre am and  cau s e  lo ss  of  data flo w  two poli c y p r obl ems. In vid e o  frequ en cy p r ogra m   wa s first o n  d e ma n d gene rating a compl e te  vid eo  st ream, n a mely  no rma l  flow; when  the user  ma king the  req u e s behin d  the no rmal flow, the  user u s e the  buffer ca ch e the normal flow of data, at the sam e  time,  the re gen erat ion  system i n to a uni ca st  stream,  n a mel y  patchi ng  stream, to  com pen sate fo r t h e   loss of data.  Patching  alg o r ithm g r ee dy  to the total l e ngth of th e vi deo  pro g ra as  patch  win dow, a   compl e te video stre am fro m  the serve r   only exist  in the system, al l in the video strea m  duration  rea c he s the  reque sts  we re  usin g the n o r mal flo w , but  only by the u n ica s t tra n sm issi on p a tchi n g   strea m . Patching Algorith m  elegant to the use r  buffer si ze as p a t ch wind ow, there a r e on e  or  more from the se rver com p lete video st reami ng  sy stem, only whe n  the use r  bu ffer has e nou gh   space to  cache the skew  offset, to  new users to  send the patch st ream, otherwi s e it will transfer   the routine flow.                                                              A rea s on abl e patch wi n dow  patchin g algo rithm i m prove d  to  set, if the di fference   betwe en the  norm a l flow o f  playing time and the req u e st arrival time is less than  the windo w if  the pat ch  si ze, patch  strea m  is  gen erate d , if t he difference b e twe e n  the  si ze  of the  windo si ze  of the pat che s , it gen erate s  a  ne w routi ne flow. E a ch  gene ratio n  of  just o ne type  of flow, a nd i t  is   either the  no rmal flo w , either the  pat ch  stre am  [2]. So reg a rdl e ss of pat ch al gorithm  or p a tch   algorith m  did  not co nsi der t he effect of u s ing th e VCR operation a n d  VCR ope ra tion on  syste m   efficien cy. In fact, the  user V C R op eration di re ctly affect the  reso urce  sch edulin g of vi deo   serve r , thus  affecting the  effici en cy of the system,  so it is  ne ce ssary to u s er VCR op eration   con s id erin g the de sign of  patchi ng alg o r ithm.   In the p a tch  algo rithm, t here  a r e t w o  ty pes  of stream  m edia  multica s t stream and  patchi ng st re am: MS PS.  Two  kind s of  media flo w  in  spite of diffe rent fun c tion s, but there i s   no   differen c e in  the con s um p t ion of resou r ce s [3]. Two  kind s of flow rep r e s e n ta tion method f o r   multic as t flow: MS{MID, ST, MT}, MID film ID, ST  said  the sy stem ti me ge neratin g flow, MT  sa id   the pro g ram  start time in t he st ream. T he pat ch  stre am PS{MID,  ST, MT, ET}, MID, ST and  MT  definition an d  multicast  streams of the  same program , ET said the final flow.  The  co re id e a  of  cycle  pa tch al gorith m  fo r diffe rent  multica s t: a  media  progra m  ha s a  certai n interv al must be b e twee n stre a m s. We  defi ne cycle  con s tant PERIO D, multica s t flow   interval must  be integer times of PERIOD. Fi gure 1 can reflect  different multicast strea m   sched uling  strategie s  in a  media p r og ra m.      Figure 1. The  Main Idea of Periodi c Patching Algo rith     Req u e s t Req 1  (40,0 )  in  system time 40 s into  the  syst em and from  the pro g ra m time of 0   requ est s  for  data, syste m  req u irem ent s, the r equ est into the mul t icast flo w  M a inStream 1,  and  gene rate p a tch  stre am P a tchin g Strea m 1 to data  comp en satio n . Req u e s t Req 2  (5 0,70 ) in   system time  50s into th e system a nd reque st  data  from progra m  70s, the  multica s t stre am  Mainst ream 1  player to p r ogra m  40 s, the ne w requ est cann ot b e  incorp orate d  into the  cu rre nt  Evaluation Warning : The document was created with Spire.PDF for Python.
                               ISSN: 23 02-4 046                     TELKOM NI KA  Vol. 12, No. 6, June 20 14:  4314 – 4 321   4316 MainStrea m must  gen erat e a  ne w m u ltica s t st ream.  But in  order to e n sure  a   certai n i n terv al  betwe en mul t icast flo w , system gen erates a m u lt icast from th e  begin n ing o f  time 80s fl ow  MianStrea m2 . Here, M a in strea m 1 a n d  MainStrea m 2 interval to  40s. O b viou sly, if Req2 a n d   MainStrea m 2  the loss  of l0s p r o g ra m of data.   At this time, the sy stem  then ge ne rates  PatchingStre a m2 to data compen satio n Either find or rebuild a m u lticast satisfy the  conditio n s of the flow in the syst em, if the  use r  re que sts the same m u ltica s t flow time (Di fferen c e), the syste m  to create t he patch stre am  data com pen sation, the co mpen sation o f  T flow  PS{MID, ST, MT, ET} must satisf y the Equation   (1).                                                                                                          (1)    The disadva n tage is that  the patchin g algor ith m  gene rating m u ltica s t flow diso rde r ,   cycle  patch  algorith m  sol v ed the a b o v e pro b lem s . In gen eral,  for the  sa me u s er a c cess  seq uen ce,   cy cle  pat c h  alg o rit h wit h  f e wer  mult i c a s t  st r eamin se rv ice,  t h e r e b y  sav i n g   sy st e m   resou r ces o c cupi ed by the  mu lticast stream  gen eration.  Experiment s sho w  that, for a typical use r  ac ce ss m o d e l, perform an ce is b e tter than the   patchi ng al g o rithm  cycle  patch  algo ri thm, fairne ss is al so  sign ificantly bette r than p a tchi ng  algorit h m  [ 4 ] .  B u t  in s o me  spe c ial  ca se s,  t he  p e rfo r mance cycle patch algo rith is  n o bett e than that of  patchi ng algo rithm.  For example, wh en  the user a c cess frequ en cy is high, better  perfo rman ce  and  cycle  pat ch al gorith m ; but wh en t he  system  user  acce ss f r equ ency i s  lo w, the   system  of un popul ar  pro g ram (we  use t he po pula r ity of definition   unpo pula r , p opula r  p r og ra m)  system p e rfo r mance, patch ing algo ri thm  but beyond  cycle patch alg o rithm.   Whe n  the  sy stem  re ceive s  the A pplyStream   (AS)  command, first does  a  s earc h  for  multic as t can be  c o mbined flow. Set t he s i z e   of th e user  buffer is T buf, the  com m and  AS  (MovieID, M o vieTime) re ach  the  syst em time i n   system T, MS {MID, multi c a s t can th en  be  inc o rporated into the c u rrent ST, MT}  must meet the followin g  form ula (2 ).                                                                                      (2)    The  perfo rma n ce  of the  sy stem  patche s  and  cy cle  p a tch  algo rith m only  unde r ce rtain  con d ition s  is  better than t he othe r; it is be ca use th ese  algo rith ms have  not  in-de p th stu d y of  variou s facto r s that influ e n ce th e pe rforma nc e of the system.  These pa ra meters in clu de:  multica s t flow period  con s t ants, pop ulari t y and user   buffer si ze o n  the multica s t flow co nst ant  PERIOD val u e influen ce,  system  re so u r ce s to  pri o rit y  allocatio n   strategy an d fl ow g ene ration   strategy.   In the p e rio d i c  p a tchi ng  algorithm, m u ltica s flow cy cl e con s tant  P E RIOD de scribes the  minimum  spa c ing  of differe nt multica s t flow of a   program. In the ab ove algo rithm ,  it is a sy ste m   con s tant, g e n e ral  value  for the mi nimu m len g th of   all u s e r s in t he b u ffer. If t he PERI O D i s  0,  then cycl e pa tch algo rithm  dege nerates i n to patchi ng  algorith m Popula r ity ref l ects a p r og ram is  ho w freque nt ly use r dema nd, i t  is the  quan titative   crite r ion for j udgin g  a pro g ram b e lon g s  to t he popu lar or u npo pu lar program. Re sea r ch sh ows  that, in a typical VO D syst em pro g ra m popul arity ob eys Zipf distri bution.   For the different popula r  p r og ram s , PERIOD value  also affe cts the perfo rma n c e of the   system. On t he pop ula r  show u s e r s a l o t, if PERIOD is too small  or takes th value of PERIOD   algorith m  for patch 0, Yi Sheng ch eng is very much  a  multicast st ream, re sultin g in transmission   redu nda ncy, redu ce  syste m  perform an ce. In this ca se, sho u ld b e  appropri a te  to increa se  the   value of PE RIOD. On  de m and  unp opula r   sho w  fe we use r s,  the  nu mber of u s e r s le ss multi c a s flow e nergy  merg er, if th e value  of P E RIOD  is greater,  a lot  of patching  system resou r ce con s um ption,  has  a si gnificant imp a ct  on the effici e n cy  of  t he  sy st em.  I n  t h is  ca se,  w e  s h o u ld  redu ce the va lue of PERIOD.  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  2302-4 046     De velo pm ent of Video On Dem and Server Based on  LiveM edia a n d  Im proved  (Guim e i Bai)  4317 In the pe riod  of the pe riodi c con s tant B udi ng  algo rith m, PERIOD v a lue i s  the mi nimum  size of all in the use r  buff e r. Due to th e possi bl e prese n ce of a large n u mb er of users in the  video on  de mand, vide on de mand  termin al the u s er may vary  gre a tly, can  be hig h  mem o ry   comp uter,  also can  be  lo memory  of th e co mp uter, or even a set - top box.  So here ' PERI O and cli ent buf fer si ze to est ablish co ntact ,  dynamic adj ustment of PERIOD.   Re sea r ch an d statisti cs, o n  dema nd se rvice  a pproximately obeys the Zipf distribution.   The program  accordi ng to the popularity of the  order of M1, M2,... , Mn, the  VOD probabil i ty  pi=P{X =Mi} (i =1, 2, 3,... , n) sati sfy Equation (3) [5].     1 0 , ) / 1 ( / / 1 1 1 1 n j i j i p                                                                                          (3)     Gene rate   a multica s t stream and   pat chin strea m   is re quired to  co nsume  system  resou r ces, o n  the p r emi s e of limite d  system  re source s, the  resou r ce allo cation  proble m   (Re s o u rce  Allocatio n ). Pat c hes an cycl e pat ch  al go ri thm ba se d o n  re so urce  allo cation  st rateg y   is relatively simple, namel y the multicast stre a m  an d patchin g st ream sha r ing  all the system  r e sour ces .   Improveme n of the  batch  cycle p a tch  alg o rithm i s bat ch  algo rithm  is int r od uced i n to the   gene ration p r oce s s to the patch  stre am; different us e r s p a tchin g  st ream i s  bou n d  to a multica s patchi ng stream,  the waiti ng  time  increase the  user's  cost to im prove the  utilization of  system   resou r ces. S uppo se  no w t hat 30  u s ers  simultan eou sl y on a  po pula r  p r og ram  in  30  se con d s,  you  need to  se nd  the 30 p a tch ,  if the 30 users we re  divided into  3 g r oup s, ea ch g r oup  delay of  10   se con d s, can  be adde d to the flow is red u ce d to 3.  Algorithm de scriptio n:  If the batch maximum del ay time TM,  batch  cy cle p a tchin g  algo ri thms are describ ed a s   follows (1) Ea ch p r o g ram  req u e s ts into the re que st queu e, VCR op erati on in VCR o peratio n   requ est qu eu e, VCR ope ra tion requ est q ueue first re spon se;   (2) Every tim e  the time TM, se e the  VCR  ope rati on requ est q ueue i s   empt y, if not  empty, return , if empty, step (3);   (3) T o  pro c e ss the  req u e s t queu e of requ es t s , ea ch reque st to find the ap prop riate   multicast flow inform ation respec tively; to create th e patch  stre a m , is first cal c ulate d  with  no  resource was availabl e, if any , will  be associated with the  creation of the patch  stream   informatio n to be create d  multica s t pa tching  st re am  queue  waitP a tch. A pro g ram stre am o n ly  one obje c t q ueue qu eue  at a patch, the obje c t flow over time is equal to th e same p r og rams   need to maximum flow en d time of cre a tion; if t here is no available re sou r ces, or the requ est   queu e is emp t y,  then stop  pro c e ssi ng th e requ est, go  to step (4 );  (4) T he p r o c essing o b je ct queue i n  the wait Patch, according t o  the patch  strea m   informatio n to create  a patch patch  strea m  flow; cre a te waitPatch q ueue, empty;  (5)  Rep eat st eps (2).   Algorithm an alysis:   (1)  Th la rg e s pat ch ea ch  program flow numb e r: b a tch cy cle pa tch algo rithm use s  the  strea m  me rgi ng strategy, for the  sam e  prog ram  patching  strea m  mergi ng, to redu ce the p a t ch   strea m  numb e r. In orde r to merge the p a tch st r eam, reque st to del ay the  resp on se on the  server  side, the dela y  is longer, can be co mbin ed with pat ch  stream n u m ber, but the d e lay time sho u ld  be co ntrolle d in the ran ge  of toleran c within the u s e r 's [6]. The de lay is small, can be combin ed   with pat ch  stream n u mbe r   less, but the  respon se  tim e  is  small e r,  the mo st extreme  ca se, th e   delay is  ze ro,  then the b a tch  cycle  patch algo rithm b e com e pe rio d ic p a tchi ng  algorith m . No assume that the waiting tim e  fo r the TM,  perio dic multi c a s t strea m  is T, then the numbe r of ea ch  prog ram p a tching up to T/tm to round u p  the fare.   (2) the  waitin g time: the  n u mbe r  of u s e r  if  the  user  reque sts the  same  p r og ra m in TM   time  is  n ,  th en  th e  c y c l e  pa tc h  a l go r i thm r e qu ir es  pa tc h i ng  s t re am in to  N  in  TM time , b a t c h  c y c l patch al gorith m  is the nee d to patch stream num ber  is 1, occupy resou r ces ba tch cycl e pat ch   algorithm and cycle patch t he algorithm of the ratio is 1/n, if  n>1, will be able t o  play the role of  combi ned flo w . So the TM accordi ng to the actual   situation is to d y namically ad just the user.   Evaluation Warning : The document was created with Spire.PDF for Python.
                               ISSN: 23 02-4 046                     TELKOM NI KA  Vol. 12, No. 6, June 20 14:  4314 – 4 321   4318 Thro ugh the  above an alysis, the batch  cycle p a tch  al gorithm h a b e tter treatme nt effect  for la rge  re q uest s , such  as i n  the  de mand fo hot  pro g ram o r   on d e man d  f o r p r ime  time  ha s   good effe ct, can effectively increa se the  numbe r of users.        3. The Whol e Archi t ec tu re of Liv e Media  A video on demand  serve r  re ceived th e client playb a ck req u e s t, read the mult imedia  data from  disk, an co rrespondi ng t r eat ment a c cord i ng to  differe n t  format s, pa ckage  an d th en  according to  the proto c ol  of RTP, is se nt to  the client. Packag e  pro c e ssi ng of  RTP proto c o l  o f   data is a com p lex pro c e ss.  Now fo reign  media devel o p ment library is for RTP p r otocol.   LiveMedia i s  one of the more p o werf ul a, has b e en appli ed in  some h a rdware a nd  software products, for example,  the current VLC and MPlayer player higher visibility. LiveMedia   not only p r ovides th e RTP  proto c ol d e ve lopment b a se , but also f o r t he devel opm ent of Lib r ary  in   the video  on  deman d, live  appli c ation s   also  gives th e corre s po ndi ng referen c example s , which   have highe for stre aming  media devel opers to  refe ren c e value  [7]. The database files are  written in  sta ndard C++ la ngua ge,  cross platform o p e ration, suita b le for const r ucting  strea m ing   media ap plication system  with low  co s t, and is al so suitable for em bedd ed sy ste m Ac c o rding to the time order, s e t into t he s y s t em user for U1, U2,... ,  Un,...  Enter the  system, its time for T1, t2,...  , tn,...  So, t0=0, t hen T i  (i=0, 1, 2,..., N,...) for th e lambda form   stren g th  (T of varia b le i n tensity of Poi s son fl ow.  Let Ti= t i-ti-1 (i> = 1) , whi c h  Ti  said adja c ent  users enter t he  system ti me difference, the Ti  sa ti sfy such  as formula  (4 ) probability distri bution  function i s  sh own.     t t i i e t t ) ( 1 |T T 1 ) | ( F 1 - i i                                                                                                            (4)     The  RTP li b r ary  ca n b e  divided  into  thre e p a rts:  the  Usage Environme n t libra ry,  Grou psock li bra r y and Ba sicUsag e Environm ent libra ry . In order to  distingui sh these three p a rts,  in the  so urce  dire cto r y ha s th ree  sub d i recto r to  pl ace  the th ree  ba se, the  three  sub  direct ory   name s   are  thre e li bra r y na m e , nam ely Usag eEnv ironm ent,  Grou psock and  BasicUsag e E n vironm ent.  The Usag eE nvironm ent libra ry includ e s  th ree m a in  classe s:  cla ss UsageEnv ironm ent,  cla s Ta skSchedul er and  class Ha rshTa b le,  the s e   cl a s ses a r ab stract  ba se  cl a ss,  are fini sh ed  in the  su bcl a ss. Th Harsh T able  cla s d e fines the i n terface  of Hash table,  mainl y  for oth e r ki n d of servi c e s . Storage  of Ha sh table obj ect  is a  clas s of  obje c ts  su ch  as So cket ha ndle, on ce th prog ram  ne e d s,  can  reali z e the fa st  se a r ch.   Cl ass UsageEnvironm ent  an d cla s Ta skS che dul er   is m a inly u s e d  for p r o c e ssi ng d e lay eve n ts, a s ynchro nou read  ev ent an d the  o u tput of th e e rro or warning mess ages .                                                                                               So, in orde r t o  re alize the  Edge T r an sp ort serve r   will  play, in the  file re ad, a c co rding  to  the sp eed  o f  playback o f  multimedia  files, ev ery  other  peri o d of time, to se nd a  d a ta   transmissio n   task, sin c e   these are broa dcast  in stru ction s  in  the do cume nt, are con s tantly  circulatin g, to automaticall y  until the do cume nt  is  se nt, or stop in stru ction. Asy n ch ron o u s  re ad  event pro c e ssi ng refe rs to the asynch ron o u s  receive in stru ction s  via Socket, and the   corre s p ondin g  treatm ent  [8]. Output e rro r o r   wa rni ng info rmatio n refe rs to t he p r og ram  is  runni ng, if the erro r or  warn ing inform atio n, this part is  respon sibl e for the output.   The lib ra ry al so  ha s a  co rrespon ding  subdire cto r y i n  the  co de d i recto r y, the  dire ctory   name i s   Live Media. T h is p a rt is the  co re  of  LiveMe dia ,  can  be  a c hi eved  RTP a n d  RTSP  se ssi o n   establi s hm en t, all kind s of  RTP Payloa d pa cki ng  an d pa rsi ng a n d RTSP  co ntrol. It define s  a  base  cla s s M edium, oth e and  stre amin g medi a type s a nd  en codi ng  related  cl a s ses inh e rit from  this cla s s. Fig u re 2 is a di a g ram of the b a se Me dium  cla ss.   Here, Media S ink is u s ed  to receive t he data from  the other m odule a nd proce s sing.   MediaSo u rce  is u s e d  to  g enerate the   data o r  re cei v e other mod u le data,  and  ca n be  outp u t.  Mpeg1 or2De m ux for Mp e g1 or Mpe g 2  format p r og ram stream fil e sou nd, im age  sep a rati on.  RTSPServer is  us ed to  build RTSP  s e rv er bas e on  RTSP protocol. RTSPClient is  us ed to  build  the room si d e  base d  on RTSP protocol.  There ar e many other su b classe s ca n be found in  the   sou r ce co de  and hel p files.  Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  2302-4 046     De velo pm ent of Video On Dem and Server Based on  LiveM edia a n d  Im proved  (Guim e i Bai)  4319   Figure 2. The  Diagram of the Base M edi um Cla s     LiveMedia lib rari es a r e p o w erful, n o t on ly to  suppo rt a variety of formats, a nd su pport s  a  variety of fun c tion s, in cludi ng the  e s tabli s hme n of a VOD se rver, serve r  and   cli ent.  The   libra ry  also h a s exte nded g r eat, to expand the  serve r  to su pport the fo rmat can b e  inherite d  thro ug h   Frame d Sou r ce, to exte nd the clie nt supp orte d formats  can b e  inh e rited throu g h   MultiFram e d R TPSou r ce, to reali z e thei r own medi a throu gh the a bove way of succe ssi on.   Program  c a lled tes t OnDemandRTSPServer, this  program can es tablis h a  RTSP s e rver  on startu p, and to establi s h the co rrespondi ng su se ssi on acco rding to the spe c ified file, to   establi s h the  corre s p ondin g  unicast  stre am in  the re ceived re que st  comma nd [9 ]. The prog ra sup port s  vide o medi a type s a r e  mainly  ba sic flow file MPEG1,  MPEG2 a nd  MPEG4 form at,  MPEG1, MPEG2 format of the program stre am  and tran sp ort stream file. Based on t h is  pro c ed ure, ca n set up a video on dem an d serve r , and  can be ba se d on an existi ng cla s s on the  serve r  to su p port the form at was exp a n ded.   Program  call ed te stMPEG 1or 2Audi o Vi deo Stream er, the p r og ram  ca contin ue  to read   from the  spe c ified MPEG 1 or MPEG 2  prog ram  st ream files  on  startup, a n d  put them in to   indep ende nt  voice a nd vid eo elem enta r y stream  ba se flow, then  the flow, to  se nd data  pa ckets  to a multi c a s t gro up  239.2 55.42.42,  port is 6 666/6 6 6 7  (voi ce ) a n d  888 8/888 9 (video). Ba se d o n   this pro c e d u r e, it can build  a live video server.       4. Dev e lopment of Video  On Deman d  Ser v er Based on Liv e Media and Improv ed C y cle   Patch Algorithm   Based  on  the  above  an alysis,  LiveMedi a can  be  est ablished  on  the b a si of the vide o   serve r  b a sed  on  RTSP p r otocol, a  co mplete vide o  on d e man d  se rver  sh ou ld incl ude  VOD  servi c syste m  and ma na gement  sy ste m  two pa rts.  On dem and  serv ice fu nctio n  of the syst em  inclu d ing  the  esta blishme n t and  the  client  RTSP  se ssion,  se nd to th cli ent ne ed  m edia  informatio n manag ement system, is respon sible fo r u s er a u thenti c ation, billing and othe r tasks.   The co re part  of  this  i s  a media se rvice  sy stem ; th e pe rform a n c e of the  serv er i s  d e termi ned   largely  by it.  A video  on  d e mand  serve r  e s tabli s hm e n t procedu re,  and  it is d e scrib ed  belo w   the   serve r  proced ure e s tabli s h m ent pro c e ss.  1. Establish e n vironm ent   The co de Ta skSch edul er*  sched uler  = BasicTa skS chedul er:: crea teNe w ();   Env=Basi cUsageEnvironm ent:: creat eNew  (* schedul er); to cr eate an obj ect  of class  BasicUsag e E n vironm ent, establi s h t he b a si c use of the environ men t 2.  A cce s s  co nt rol   Usi ng  the code UserAut hentication D a t abase* auth D B =  NULL ; authDB = new  UserAuth enti c ation D ata b a s e;   Au th D B -> a ddU se rR ec or d ( " u s e r na me1 " , " password1"); imple m ent ation of  acce ss  control can p r event u s ers  without a c ce ss to vi de o o n  dema nd. No acce ss  co n t rol nee ds  ca n   omit this  part.   3. The esta blishme n t of RT SP server  Usi ng the  code  RTSPS erver*  rt spS e rver  = RTS PServer::  createNew (*e n v,  8554,  authDB ) ; the establi s hme n t of RTSP server, intera ctive and clien t  complete th e serve r , clie nt   impleme n tation of VCR op eration, na me ly in the c lient to complete the pro g ram p l ay, pause, fa st  forwa r d, b a ckward, ope rati on. 855 4 is t he RTSP se rver po rt, can  also  be  cha n ged to oth e non  occupi ed p o rt s, the IP ad d r ess  of  the  server i s  n o t specifi c ally set, it is run  on  deman servi c Evaluation Warning : The document was created with Spire.PDF for Python.
                               ISSN: 23 02-4 046                     TELKOM NI KA  Vol. 12, No. 6, June 20 14:  4314 – 4 321   4320 prog ram to th e IP addre ss  of the comput er. The se rve r  create s  only  once, a serv er to re spo n d  to   all use r  dem a nd.  4. Execution loop metho d   Thro ugh  the  cod e  (. DoEv entLoo p);  (en v ->ta skS che d u ler) to  execute the l oop   method,  to read event  so cket and d e lay sen d ing  operation on  t he media file s are  com p let ed in this cy cl e.  video se rve r  servi c e syst em  mu st  im pl ement  fu nctio n s su ch   a s t he spe c ified  dire ctory  will be on file  in the  server,  the  client i n put protocol  name, the ad dress of the  server and the file  name can be realized on  demand,  such as input RTSP://192.168.0. 1/test.vob in the specified  directory serv er client, only to t he existence of test.vob, can be norm al play. In order to facilitate   the dynami c  creation  of  a medi a server sessio n, can  let the  cu rre nt na me an d file  name   c o ns is tent.  After the ba sic fu nctio n   of video on   deman serv er impl ement ation, ca n b e  furthe improve d  on  the ba sis  of it, adding  a bat ch  cycle  p a tch   al gorithm on strea m ing m edia  sched uling  [1 0]. Whe n  th e  clie nt requ ests to  play the  program th rough  the  RT SP proto c ol,  the  requ est late n c y re spo n se, put in the  queu e que Reque st, also  set a timer queTim er, timer  intervals  of time trigge re d once, pro c e s sing q ueu e q ueRequ est re que st, you wi ll need to cre a te   the pat ch  stream  delay t o  cre a te, ad d the  pat c h   s t r e am  c o n t ain e r  ma pW a i tPa t c h , un til the  depletio n of  reso urce s o r  t he q ueu e i s   empty,  then  pro c e ssi ng th e pat ch  strea m  que ue  dat a in  mapWaitPatch, after the treatment, emp t y pat ch stre a m  queue, the  end of the tre a tment.  Use Di re ctShow  achieve  client b a se d on o pen RTSP. Applica t ion of this  pro c ed ure   mentione d a bove  can  be  ope n, re ceiv e an d record  a me dia  stream, an d th en the  re ceiv ed   media  stre a m  de codin g  ope ration,  redu cin g  the  video ima g es a nd  sou nd. Ope n RT SP  impleme n tation pro c e s s is as follows:   (1) Sockets initialization;   (2) T o  parse t he input pa ra meters;  (3) T o  create  the RTSP cli ent: cre a te a  RTSP  clie nt mainly throu g h to create in stan ce of the RTSPClient cl ass to achi eve, RTSPClient  is realized by the su cc esso r to the Medium (4)  RTSP clie nt send s a re que st to RTSP  server a nd  OPTION, ca n  be obtained  by the   method from  the RTSP service: first to cre a te  a socket, establi s he s a co nn ection  with the  serve r , and th en se nd s a O P TION stri ng,  the respon se  sent su cce s sfully after waiting for se rver;   (5) To o b tain  the SDP description info rmati on from s e rver: firs t  to c r eate a s o ck et,  establi s h e s a  conn ection  with the se rver, and  then  sen d s a DE SCRIBE strin g , the resp o n se   sent succe s sfully after waiting for server;   (6) A c cordi n g  to the above description  information  obtaine d fro m  the SDP, cre a te a   media sessio n;  (7)  Cre a te the output file;  (8) Beg an b r o adcastin g  stream;  (9) Cir c ula r   re ceiv ing.   The vide se rver i s  te sted  agai nst  short  time   la rge-scale re q uest occu rs whe n   the  use r  chan ge s the avera g e  respon se ti me, validat io n batch cycl e  patch al go rithm ca n in cre a se  the num be r o f  con c u r rent  use r s role. Here th e b a tch  cycl e pat ch  algorith m  for  delay time  of 3   se con d s.   Server:  CPU usin g P4, f r equ en cy re covery  is  2.9 3 GHZ, mem o ry u s ing th e 512 operating  system, usin g Windo wsXP. Cl ient: CPU  us i ng Celeron, f r equ en cy is  1 . 0GHZ,  with  64  M of memo ry, the operating sy stem u s ing  Win d o w sXP. Switch:  D-Link,  10M . The serve r  to   swit ch, switch to the clien t  using 10 Mb ps line s and  it is network stru cture  usi ng sta r  sh ap ed   stru cture. Figure 3 Sch e m a tic as  sho w n  in fig.. A  number of video  files are 60, the length of time  for 30 minute s , the format for the MPEG-1.      Figure 3. The  Test Environ m ent Structu r Evaluation Warning : The document was created with Spire.PDF for Python.
TELKOM NIKA   ISSN:  2302-4 046     De velo pm ent of Video On Dem and Server Based on  LiveM edia a n d  Im proved  (Guim e i Bai)  4321 Figure 4  is th e g r aph  curv e result s, the  ho rizo ntal ax is  rep r e s ent s the ave r a ge  numbe of use r s pe se con d , the  vertical  axis  repre s e n ts th e re sp on se ti me. Solid tria ngle  whe r e t he  curve  re presents the  re sp onse cu rve  cycle pat ch al gorithm, a  ho llow tri angle   whe r e th e cu rve  rep r e s ent s the respon se  curve of  the ba tch cycl e patch algorith m     Figure 4. Test Result s Bight      The test  curv e sho w e d  tha t  patch cy cle  algor ith m  ca n  provide  se rvice for m o re u s ers in  the same b a n d width, can e ffectively in crease the num ber of  concurrent users.       5. Conclusio n   This  pap er m ade a  thorou gh research   on st r eami ng  media  sche d u ling al gorith m  used in   video on de mand sy ste m , analyze s  on the ad v antage s an d disa dvanta ges of pat ching   algorith m , periodic b u ildin algorith m , an d the cy cl e p a tch al gorith m  is imp r ove d , the batch cycle  patch al go rith m, the algorit hm simul a tio n . The pap er  pre s ent s dev elopme n t of video on  dema n d   serve r  ba se d on LiveMedi a  and improve d  cycle p a tc algorith m . According to the  requi reme nt of  VOD syste m , some theo ry and combi ned with th e  precedin g  chapters rese arch, this pa per  impleme n ts a  basi c  vide on dem and  system, the sy stem  can  run  in Linux, Wi ndo ws  platform.  These a c hi e v ements, to  solve th e u s er in  vi deo  on  d e man d  system of  a large   num be of  con c u r rent u s ers to  seize  the resource an d co n s truction  of VO system  cross pl atform  has  certai n refe re nce  signifi can c e.       Referen ces   [1]  Qi W ang, F eng  W u , Shipe ng  Li, et al. F i n e -g ranu larit y  sp ati a ll y sca la ble v i deo c odi ng.  IEEE Int Conf  on Acoustics,  Speec h an d Si gna l Processi n g  (ICASSP 2 0 0 1 ) . Salt Lake C i t y , USA. 200 1.  [2]  GUO Ke  yo u.  T he App licat ion  of N o rma l i zed  Cov a ria n c e i n  Vi de Mosaici ng.  TE LKOMNIKA  Indon esi an Jou r nal of Electric al Eng i ne eri n g .  2012; 1 0 (7): 1 567- 157 2.   [3]  J van der Me erk, D Mackie .  R T P Pa y l o a d  F o rmat for T r anspor to MPEG-4 Eleme n tar y  Stre ams   [EB/OL].  R F C3640 . 20 03.   [4]  Cai Y, T a vana pon g W ,  Hua  KA.  Enha ncin g  Patchin g  Perf ormanc e throu gh D oub le P a tchin g .  Proc. of   9th Intel Co nf. on Distri buted  Mult imed ia S y s t ems. 2003; 09 : 72-77.   [5]  Dan A, Sitaram  D, Multimedi a cachi ng strate g i es for hetero g ene ous a ppl ica t ion an d server   envir onme n ts.  Multi m ed ia T o ols an d App lica t ions .19 97; 4(3 ) : 279-31 2.  [6]  KA Hua, Y Cai, S Sheu.  Patchin g : a mu lticast tech niq ue for true  video-o n -d e m and servic es Procee din g s of the 6th ACM Inte rnati o n a l Co nferenc e on M u ltime d ia  (Multimedia’98). New   York: ACM   Press.199 8; 19 1-20 0.  [7]  Yue  Hou, Y u emei M a i. C h aotic Pr edicti o n for  T r affic F l o w  of Im proved  BP N e u r al N e t w ork .   T E LKOMNIKA Indon esi an Jou r nal of Electric al Eng i ne eri n g .  2013; 1 1 (3): 1 682- 169 0.   [8]  H Sch u lzri nn e. RT P profile  fo r au dio  a n d  vid eo c onfer ence s   w i th  min i mal   control  [EB/OL].  RFC 35 5 1 200 3.  [9]  Yun Li u. Pan o r amic techn i q u e  in the  vi de o  monitori ng s ystem and Impl ementati on.  TELKOMNIKA  Indon esi an Jou r nal of Electric al Eng i ne eri n g .  2013; 1 1 (1): 9 1 - 96.   [10] Yueq ian g   LI.   Breaki ng th Digita l  Vi de Stegan ogr aph y.  T E LKOMNIKA Indo nesi a n  Journ a l  o f   Electrical E ngi neer ing . 2 013;  11(3): 16 91- 16 96.     Evaluation Warning : The document was created with Spire.PDF for Python.