Ignore Splice Info in HLS TS media chunks
Issue:#2070 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=141335458
This commit is contained in:
parent
1518927e12
commit
2fce364936
@ -31,13 +31,14 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
|
|||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef(flag = true, value = {FLAG_ALLOW_NON_IDR_KEYFRAMES, FLAG_IGNORE_AAC_STREAM,
|
@IntDef(flag = true, value = {FLAG_ALLOW_NON_IDR_KEYFRAMES, FLAG_IGNORE_AAC_STREAM,
|
||||||
FLAG_IGNORE_H264_STREAM, FLAG_DETECT_ACCESS_UNITS})
|
FLAG_IGNORE_H264_STREAM, FLAG_DETECT_ACCESS_UNITS, FLAG_IGNORE_SPLICE_INFO_STREAM})
|
||||||
public @interface Flags {
|
public @interface Flags {
|
||||||
}
|
}
|
||||||
public static final int FLAG_ALLOW_NON_IDR_KEYFRAMES = 1;
|
public static final int FLAG_ALLOW_NON_IDR_KEYFRAMES = 1;
|
||||||
public static final int FLAG_IGNORE_AAC_STREAM = 2;
|
public static final int FLAG_IGNORE_AAC_STREAM = 2;
|
||||||
public static final int FLAG_IGNORE_H264_STREAM = 4;
|
public static final int FLAG_IGNORE_H264_STREAM = 4;
|
||||||
public static final int FLAG_DETECT_ACCESS_UNITS = 8;
|
public static final int FLAG_DETECT_ACCESS_UNITS = 8;
|
||||||
|
public static final int FLAG_IGNORE_SPLICE_INFO_STREAM = 16;
|
||||||
|
|
||||||
@Flags
|
@Flags
|
||||||
private final int flags;
|
private final int flags;
|
||||||
@ -62,8 +63,8 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
|
|||||||
case TsExtractor.TS_STREAM_TYPE_MPA_LSF:
|
case TsExtractor.TS_STREAM_TYPE_MPA_LSF:
|
||||||
return new PesReader(new MpegAudioReader(esInfo.language));
|
return new PesReader(new MpegAudioReader(esInfo.language));
|
||||||
case TsExtractor.TS_STREAM_TYPE_AAC:
|
case TsExtractor.TS_STREAM_TYPE_AAC:
|
||||||
return (flags & FLAG_IGNORE_AAC_STREAM) != 0 ? null
|
return isSet(FLAG_IGNORE_AAC_STREAM)
|
||||||
: new PesReader(new AdtsReader(false, esInfo.language));
|
? null : new PesReader(new AdtsReader(false, esInfo.language));
|
||||||
case TsExtractor.TS_STREAM_TYPE_AC3:
|
case TsExtractor.TS_STREAM_TYPE_AC3:
|
||||||
case TsExtractor.TS_STREAM_TYPE_E_AC3:
|
case TsExtractor.TS_STREAM_TYPE_E_AC3:
|
||||||
return new PesReader(new Ac3Reader(esInfo.language));
|
return new PesReader(new Ac3Reader(esInfo.language));
|
||||||
@ -73,13 +74,13 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
|
|||||||
case TsExtractor.TS_STREAM_TYPE_H262:
|
case TsExtractor.TS_STREAM_TYPE_H262:
|
||||||
return new PesReader(new H262Reader());
|
return new PesReader(new H262Reader());
|
||||||
case TsExtractor.TS_STREAM_TYPE_H264:
|
case TsExtractor.TS_STREAM_TYPE_H264:
|
||||||
return (flags & FLAG_IGNORE_H264_STREAM) != 0 ? null
|
return isSet(FLAG_IGNORE_H264_STREAM) ? null : new PesReader(
|
||||||
: new PesReader(new H264Reader((flags & FLAG_ALLOW_NON_IDR_KEYFRAMES) != 0,
|
new H264Reader(isSet(FLAG_ALLOW_NON_IDR_KEYFRAMES), isSet(FLAG_DETECT_ACCESS_UNITS)));
|
||||||
(flags & FLAG_DETECT_ACCESS_UNITS) != 0));
|
|
||||||
case TsExtractor.TS_STREAM_TYPE_H265:
|
case TsExtractor.TS_STREAM_TYPE_H265:
|
||||||
return new PesReader(new H265Reader());
|
return new PesReader(new H265Reader());
|
||||||
case TsExtractor.TS_STREAM_TYPE_SPLICE_INFO:
|
case TsExtractor.TS_STREAM_TYPE_SPLICE_INFO:
|
||||||
return new SectionReader(new SpliceInfoSectionReader());
|
return isSet(FLAG_IGNORE_SPLICE_INFO_STREAM)
|
||||||
|
? null : new SectionReader(new SpliceInfoSectionReader());
|
||||||
case TsExtractor.TS_STREAM_TYPE_ID3:
|
case TsExtractor.TS_STREAM_TYPE_ID3:
|
||||||
return new PesReader(new Id3Reader());
|
return new PesReader(new Id3Reader());
|
||||||
default:
|
default:
|
||||||
@ -87,4 +88,8 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSet(@Flags int flag) {
|
||||||
|
return (flags & flag) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
// MPEG-2 TS segments, but we need a new extractor.
|
// MPEG-2 TS segments, but we need a new extractor.
|
||||||
// This flag ensures the change of pid between streams does not affect the sample queues.
|
// This flag ensures the change of pid between streams does not affect the sample queues.
|
||||||
@DefaultTsPayloadReaderFactory.Flags
|
@DefaultTsPayloadReaderFactory.Flags
|
||||||
int esReaderFactoryFlags = 0;
|
int esReaderFactoryFlags = DefaultTsPayloadReaderFactory.FLAG_IGNORE_SPLICE_INFO_STREAM;
|
||||||
String codecs = trackFormat.codecs;
|
String codecs = trackFormat.codecs;
|
||||||
if (!TextUtils.isEmpty(codecs)) {
|
if (!TextUtils.isEmpty(codecs)) {
|
||||||
// Sometimes AAC and H264 streams are declared in TS chunks even though they don't really
|
// Sometimes AAC and H264 streams are declared in TS chunks even though they don't really
|
||||||
|
Loading…
x
Reference in New Issue
Block a user