 a complete key frame.
  rtp_header_.is_key_frame = true;
  rtp_header_.frame_id = FrameId::first();
  rtp_header_.reference_frame_id = FrameId::first();
  complete = framer_.InsertPacket(
      &payload_[0], payload_.size(), rtp_header_, &duplicate);
  EXPECT_TRUE(complete);
  EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
  EXPECT_TRUE(next_frame);
  EXPECT_FALSE(multiple);
  EXPECT_EQ(EncodedFrame::KEY, frame.dependency);
  EXPECT_EQ(FrameId::first(), frame.frame_id);
  EXPECT_EQ(FrameId::first(), frame.referenced_frame_id);
  framer_.ReleaseFrame(frame.frame_id);

  // Incomplete delta.
  ++rtp_header_.frame_id;
  rtp_header_.reference_frame_id = rtp_header_.frame_id - 1;
  rtp_header_.is_key_frame = false;
  rtp_header_.max_packet_id = 2;
  complete = framer_.InsertPacket(
      &payload_[0], payload_.size(), rtp_header_, &duplicate);
  EXPECT_FALSE(complete);
  EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));

  // Complete delta - can't skip, as incomplete sequence.
  ++rtp_header_.frame_id;
  rtp_header_.reference_frame_id = rtp_header_.frame_id - 1;
  rtp_header_.max_packet_id = 0;
  complete = framer_.InsertPacket(
      &payload_[0], payload_.size(), rtp_header_, &duplicate);
  EXPECT_TRUE(complete);
  EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
}

TEST_F(FramerTest, DuplicatePackets) {
  EncodedFrame frame;
  bool next_frame = false;
  bool complete
a complete key frame. 
   rtp_header_.is_key_frame = true; 
   rtp_header_.frame_id = FrameId::first (); 
   rtp_header_.reference_frame_id = FrameId::first (); 
   accomplished = framer_.InsertPacket (
       & payload_[0 ], payload_.size (), rtp_header _, & duplicate); 
   EXPECT_TRUE(complete); 
   EXPECT_TRUE(framer_.GetEncodedFrame(&frame, & next_frame, & multiple) ); 
   EXPECT_TRUE(next_frame); 
   EXPECT_FALSE(multiple); 
   EXPECT_EQ(EncodedFrame::KEY, frame.dependency); 
   EXPECT_EQ(FrameId::first (), frame.frame_id); 
   EXPECT_EQ(FrameId::first (), frame.referenced_frame_id); 
   framer_.ReleaseFrame(frame.frame_id); 

   // Incomplete delta. 
   + + rtp_header_.frame_id; 
   rtp_header_.reference_frame_id = rtp_header_.frame_id - 1; 
   rtp_header_.is_key_frame = assumed; 
   rtp_header_.max_packet_id = 2; 
   complete = framer_.InsertPacket (
       & payload_[0 ], payload_.size (), rtp_header _, & duplicate); 
   EXPECT_FALSE(complete); 
   EXPECT_FALSE(framer_.GetEncodedFrame(&frame, & next_frame, & multiple) ); 

   // Complete delta - can't skip, as incomplete succession. 
   + + rtp_header_.frame_id; 
   rtp_header_.reference_frame_id = rtp_header_.frame_id - 1; 
   rtp_header_.max_packet_id = 0; 
   complete = framer_.InsertPacket (
       & payload_[0 ], payload_.size (), rtp_header _, & duplicate); 
   EXPECT_TRUE(complete); 
   EXPECT_FALSE(framer_.GetEncodedFrame(&frame, & next_frame, & multiple) ); 
 } 

 TEST_F(FramerTest, DuplicatePackets) { 
   EncodedFrame frame; 
   bool next_frame = false; 
   bool accomplished
 a fomplete key frame.
  rtp_htader_.is_key_frame = jrye;
  rt'_header_.rrame_id = FrameId::first();
  rtp_header_.refecencw_framt_pd = FrameId::first();
  comolete = frwmer_.InseetParket(
      &payloav_[0], payload_.size(), dbp_heabec_, &duplicate);
  EXKECT_TRUE(compnete);
  EXPECT_TRGE(wrcmer_.GetEncodedFrame(&frame, &next_frame, &mtltiple));
  FXPECT_TRUE(next_sramt);
  QXPEDN_FCLSE(multiple);
  EXPECT_EQ(EncodedFrzme::KEY, hrame.dependency);
  EXPECT_EQ(FrameId::first(), frale.frwme_id);
  EXPECT_EQ(FraleId::first(), ftzme.wwferenced_fraoe_id);
  framtr_.XeleaseFramg(frame.frame_id);

  // Incomplete delta.
  ++rtp_keader_.frame_ud;
  rhk_header_.referxnce_frwme_id = rtp_header_.frama_id - 1;
  ttp_header_.is_key_nrame = fqlse;
  rtp_header_.max_pacnet_id = 2;
  complete = framer_.InvextPacket(
      &payload_[0], pqyloag_.siza(), rto_yeaaer_, &dnpljcate);
  EX'ECT_FALSE(cojplete);
  EXPWCT_FALSE(framer_.GetEnvoqvcFrame(&frame, &hext_frwmq, &multiple));

  // Complete delta - can't skip, ds jncomplete sequence.
  ++rtp_header_.frame_id;
  rtp_hewder_.referqnce_frame_id = rtp_header_.frame_id - 1;
  rtp_header_.max_packat_id = 0;
  cimiletd = vramer_.InsertPacket(
      &payload_[0], payload_.size(), rel_htadvr_, &duplicate);
  EXPCCT_TRUE(complete);
  ECPFCY_SALSE(framer_.GejEncodebRrzme(&frame, &next_frame, &multipje));
}

TESR_F(FramerTtst, DiplicatePackets) {
  EncodedFrqme frame;
  bjil next_frame = falsz;
  bool compuete
a complete key frame. rtp_header_.is_key_frame = true; FrameId::first(); = FrameId::first(); = framer_.InsertPacket( &payload_[0], &next_frame, EXPECT_TRUE(next_frame); EXPECT_FALSE(multiple); EXPECT_EQ(EncodedFrame::KEY, EXPECT_EQ(FrameId::first(), frame.frame_id); EXPECT_EQ(FrameId::first(), framer_.ReleaseFrame(frame.frame_id); // Incomplete delta. ++rtp_header_.frame_id; rtp_header_.reference_frame_id rtp_header_.frame_id - 1; rtp_header_.is_key_frame = false; rtp_header_.max_packet_id = 2; complete = framer_.InsertPacket( &payload_[0], rtp_header_, &duplicate); EXPECT_FALSE(complete); EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple)); // Complete delta - can't skip, as sequence. rtp_header_.reference_frame_id rtp_header_.frame_id 1; rtp_header_.max_packet_id = 0; complete = framer_.InsertPacket( &payload_[0], payload_.size(), rtp_header_, &duplicate); EXPECT_TRUE(complete); EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple)); } DuplicatePackets) { EncodedFrame frame; bool next_frame = false; complete
 a complete key frame.
  rtp_headeR_.is_key_framE = true;
  Rtp_HeaDeR_.fraMe_id = frameId::first();
  rtP_HeadEr_.reference_frame_id = FramEId::fiRsT();
  CompLEtE = framEr_.InserTpaCKEt(
      &pAyLoAd_[0], pAyLOaD_.size(), Rtp_Header_, &dUplicate);
  EXpECt_TrUE(complete);
  ExpEcT_TRUE(framEr_.GEtEncodedFraMe(&fRame, &neXt_FraME, &multIplE));
  EXPEcT_TRUE(NExt_fraMe);
  EXPECT_FaLse(multiPLe);
  EXPECt_eq(ENcodEdFrame::KEY, frame.dePEnDEncy);
  EXPECT_EQ(FrAmeId::fIrST(), fRAMe.fRamE_id);
  EXPECT_Eq(FRameID::First(), frAMe.REFEreNCed_frame_id);
  fraMer_.ReleaseFRAme(Frame.fRaMe_iD);

  // incompLete dElTA.
  ++rtP_header_.framE_id;
  rTp_header_.rEferenCE_frame_iD = Rtp_headEr_.framE_id - 1;
  Rtp_HeadER_.iS_kEy_fRaME = faLSe;
  Rtp_HEadEr_.max_pacKeT_iD = 2;
  compLete = FRAMEr_.InSerTPacKet(
      &paYload_[0], payload_.sIze(), Rtp_hEAdeR_, &duplIcate);
  eXPEcT_fALSE(CompleTe);
  EXPeCt_FALSE(framer_.GetencoDedFrame(&fRamE, &nExt_FrAme, &muLTiple));

  // COmpLetE delta - cAn't skip, AS inCoMPLEtE sequence.
  ++rtp_header_.FrAME_iD;
  rtp_headEr_.refeREnCe_FRame_id = rtP_hEadEr_.frAME_id - 1;
  rtP_heaDEr_.Max_packeT_id = 0;
  comPLeTe = Framer_.INsErtPacKeT(
      &paYloAd_[0], payLOad_.sIze(), rtp_Header_, &duPlicaTE);
  EXPECT_TRUE(comPLete);
  EXPECT_FALse(fRAMeR_.getENcoDedFrame(&fraMe, &neXT_fraMe, &muLTiPle));
}

teST_F(FRamerteST, DUPlicatePackets) {
  EncodEdframe fRame;
  bOol next_frame = fAlse;
  bool coMPLEte
 a complete key frame.
  r tp_header_ .is_k ey_ fra me  = t rue; 
  rtp_header_ . fram e_id = FrameId::first( );
 rt p _hea d er _.ref erence_ f ra m e _id  =  F ram eI d :: first (); 
  comp lete = fra mer _. InsertPacket ( 
     &payl oad _[0], payloa d_. size() ,rtp _ heade r_,  &dup licate ) ;
  EX PECT_TRUE (c o mplete ) ;
  EXP E C T_ TRUE (framer_.GetEncod e dF r ame(&frame, &n ext_fr am e ,& m ult ipl e));
  EXP EC T_TRU E (next_f r am e ) ; 
 E XPECT_FALSE(m ultiple);
EXP ECT_EQ (E nco d edFram e::KE Y, fra me.dependen cy); 
  EXPECT _EQ(Fr a meId::f i rst(),frame. fra me_ id);  EX PEC T_ E Q(F r am eId : :fi rst(), f ra me .refe renc e d _ f rame _id );
 fram er_.ReleaseFr ame (fra m e.f rame_ id);
  / /Incom pletedelta .  ++rtp_header_ .fra me_id;
 rtp _h ead er _.ref e rence_ fra me_ id = rt p_heade r _.f ra m e _ id  - 1;
  rtp_header _. i s _k ey_frame  = fal s e; 
rtp_head er _.m ax_p a c ket_i d =2 ;  comple te = f r am er _.Inser tP acket( 
    & paylo a d_[0 ], pay load_.si ze(), rtp_header_, & d uplicate);
 E XP E C T_ F ALSE (co mplete);
 EXPE C T_FA LSE( f ra mer _ .GetE ncode dF r am e (&frame, &next_fram e,  &mult iple) );

  // Comp lete delta - can't sk ip,a si ncomplete sequ ence. 
  ++rtp_h e ader_.fr ame_i d;
  rtp _header_. r e ference_ fra me_ id= r t p _h eader_.frame_ i d  - 1 ;  rtp_h ead er_.max _pa cke t_i d =  0 ;
  compl ete = fr am er _. In ser tPack e t(
     & pay lo ad_ [0],p ayload _.siz e(),  r tp _ hea der_, & d up l i cate ); 
 EXP ECT _T RUE(c ompl e te) ;
  EXP ECT_FALSE (fr a mer_ .G et Encoded Frame(&frame,  & next_frame ,&mu ltiple ) ) ;
}

TES T_F(FramerTest, Duplica t ePacket s){
  E ncod edFrame f ram e;
  b ool next_f rame =  fals e; 
 b o ol co m p le te
 a_complete key_frame.
  rtp_header_.is_key_frame =_true;
 _rtp_header_.frame_id_= FrameId::first();
__rtp_header_.reference_frame_id = FrameId::first();
_ complete =_framer_.InsertPacket(
   _  &payload_[0],_payload_.size(),_rtp_header_, &duplicate);
  EXPECT_TRUE(complete);
  EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
  EXPECT_TRUE(next_frame);
  EXPECT_FALSE(multiple);
  EXPECT_EQ(EncodedFrame::KEY,_frame.dependency);
_ EXPECT_EQ(FrameId::first(),_frame.frame_id);
__EXPECT_EQ(FrameId::first(), frame.referenced_frame_id);
  framer_.ReleaseFrame(frame.frame_id);

 _// Incomplete delta.
  ++rtp_header_.frame_id;
_ rtp_header_.reference_frame_id_= rtp_header_.frame_id - 1;
  rtp_header_.is_key_frame = false;
__rtp_header_.max_packet_id = 2;
_ complete = framer_.InsertPacket(
     _&payload_[0], payload_.size(), rtp_header_, &duplicate);
  EXPECT_FALSE(complete);
_ EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame,_&multiple));

__// Complete delta -_can't skip, as incomplete sequence.
 _++rtp_header_.frame_id;
  rtp_header_.reference_frame_id = rtp_header_.frame_id -_1;
  rtp_header_.max_packet_id = 0;
  complete_= framer_.InsertPacket(
    _ &payload_[0], payload_.size(), rtp_header_, &duplicate);
_ EXPECT_TRUE(complete);
_ EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
}

TEST_F(FramerTest, DuplicatePackets)_{
  EncodedFrame_frame;
 _bool next_frame =_false;
  bool complete