winlin

fix the audio or video pid generate bug.

@@ -771,17 +771,21 @@ SrsTsPacket* SrsTsPacket::create_pmt(SrsTsContext* context, int16_t pmt_number, @@ -771,17 +771,21 @@ SrsTsPacket* SrsTsPacket::create_pmt(SrsTsContext* context, int16_t pmt_number,
771 pmt->last_section_number = 0; 771 pmt->last_section_number = 0;
772 pmt->program_info_length = 0; 772 pmt->program_info_length = 0;
773 773
774 - // if h.264 specified, use video to carry pcr.  
775 - if (vs == SrsTsStreamVideoH264) {  
776 - pmt->PCR_PID = vpid;  
777 - pmt->infos.push_back(new SrsTsPayloadPMTESInfo(vs, vpid));  
778 - } else if (as == SrsTsStreamAudioAAC || as == SrsTsStreamAudioMp3) { 774 + // must got one valid codec.
  775 + srs_assert(vs == SrsTsStreamVideoH264 || as == SrsTsStreamAudioAAC || as == SrsTsStreamAudioMp3);
  776 +
  777 + // if mp3 or aac specified, use audio to carry pcr.
  778 + if (as == SrsTsStreamAudioAAC || as == SrsTsStreamAudioMp3) {
779 // use audio to carray pcr by default. 779 // use audio to carray pcr by default.
780 // for hls, there must be atleast one audio channel. 780 // for hls, there must be atleast one audio channel.
781 pmt->PCR_PID = apid; 781 pmt->PCR_PID = apid;
782 pmt->infos.push_back(new SrsTsPayloadPMTESInfo(as, apid)); 782 pmt->infos.push_back(new SrsTsPayloadPMTESInfo(as, apid));
783 - } else {  
784 - srs_assert(false); 783 + }
  784 +
  785 + // if h.264 specified, use video to carry pcr.
  786 + if (vs == SrsTsStreamVideoH264) {
  787 + pmt->PCR_PID = vpid;
  788 + pmt->infos.push_back(new SrsTsPayloadPMTESInfo(vs, vpid));
785 } 789 }
786 790
787 pmt->CRC_32 = 0; // calc in encode. 791 pmt->CRC_32 = 0; // calc in encode.