Loading media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +9 −26 Original line number Original line Diff line number Diff line Loading @@ -643,39 +643,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, AudioDecHidlTest::standardComp comp, bool signalEOS = true) { AudioDecHidlTest::standardComp comp, bool signalEOS = true) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; size_t index; // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i); } // dispatch input buffers uint32_t flags = 0; uint32_t flags = 0; int frameID = offset; int frameID = offset; for (size_t i = 0; (i < iBuffer->size()) && (frameID < (int)Info->size()) && (frameID < (offset + range)); i++) { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE((*Info)[frameID].bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, (*Info)[frameID].bytesCount, flags, (*Info)[frameID].timestamp); frameID++; } int timeOut = TIMEOUT_COUNTER_Q; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); // Port Reconfiguration // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK && if (status == android::hardware::media::omx::V1_0::Status::OK && msg.type == Message::Type::EVENT) { msg.type == Message::Type::EVENT) { Loading @@ -688,7 +665,6 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, if (frameID == (int)Info->size() || frameID == (offset + range)) break; if (frameID == (int)Info->size() || frameID == (offset + range)) break; // Dispatch input buffer // Dispatch input buffer size_t index = 0; if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { char* ipBuffer = static_cast<char*>( char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); Loading @@ -697,6 +673,11 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; flags = (*Info)[frameID].flags; // Indicate to omx core that the buffer contains a full frame worth // of data flags |= OMX_BUFFERFLAG_ENDOFFRAME; // Indicate the omx core that this is the last buffer it needs to // process if (signalEOS && ((frameID == (int)Info->size() - 1) || if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; flags |= OMX_BUFFERFLAG_EOS; Loading @@ -706,10 +687,12 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, frameID++; frameID++; iQueued = true; iQueued = true; } } // Dispatch output buffer if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { dispatchOutputBuffer(omxNode, oBuffer, index); dispatchOutputBuffer(omxNode, oBuffer, index); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp +5 −22 Original line number Original line Diff line number Diff line Loading @@ -376,44 +376,25 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, bool signalEOS = true) { bool signalEOS = true) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; size_t index; // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i); } // dispatch input buffers int bytesCount = samplesPerFrame * nChannels * 2; int bytesCount = samplesPerFrame * nChannels * 2; int32_t timestampIncr = int32_t timestampIncr = (int)(((float)samplesPerFrame / nSampleRate) * 1000000); (int)(((float)samplesPerFrame / nSampleRate) * 1000000); uint64_t timestamp = 0; uint64_t timestamp = 0; uint32_t flags = 0; uint32_t flags = 0; for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE(bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); eleStream.read(ipBuffer, bytesCount); if (eleStream.gcount() != bytesCount) break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, timestamp); timestamp += timestampIncr; nFrames--; } int timeOut = TIMEOUT_COUNTER_Q; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); if (status == android::hardware::media::omx::V1_0::Status::OK) if (status == android::hardware::media::omx::V1_0::Status::OK) ASSERT_TRUE(false); ASSERT_TRUE(false); if (nFrames == 0) break; if (nFrames == 0) break; // Dispatch input buffer // Dispatch input buffer size_t index = 0; if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { char* ipBuffer = static_cast<char*>( char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); Loading @@ -421,7 +402,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, static_cast<int>((*iBuffer)[index].mMemory->getSize())); static_cast<int>((*iBuffer)[index].mMemory->getSize())); eleStream.read(ipBuffer, bytesCount); eleStream.read(ipBuffer, bytesCount); if (eleStream.gcount() != bytesCount) break; if (eleStream.gcount() != bytesCount) break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; flags = OMX_BUFFERFLAG_ENDOFFRAME; if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, timestamp); timestamp); timestamp += timestampIncr; timestamp += timestampIncr; Loading @@ -433,6 +415,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, dispatchOutputBuffer(omxNode, oBuffer, index); dispatchOutputBuffer(omxNode, oBuffer, index); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +9 −26 Original line number Original line Diff line number Diff line Loading @@ -601,39 +601,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, bool signalEOS = true) { bool signalEOS = true) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; size_t index; // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode); } // dispatch input buffers uint32_t flags = 0; uint32_t flags = 0; int frameID = offset; int frameID = offset; for (size_t i = 0; (i < iBuffer->size()) && (frameID < (int)Info->size()) && (frameID < (offset + range)); i++) { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE((*Info)[frameID].bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, (*Info)[frameID].bytesCount, flags, (*Info)[frameID].timestamp); frameID++; } int timeOut = TIMEOUT_COUNTER_Q; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); // Port Reconfiguration // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK && if (status == android::hardware::media::omx::V1_0::Status::OK && msg.type == Message::Type::EVENT) { msg.type == Message::Type::EVENT) { Loading @@ -645,7 +622,6 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, if (frameID == (int)Info->size() || frameID == (offset + range)) break; if (frameID == (int)Info->size() || frameID == (offset + range)) break; // Dispatch input buffer // Dispatch input buffer size_t index = 0; if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { char* ipBuffer = static_cast<char*>( char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); Loading @@ -654,6 +630,11 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; flags = (*Info)[frameID].flags; // Indicate to omx core that the buffer contains a full frame worth // of data flags |= OMX_BUFFERFLAG_ENDOFFRAME; // Indicate the omx core that this is the last buffer it needs to // process if (signalEOS && ((frameID == (int)Info->size() - 1) || if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; flags |= OMX_BUFFERFLAG_EOS; Loading @@ -663,10 +644,12 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, frameID++; frameID++; iQueued = true; iQueued = true; } } // Dispatch output buffer if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp +12 −41 Original line number Original line Diff line number Diff line Loading @@ -983,58 +983,25 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, sp<CodecProducerListener> listener = nullptr) { sp<CodecProducerListener> listener = nullptr) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; uint32_t ipCount = 0; uint64_t timestamp = 0; uint32_t flags = 0; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; uint32_t ipCount = 0; if (ipCount == 0) { if (ipCount == 0) { status = changeFrameRate(omxNode, portIndexOutput, (24U << 16)); status = changeFrameRate(omxNode, portIndexOutput, (24U << 16)); if (status == ::android::hardware::media::omx::V1_0::Status::OK) if (status == ::android::hardware::media::omx::V1_0::Status::OK) xFramerate = (24U << 16); xFramerate = (24U << 16); } } // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i); } // dispatch input buffers int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16)); int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16)); // timestamp scale = Nano sec if (inputDataIsMeta) timestampIncr *= 1000; // timestamp scale: Nano sec if (inputDataIsMeta) timestampIncr *= 1000; uint64_t timestamp = 0; uint32_t flags = 0; for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) { if (inputDataIsMeta) { if (listener->freeBuffers > listener->minUnDequeuedCount) { if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer, portIndexInput, eleStream, timestamp)) break; timestamp += timestampIncr; nFrames--; ipCount++; } } else { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE(bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, eleStream)) break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, timestamp); if (timestampUslist) timestampUslist->push_back(timestamp); timestamp += timestampIncr; nFrames--; ipCount++; } } int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK) { if (status == android::hardware::media::omx::V1_0::Status::OK) { ASSERT_EQ(msg.type, Message::Type::EVENT); ASSERT_EQ(msg.type, Message::Type::EVENT); if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { Loading Loading @@ -1076,7 +1043,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, eleStream)) eleStream)) break; break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; flags = OMX_BUFFERFLAG_ENDOFFRAME; if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, timestamp); timestamp); if (timestampUslist) timestampUslist->push_back(timestamp); if (timestampUslist) timestampUslist->push_back(timestamp); Loading @@ -1086,10 +1054,12 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, iQueued = true; iQueued = true; } } } } // Dispatch output buffer if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { dispatchOutputBuffer(omxNode, oBuffer, index); dispatchOutputBuffer(omxNode, oBuffer, index); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading @@ -1098,6 +1068,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; break; break; } } // Runtime Param Configuration if (ipCount == 15) { if (ipCount == 15) { changeBitrate(omxNode, portIndexOutput, 768000); changeBitrate(omxNode, portIndexOutput, 768000); requestIDR(omxNode, portIndexOutput); requestIDR(omxNode, portIndexOutput); Loading Loading
media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +9 −26 Original line number Original line Diff line number Diff line Loading @@ -643,39 +643,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, AudioDecHidlTest::standardComp comp, bool signalEOS = true) { AudioDecHidlTest::standardComp comp, bool signalEOS = true) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; size_t index; // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i); } // dispatch input buffers uint32_t flags = 0; uint32_t flags = 0; int frameID = offset; int frameID = offset; for (size_t i = 0; (i < iBuffer->size()) && (frameID < (int)Info->size()) && (frameID < (offset + range)); i++) { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE((*Info)[frameID].bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, (*Info)[frameID].bytesCount, flags, (*Info)[frameID].timestamp); frameID++; } int timeOut = TIMEOUT_COUNTER_Q; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); // Port Reconfiguration // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK && if (status == android::hardware::media::omx::V1_0::Status::OK && msg.type == Message::Type::EVENT) { msg.type == Message::Type::EVENT) { Loading @@ -688,7 +665,6 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, if (frameID == (int)Info->size() || frameID == (offset + range)) break; if (frameID == (int)Info->size() || frameID == (offset + range)) break; // Dispatch input buffer // Dispatch input buffer size_t index = 0; if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { char* ipBuffer = static_cast<char*>( char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); Loading @@ -697,6 +673,11 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; flags = (*Info)[frameID].flags; // Indicate to omx core that the buffer contains a full frame worth // of data flags |= OMX_BUFFERFLAG_ENDOFFRAME; // Indicate the omx core that this is the last buffer it needs to // process if (signalEOS && ((frameID == (int)Info->size() - 1) || if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; flags |= OMX_BUFFERFLAG_EOS; Loading @@ -706,10 +687,12 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, frameID++; frameID++; iQueued = true; iQueued = true; } } // Dispatch output buffer if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { dispatchOutputBuffer(omxNode, oBuffer, index); dispatchOutputBuffer(omxNode, oBuffer, index); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading
media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp +5 −22 Original line number Original line Diff line number Diff line Loading @@ -376,44 +376,25 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, bool signalEOS = true) { bool signalEOS = true) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; size_t index; // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i); } // dispatch input buffers int bytesCount = samplesPerFrame * nChannels * 2; int bytesCount = samplesPerFrame * nChannels * 2; int32_t timestampIncr = int32_t timestampIncr = (int)(((float)samplesPerFrame / nSampleRate) * 1000000); (int)(((float)samplesPerFrame / nSampleRate) * 1000000); uint64_t timestamp = 0; uint64_t timestamp = 0; uint32_t flags = 0; uint32_t flags = 0; for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE(bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); eleStream.read(ipBuffer, bytesCount); if (eleStream.gcount() != bytesCount) break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, timestamp); timestamp += timestampIncr; nFrames--; } int timeOut = TIMEOUT_COUNTER_Q; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); if (status == android::hardware::media::omx::V1_0::Status::OK) if (status == android::hardware::media::omx::V1_0::Status::OK) ASSERT_TRUE(false); ASSERT_TRUE(false); if (nFrames == 0) break; if (nFrames == 0) break; // Dispatch input buffer // Dispatch input buffer size_t index = 0; if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { char* ipBuffer = static_cast<char*>( char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); Loading @@ -421,7 +402,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, static_cast<int>((*iBuffer)[index].mMemory->getSize())); static_cast<int>((*iBuffer)[index].mMemory->getSize())); eleStream.read(ipBuffer, bytesCount); eleStream.read(ipBuffer, bytesCount); if (eleStream.gcount() != bytesCount) break; if (eleStream.gcount() != bytesCount) break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; flags = OMX_BUFFERFLAG_ENDOFFRAME; if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, timestamp); timestamp); timestamp += timestampIncr; timestamp += timestampIncr; Loading @@ -433,6 +415,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, dispatchOutputBuffer(omxNode, oBuffer, index); dispatchOutputBuffer(omxNode, oBuffer, index); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading
media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +9 −26 Original line number Original line Diff line number Diff line Loading @@ -601,39 +601,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, bool signalEOS = true) { bool signalEOS = true) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; size_t index; // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode); } // dispatch input buffers uint32_t flags = 0; uint32_t flags = 0; int frameID = offset; int frameID = offset; for (size_t i = 0; (i < iBuffer->size()) && (frameID < (int)Info->size()) && (frameID < (offset + range)); i++) { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE((*Info)[frameID].bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, (*Info)[frameID].bytesCount, flags, (*Info)[frameID].timestamp); frameID++; } int timeOut = TIMEOUT_COUNTER_Q; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); // Port Reconfiguration // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK && if (status == android::hardware::media::omx::V1_0::Status::OK && msg.type == Message::Type::EVENT) { msg.type == Message::Type::EVENT) { Loading @@ -645,7 +622,6 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, if (frameID == (int)Info->size() || frameID == (offset + range)) break; if (frameID == (int)Info->size() || frameID == (offset + range)) break; // Dispatch input buffer // Dispatch input buffer size_t index = 0; if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { char* ipBuffer = static_cast<char*>( char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); Loading @@ -654,6 +630,11 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); flags = (*Info)[frameID].flags; flags = (*Info)[frameID].flags; // Indicate to omx core that the buffer contains a full frame worth // of data flags |= OMX_BUFFERFLAG_ENDOFFRAME; // Indicate the omx core that this is the last buffer it needs to // process if (signalEOS && ((frameID == (int)Info->size() - 1) || if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1)))) (frameID == (offset + range - 1)))) flags |= OMX_BUFFERFLAG_EOS; flags |= OMX_BUFFERFLAG_EOS; Loading @@ -663,10 +644,12 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, frameID++; frameID++; iQueued = true; iQueued = true; } } // Dispatch output buffer if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading
media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp +12 −41 Original line number Original line Diff line number Diff line Loading @@ -983,58 +983,25 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, sp<CodecProducerListener> listener = nullptr) { sp<CodecProducerListener> listener = nullptr) { android::hardware::media::omx::V1_0::Status status; android::hardware::media::omx::V1_0::Status status; Message msg; Message msg; uint32_t ipCount = 0; uint64_t timestamp = 0; uint32_t flags = 0; int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; uint32_t ipCount = 0; if (ipCount == 0) { if (ipCount == 0) { status = changeFrameRate(omxNode, portIndexOutput, (24U << 16)); status = changeFrameRate(omxNode, portIndexOutput, (24U << 16)); if (status == ::android::hardware::media::omx::V1_0::Status::OK) if (status == ::android::hardware::media::omx::V1_0::Status::OK) xFramerate = (24U << 16); xFramerate = (24U << 16); } } // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i); } // dispatch input buffers int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16)); int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16)); // timestamp scale = Nano sec if (inputDataIsMeta) timestampIncr *= 1000; // timestamp scale: Nano sec if (inputDataIsMeta) timestampIncr *= 1000; uint64_t timestamp = 0; uint32_t flags = 0; for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) { if (inputDataIsMeta) { if (listener->freeBuffers > listener->minUnDequeuedCount) { if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer, portIndexInput, eleStream, timestamp)) break; timestamp += timestampIncr; nFrames--; ipCount++; } } else { char* ipBuffer = static_cast<char*>( static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); ASSERT_LE(bytesCount, static_cast<int>((*iBuffer)[i].mMemory->getSize())); if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, eleStream)) break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, timestamp); if (timestampUslist) timestampUslist->push_back(timestamp); timestamp += timestampIncr; nFrames--; ipCount++; } } int timeOut = TIMEOUT_COUNTER_Q; bool iQueued, oQueued; while (1) { while (1) { iQueued = oQueued = false; iQueued = oQueued = false; status = status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); // Port Reconfiguration if (status == android::hardware::media::omx::V1_0::Status::OK) { if (status == android::hardware::media::omx::V1_0::Status::OK) { ASSERT_EQ(msg.type, Message::Type::EVENT); ASSERT_EQ(msg.type, Message::Type::EVENT); if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { Loading Loading @@ -1076,7 +1043,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, eleStream)) eleStream)) break; break; if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; flags = OMX_BUFFERFLAG_ENDOFFRAME; if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, timestamp); timestamp); if (timestampUslist) timestampUslist->push_back(timestamp); if (timestampUslist) timestampUslist->push_back(timestamp); Loading @@ -1086,10 +1054,12 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, iQueued = true; iQueued = true; } } } } // Dispatch output buffer if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { dispatchOutputBuffer(omxNode, oBuffer, index); dispatchOutputBuffer(omxNode, oBuffer, index); oQueued = true; oQueued = true; } } // Reset Counters when either input or output buffer is dispatched if (iQueued || oQueued) if (iQueued || oQueued) timeOut = TIMEOUT_COUNTER_Q; timeOut = TIMEOUT_COUNTER_Q; else else Loading @@ -1098,6 +1068,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; break; break; } } // Runtime Param Configuration if (ipCount == 15) { if (ipCount == 15) { changeBitrate(omxNode, portIndexOutput, 768000); changeBitrate(omxNode, portIndexOutput, 768000); requestIDR(omxNode, portIndexOutput); requestIDR(omxNode, portIndexOutput); Loading