Merge "Fix minor issues in dmux default impl"

This commit is contained in:
TreeHugger Robot 2019-10-16 17:38:15 +00:00 committed by Android (Google) Code Review
commit c8eae8a64e

View file

@ -479,7 +479,8 @@ Result Demux::startPesFilterHandler(uint32_t filterId) {
if (prefix == 0x000001) { if (prefix == 0x000001) {
// TODO handle mulptiple Pes filters // TODO handle mulptiple Pes filters
mPesSizeLeft = mPesSizeLeft =
(mFilterOutputs[filterId][i + 7] << 8) | mFilterOutputs[filterId][i + 8]; (mFilterOutputs[filterId][i + 8] << 8) | mFilterOutputs[filterId][i + 9];
mPesSizeLeft += 6;
ALOGD("[Demux] pes data length %d", mPesSizeLeft); ALOGD("[Demux] pes data length %d", mPesSizeLeft);
} else { } else {
continue; continue;
@ -489,7 +490,7 @@ Result Demux::startPesFilterHandler(uint32_t filterId) {
int endPoint = min(184, mPesSizeLeft); int endPoint = min(184, mPesSizeLeft);
// append data and check size // append data and check size
vector<uint8_t>::const_iterator first = mFilterOutputs[filterId].begin() + i + 4; vector<uint8_t>::const_iterator first = mFilterOutputs[filterId].begin() + i + 4;
vector<uint8_t>::const_iterator last = mFilterOutputs[filterId].begin() + i + 3 + endPoint; vector<uint8_t>::const_iterator last = mFilterOutputs[filterId].begin() + i + 4 + endPoint;
mPesOutput.insert(mPesOutput.end(), first, last); mPesOutput.insert(mPesOutput.end(), first, last);
// size does not match then continue // size does not match then continue
mPesSizeLeft -= endPoint; mPesSizeLeft -= endPoint;
@ -800,7 +801,7 @@ void Demux::maySendInputStatusCallback() {
void Demux::maySendFilterStatusCallback(uint32_t filterId) { void Demux::maySendFilterStatusCallback(uint32_t filterId) {
std::lock_guard<std::mutex> lock(mFilterStatusLock); std::lock_guard<std::mutex> lock(mFilterStatusLock);
int availableToRead = mFilterMQs[filterId]->availableToRead(); int availableToRead = mFilterMQs[filterId]->availableToRead();
int availableToWrite = mInputMQ->availableToWrite(); int availableToWrite = mFilterMQs[filterId]->availableToWrite();
int fmqSize = mFilterMQs[filterId]->getQuantumCount(); int fmqSize = mFilterMQs[filterId]->getQuantumCount();
DemuxFilterStatus newStatus = DemuxFilterStatus newStatus =
@ -885,7 +886,6 @@ void Demux::broadcastInputThreadLoop() {
byteBuffer[index] = static_cast<uint8_t>(buffer[index]); byteBuffer[index] = static_cast<uint8_t>(buffer[index]);
} }
startTsFilter(byteBuffer); startTsFilter(byteBuffer);
inputData.seekg(packetSize, inputData.cur);
} }
startFilterDispatcher(); startFilterDispatcher();
sleep(1); sleep(1);