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,6 +255,7 @@ void WritePmtWithParameters(uint8_t stream_type,
ProgramMapTableWriter::ProgramMapTableWriter(Codec codec) : codec_(codec) {} ProgramMapTableWriter::ProgramMapTableWriter(Codec codec) : codec_(codec) {}
bool ProgramMapTableWriter::EncryptedSegmentPmt(BufferWriter* writer) { bool ProgramMapTableWriter::EncryptedSegmentPmt(BufferWriter* writer) {
if (encrypted_pmt_.Size() == 0) {
uint8_t stream_type; uint8_t stream_type;
switch (codec_) { switch (codec_) {
case kCodecH264: case kCodecH264:
@ -268,7 +269,6 @@ bool ProgramMapTableWriter::EncryptedSegmentPmt(BufferWriter* writer) {
return false; return false;
} }
if (encrypted_pmt_.Size() == 0) {
BufferWriter descriptors; BufferWriter descriptors;
if (!WriteDescriptors(&descriptors)) if (!WriteDescriptors(&descriptors))
return false; return false;
@ -285,6 +285,7 @@ bool ProgramMapTableWriter::EncryptedSegmentPmt(BufferWriter* writer) {
} }
bool ProgramMapTableWriter::ClearSegmentPmt(BufferWriter* writer) { bool ProgramMapTableWriter::ClearSegmentPmt(BufferWriter* writer) {
if (clear_pmt_.Size() == 0) {
uint8_t stream_type; uint8_t stream_type;
switch (codec_) { switch (codec_) {
case kCodecH264: case kCodecH264:
@ -298,7 +299,6 @@ bool ProgramMapTableWriter::ClearSegmentPmt(BufferWriter* writer) {
return false; return false;
} }
if (clear_pmt_.Size() == 0) {
WritePmtWithParameters(stream_type, kVersion0, kCurrent, nullptr, 0, WritePmtWithParameters(stream_type, kVersion0, kCurrent, nullptr, 0,
&clear_pmt_); &clear_pmt_);
DCHECK_NE(clear_pmt_.Size(), 0u); DCHECK_NE(clear_pmt_.Size(), 0u);