Add flags back to the decode unit because TI OMAP devices need them

This commit is contained in:
Cameron Gutman 2014-06-30 21:03:16 -07:00
parent ec303e485f
commit 1c82fdf048
2 changed files with 25 additions and 2 deletions

View File

@ -15,14 +15,16 @@ public class DecodeUnit {
private int dataLength;
private int frameNumber;
private long receiveTimestamp;
private int flags;
public DecodeUnit(int type, List<ByteBufferDescriptor> bufferList, int dataLength, int frameNumber, long receiveTimestamp)
public DecodeUnit(int type, List<ByteBufferDescriptor> bufferList, int dataLength, int frameNumber, long receiveTimestamp, int flags)
{
this.type = type;
this.bufferList = bufferList;
this.dataLength = dataLength;
this.frameNumber = frameNumber;
this.receiveTimestamp = receiveTimestamp;
this.flags = flags;
}
public int getType()
@ -49,4 +51,9 @@ public class DecodeUnit {
{
return frameNumber;
}
public int getFlags()
{
return flags;
}
}

View File

@ -50,8 +50,24 @@ public class VideoDepacketizer {
{
// This is the start of a new frame
if (avcFrameDataChain != null && avcFrameDataLength != 0) {
ByteBufferDescriptor firstBuffer = avcFrameDataChain.getFirst();
int flags = 0;
if (NAL.getSpecialSequenceDescriptor(firstBuffer, cachedSpecialDesc) && NAL.isAvcFrameStart(cachedSpecialDesc)) {
switch (cachedSpecialDesc.data[cachedSpecialDesc.offset+cachedSpecialDesc.length]) {
case 0x67:
case 0x68:
flags |= DecodeUnit.DU_FLAG_CODEC_CONFIG;
break;
case 0x65:
flags |= DecodeUnit.DU_FLAG_SYNC_FRAME;
break;
}
}
// Construct the H264 decode unit
DecodeUnit du = new DecodeUnit(DecodeUnit.TYPE_H264, avcFrameDataChain, avcFrameDataLength, frameNumber, frameStartTime);
DecodeUnit du = new DecodeUnit(DecodeUnit.TYPE_H264, avcFrameDataChain,
avcFrameDataLength, frameNumber, frameStartTime, flags);
if (!decodedUnits.offer(du)) {
LimeLog.warning("Video decoder is too slow! Forced to drop decode units");