1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

fix the audio or video pid generate bug.

This commit is contained in:
winlin 2015-05-30 21:40:39 +08:00
parent 96f8f1f502
commit 03d951c0fb

View file

@ -771,17 +771,21 @@ SrsTsPacket* SrsTsPacket::create_pmt(SrsTsContext* context, int16_t pmt_number,
pmt->last_section_number = 0; pmt->last_section_number = 0;
pmt->program_info_length = 0; pmt->program_info_length = 0;
// if h.264 specified, use video to carry pcr. // must got one valid codec.
if (vs == SrsTsStreamVideoH264) { srs_assert(vs == SrsTsStreamVideoH264 || as == SrsTsStreamAudioAAC || as == SrsTsStreamAudioMp3);
pmt->PCR_PID = vpid;
pmt->infos.push_back(new SrsTsPayloadPMTESInfo(vs, vpid)); // if mp3 or aac specified, use audio to carry pcr.
} else if (as == SrsTsStreamAudioAAC || as == SrsTsStreamAudioMp3) { if (as == SrsTsStreamAudioAAC || as == SrsTsStreamAudioMp3) {
// use audio to carray pcr by default. // use audio to carray pcr by default.
// for hls, there must be atleast one audio channel. // for hls, there must be atleast one audio channel.
pmt->PCR_PID = apid; pmt->PCR_PID = apid;
pmt->infos.push_back(new SrsTsPayloadPMTESInfo(as, apid)); pmt->infos.push_back(new SrsTsPayloadPMTESInfo(as, apid));
} else { }
srs_assert(false);
// if h.264 specified, use video to carry pcr.
if (vs == SrsTsStreamVideoH264) {
pmt->PCR_PID = vpid;
pmt->infos.push_back(new SrsTsPayloadPMTESInfo(vs, vpid));
} }
pmt->CRC_32 = 0; // calc in encode. pmt->CRC_32 = 0; // calc in encode.