Merge "Get offset of recorded keyframe from MTP table"

This commit is contained in:
TreeHugger Robot
2020-11-05 02:48:42 +00:00
committed by Android (Google) Code Review
4 changed files with 59 additions and 12 deletions

View File

@@ -209,6 +209,7 @@ Return<void> Filter::getAvSharedHandle(getAvSharedHandle_cb _hidl_cb) {
if (mSharedAvMemHandle.getNativeHandle() != nullptr) {
_hidl_cb(Result::SUCCESS, mSharedAvMemHandle, BUFFER_SIZE_16M);
mUsingSharedAvMem = true;
return Void();
}
@@ -225,6 +226,7 @@ Return<void> Filter::getAvSharedHandle(getAvSharedHandle_cb _hidl_cb) {
::close(av_fd);
_hidl_cb(Result::SUCCESS, mSharedAvMemHandle, BUFFER_SIZE_16M);
mUsingSharedAvMem = true;
return Void();
}
@@ -678,11 +680,10 @@ Result Filter::startRecordFilterHandler() {
recordEvent = {
.byteNumber = mRecordFilterOutput.size(),
};
V1_1::DemuxFilterRecordEventExt recordEventExt;
V1_1::DemuxFilterTsRecordEventExt recordEventExt;
recordEventExt = {
.pts = (mPts == 0) ? time(NULL) * 900000 : mPts,
.firstMbInSlice = 0, // random address
.mpuSequenceNumber = 1, // random sequence number
};
int size;

View File

@@ -227,7 +227,7 @@ class Filter : public V1_1::IFilter {
// Shared A/V memory handle
hidl_handle mSharedAvMemHandle;
bool mUsingSharedAvMem = true;
bool mUsingSharedAvMem = false;
uint32_t mSharedAvMemOffset = 0;
uint32_t mAudioStreamType;

View File

@@ -20,6 +20,7 @@ import @1.0::Constant;
import @1.0::DemuxFilterMmtpRecordEvent;
import @1.0::DemuxFilterTsRecordEvent;
import @1.0::DemuxScIndex;
import @1.0::DemuxTsIndex;
import @1.0::FrontendIsdbs3Rolloff;
import @1.0::FrontendAtsc3Bandwidth;
import @1.0::FrontendAtsc3Modulation;
@@ -51,11 +52,11 @@ import android.hidl.safe_union@1.0::Monostate;
@export
enum Constant : @1.0::Constant {
/**
* An invalid mpuSequenceNumber in DemuxFilterRecordEventExt.
* An invalid mpuSequenceNumber.
*/
INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = 0xFFFFFFFF,
/**
* An invalid first macroblock address in DemuxFilterRecordEventExt.
* An invalid first macroblock address.
*/
INVALID_FIRST_MACROBLOCK_IN_SLICE = 0xFFFFFFFF,
/**
@@ -103,9 +104,25 @@ enum Constant64Bit : uint64_t {
};
/**
* Extended Demux Filter Record Event.
* Extended Demux Filter TS Record Event.
*/
struct DemuxFilterRecordEventExt {
struct DemuxFilterTsRecordEventExt {
/**
* The Presentation Time Stamp(PTS) for the audio or video frame. It is based on 90KHz
* and has the same format as the PTS in ISO/IEC 13818-1.
*/
uint64_t pts;
/**
* Specifies the address of the first macroblock in the slice defined in ITU-T Rec. H.264.
*/
uint32_t firstMbInSlice;
};
/**
* Extended Demux Filter MMTP Record Event.
*/
struct DemuxFilterMmtpRecordEventExt {
/**
* The Presentation Time Stamp(PTS) for the audio or video frame. It is based on 90KHz
* and has the same format as the PTS in ISO/IEC 13818-1.
@@ -121,6 +138,11 @@ struct DemuxFilterRecordEventExt {
* Specifies the address of the first macroblock in the slice defined in ITU-T Rec. H.264.
*/
uint32_t firstMbInSlice;
/**
* TS index mask.
*/
bitfield<@1.1::DemuxTsIndex> tsIndexMask;
};
/**
@@ -130,13 +152,13 @@ struct DemuxFilterEventExt {
safe_union Event {
/**
* No extended record filter Event. This is used by the tsRecord or mmtpRecord filter event
* that does not contain the DemuxFilterRecordEventExt information.
* that does not contain the DemuxFilterTs/MmtpRecordEventExt information.
*/
Monostate noinit;
DemuxFilterRecordEventExt tsRecord;
DemuxFilterTsRecordEventExt tsRecord;
DemuxFilterRecordEventExt mmtpRecord;
DemuxFilterMmtpRecordEventExt mmtpRecord;
ScramblingStatus scramblingStatus;
};
@@ -828,3 +850,27 @@ enum DemuxScIndex : @1.0::DemuxScIndex {
*/
SP_SLICE = 1 << 8,
};
@export
enum DemuxTsIndex : @1.0::DemuxTsIndex {
/**
* Index the address of MMT Packet Table(MPT).
*/
MPT_INDEX_MPT = 1 << 16,
/**
* Index the address of Video.
*/
MPT_INDEX_VIDEO = 1 << 17,
/**
* Index the address of Audio.
*/
MPT_INDEX_AUDIO = 1 << 18,
/**
* Index to indicate this is a target of timestamp extraction for video.
*/
MPT_INDEX_TIMESTAMP_TARGET_VIDEO = 1 << 19,
/**
* Index to indicate this is a target of timestamp extraction for audio.
*/
MPT_INDEX_TIMESTAMP_TARGET_AUDIO = 1 << 20,
};

View File

@@ -64,9 +64,9 @@ void FilterCallback::readFilterEventData() {
break;
case DemuxFilterEventExt::Event::hidl_discriminator::mmtpRecord:
ALOGD("[vts] Extended MMTP record filter event, pts=%" PRIu64
", firstMbInSlice=%d, mpuSequenceNumber=%d",
", firstMbInSlice=%d, mpuSequenceNumber=%d, tsIndexMask=%d",
eventExt.mmtpRecord().pts, eventExt.mmtpRecord().firstMbInSlice,
eventExt.mmtpRecord().mpuSequenceNumber);
eventExt.mmtpRecord().mpuSequenceNumber, eventExt.mmtpRecord().tsIndexMask);
break;
case DemuxFilterEventExt::Event::hidl_discriminator::scramblingStatus:
mScramblingStatusEvent++;