Cleanup ProgramMapTableWriter

Change-Id: I08093a0fc35dc15a20f6e72166ed46d3ab94b334
This commit is contained in:
KongQun Yang 2017-10-25 13:29:22 -07:00
parent 2a2493ec2e
commit 79a54d7748
1 changed files with 26 additions and 26 deletions

View File

@ -255,20 +255,20 @@ void WritePmtWithParameters(uint8_t stream_type,
ProgramMapTableWriter::ProgramMapTableWriter(Codec codec) : codec_(codec) {}
bool ProgramMapTableWriter::EncryptedSegmentPmt(BufferWriter* writer) {
uint8_t stream_type;
switch (codec_) {
case kCodecH264:
stream_type = kStreamTypeEncryptedH264;
break;
case kCodecAAC:
stream_type = kStreamTypeEncryptedAdtsAac;
break;
default:
LOG(ERROR) << "Codec " << codec_ << " is not supported in TS yet.";
return false;
}
if (encrypted_pmt_.Size() == 0) {
uint8_t stream_type;
switch (codec_) {
case kCodecH264:
stream_type = kStreamTypeEncryptedH264;
break;
case kCodecAAC:
stream_type = kStreamTypeEncryptedAdtsAac;
break;
default:
LOG(ERROR) << "Codec " << codec_ << " is not supported in TS yet.";
return false;
}
BufferWriter descriptors;
if (!WriteDescriptors(&descriptors))
return false;
@ -285,20 +285,20 @@ bool ProgramMapTableWriter::EncryptedSegmentPmt(BufferWriter* writer) {
}
bool ProgramMapTableWriter::ClearSegmentPmt(BufferWriter* writer) {
uint8_t stream_type;
switch (codec_) {
case kCodecH264:
stream_type = kStreamTypeH264;
break;
case kCodecAAC:
stream_type = kStreamTypeAdtsAac;
break;
default:
LOG(ERROR) << "Codec " << codec_ << " is not supported in TS yet.";
return false;
}
if (clear_pmt_.Size() == 0) {
uint8_t stream_type;
switch (codec_) {
case kCodecH264:
stream_type = kStreamTypeH264;
break;
case kCodecAAC:
stream_type = kStreamTypeAdtsAac;
break;
default:
LOG(ERROR) << "Codec " << codec_ << " is not supported in TS yet.";
return false;
}
WritePmtWithParameters(stream_type, kVersion0, kCurrent, nullptr, 0,
&clear_pmt_);
DCHECK_NE(clear_pmt_.Size(), 0u);