Get offset of recorded keyframe from MTP table

Test: atest VtsHalTvTunerV1_1TargetTest
Bug: 158816517
Change-Id: Ia48637554fc5020b6de422feac7efc04c070fae7
This commit is contained in:
Amy Zhang 2020-10-28 18:35:52 -07:00
parent 8c8286e5a5
commit b12ccd3e30
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,
/**
@ -91,9 +92,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.
@ -109,6 +126,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;
};
/**
@ -118,13 +140,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;
};
@ -816,3 +838,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++;