diff options
author | Ram Mohan M | 2017-09-20 22:54:40 -0500 |
---|---|---|
committer | android-build-merger | 2017-09-20 22:54:40 -0500 |
commit | 25c4474179d8d89d64de6a5b5872f4e93a00b214 (patch) | |
tree | 17b8f9e7cabf85a0c0d735b65753eac305891cb6 /media | |
parent | 3abd1eb75eb746a48f4dd91a3d85dc4aedf24ef6 (diff) | |
parent | e27badbfc830eafaf7e43f50c3bde4234766ba7b (diff) | |
download | platform-hardware-interfaces-25c4474179d8d89d64de6a5b5872f4e93a00b214.tar.gz platform-hardware-interfaces-25c4474179d8d89d64de6a5b5872f4e93a00b214.tar.xz platform-hardware-interfaces-25c4474179d8d89d64de6a5b5872f4e93a00b214.zip |
Merge "Signal eof flag for each input buffer" into oc-mr1-dev am: 98d4fd9ed6
am: e27badbfc8
Change-Id: I8fab6195868dc8aa499584a4677d2d109d8121a2
Diffstat (limited to 'media')
4 files changed, 35 insertions, 115 deletions
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp index 145d04a7..81a05cae 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp | |||
@@ -643,39 +643,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
643 | AudioDecHidlTest::standardComp comp, bool signalEOS = true) { | 643 | AudioDecHidlTest::standardComp comp, bool signalEOS = true) { |
644 | android::hardware::media::omx::V1_0::Status status; | 644 | android::hardware::media::omx::V1_0::Status status; |
645 | Message msg; | 645 | Message msg; |
646 | 646 | size_t index; | |
647 | // dispatch output buffers | ||
648 | for (size_t i = 0; i < oBuffer->size(); i++) { | ||
649 | dispatchOutputBuffer(omxNode, oBuffer, i); | ||
650 | } | ||
651 | // dispatch input buffers | ||
652 | uint32_t flags = 0; | 647 | uint32_t flags = 0; |
653 | int frameID = offset; | 648 | int frameID = offset; |
654 | for (size_t i = 0; (i < iBuffer->size()) && (frameID < (int)Info->size()) && | ||
655 | (frameID < (offset + range)); | ||
656 | i++) { | ||
657 | char* ipBuffer = static_cast<char*>( | ||
658 | static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); | ||
659 | ASSERT_LE((*Info)[frameID].bytesCount, | ||
660 | static_cast<int>((*iBuffer)[i].mMemory->getSize())); | ||
661 | eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); | ||
662 | ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); | ||
663 | flags = (*Info)[frameID].flags; | ||
664 | if (signalEOS && ((frameID == (int)Info->size() - 1) || | ||
665 | (frameID == (offset + range - 1)))) | ||
666 | flags |= OMX_BUFFERFLAG_EOS; | ||
667 | dispatchInputBuffer(omxNode, iBuffer, i, (*Info)[frameID].bytesCount, | ||
668 | flags, (*Info)[frameID].timestamp); | ||
669 | frameID++; | ||
670 | } | ||
671 | |||
672 | int timeOut = TIMEOUT_COUNTER_Q; | 649 | int timeOut = TIMEOUT_COUNTER_Q; |
673 | bool iQueued, oQueued; | 650 | bool iQueued, oQueued; |
651 | |||
674 | while (1) { | 652 | while (1) { |
675 | iQueued = oQueued = false; | 653 | iQueued = oQueued = false; |
676 | status = | 654 | status = |
677 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); | 655 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); |
678 | |||
679 | // Port Reconfiguration | 656 | // Port Reconfiguration |
680 | if (status == android::hardware::media::omx::V1_0::Status::OK && | 657 | if (status == android::hardware::media::omx::V1_0::Status::OK && |
681 | msg.type == Message::Type::EVENT) { | 658 | msg.type == Message::Type::EVENT) { |
@@ -688,7 +665,6 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
688 | if (frameID == (int)Info->size() || frameID == (offset + range)) break; | 665 | if (frameID == (int)Info->size() || frameID == (offset + range)) break; |
689 | 666 | ||
690 | // Dispatch input buffer | 667 | // Dispatch input buffer |
691 | size_t index = 0; | ||
692 | if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { | 668 | if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { |
693 | char* ipBuffer = static_cast<char*>( | 669 | char* ipBuffer = static_cast<char*>( |
694 | static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); | 670 | static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); |
@@ -697,6 +673,11 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
697 | eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); | 673 | eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); |
698 | ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); | 674 | ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); |
699 | flags = (*Info)[frameID].flags; | 675 | flags = (*Info)[frameID].flags; |
676 | // Indicate to omx core that the buffer contains a full frame worth | ||
677 | // of data | ||
678 | flags |= OMX_BUFFERFLAG_ENDOFFRAME; | ||
679 | // Indicate the omx core that this is the last buffer it needs to | ||
680 | // process | ||
700 | if (signalEOS && ((frameID == (int)Info->size() - 1) || | 681 | if (signalEOS && ((frameID == (int)Info->size() - 1) || |
701 | (frameID == (offset + range - 1)))) | 682 | (frameID == (offset + range - 1)))) |
702 | flags |= OMX_BUFFERFLAG_EOS; | 683 | flags |= OMX_BUFFERFLAG_EOS; |
@@ -706,10 +687,12 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
706 | frameID++; | 687 | frameID++; |
707 | iQueued = true; | 688 | iQueued = true; |
708 | } | 689 | } |
690 | // Dispatch output buffer | ||
709 | if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { | 691 | if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { |
710 | dispatchOutputBuffer(omxNode, oBuffer, index); | 692 | dispatchOutputBuffer(omxNode, oBuffer, index); |
711 | oQueued = true; | 693 | oQueued = true; |
712 | } | 694 | } |
695 | // Reset Counters when either input or output buffer is dispatched | ||
713 | if (iQueued || oQueued) | 696 | if (iQueued || oQueued) |
714 | timeOut = TIMEOUT_COUNTER_Q; | 697 | timeOut = TIMEOUT_COUNTER_Q; |
715 | else | 698 | else |
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp index 038830dc..278e1962 100644 --- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp +++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp | |||
@@ -376,44 +376,25 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
376 | bool signalEOS = true) { | 376 | bool signalEOS = true) { |
377 | android::hardware::media::omx::V1_0::Status status; | 377 | android::hardware::media::omx::V1_0::Status status; |
378 | Message msg; | 378 | Message msg; |
379 | 379 | size_t index; | |
380 | // dispatch output buffers | ||
381 | for (size_t i = 0; i < oBuffer->size(); i++) { | ||
382 | dispatchOutputBuffer(omxNode, oBuffer, i); | ||
383 | } | ||
384 | // dispatch input buffers | ||
385 | int bytesCount = samplesPerFrame * nChannels * 2; | 380 | int bytesCount = samplesPerFrame * nChannels * 2; |
386 | int32_t timestampIncr = | 381 | int32_t timestampIncr = |
387 | (int)(((float)samplesPerFrame / nSampleRate) * 1000000); | 382 | (int)(((float)samplesPerFrame / nSampleRate) * 1000000); |
388 | uint64_t timestamp = 0; | 383 | uint64_t timestamp = 0; |
389 | uint32_t flags = 0; | 384 | uint32_t flags = 0; |
390 | for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) { | ||
391 | char* ipBuffer = static_cast<char*>( | ||
392 | static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); | ||
393 | ASSERT_LE(bytesCount, | ||
394 | static_cast<int>((*iBuffer)[i].mMemory->getSize())); | ||
395 | eleStream.read(ipBuffer, bytesCount); | ||
396 | if (eleStream.gcount() != bytesCount) break; | ||
397 | if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; | ||
398 | dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, timestamp); | ||
399 | timestamp += timestampIncr; | ||
400 | nFrames--; | ||
401 | } | ||
402 | |||
403 | int timeOut = TIMEOUT_COUNTER_Q; | 385 | int timeOut = TIMEOUT_COUNTER_Q; |
404 | bool iQueued, oQueued; | 386 | bool iQueued, oQueued; |
387 | |||
405 | while (1) { | 388 | while (1) { |
406 | iQueued = oQueued = false; | 389 | iQueued = oQueued = false; |
407 | status = | 390 | status = |
408 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); | 391 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); |
409 | |||
410 | if (status == android::hardware::media::omx::V1_0::Status::OK) | 392 | if (status == android::hardware::media::omx::V1_0::Status::OK) |
411 | ASSERT_TRUE(false); | 393 | ASSERT_TRUE(false); |
412 | 394 | ||
413 | if (nFrames == 0) break; | 395 | if (nFrames == 0) break; |
414 | 396 | ||
415 | // Dispatch input buffer | 397 | // Dispatch input buffer |
416 | size_t index = 0; | ||
417 | if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { | 398 | if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { |
418 | char* ipBuffer = static_cast<char*>( | 399 | char* ipBuffer = static_cast<char*>( |
419 | static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); | 400 | static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); |
@@ -421,7 +402,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
421 | static_cast<int>((*iBuffer)[index].mMemory->getSize())); | 402 | static_cast<int>((*iBuffer)[index].mMemory->getSize())); |
422 | eleStream.read(ipBuffer, bytesCount); | 403 | eleStream.read(ipBuffer, bytesCount); |
423 | if (eleStream.gcount() != bytesCount) break; | 404 | if (eleStream.gcount() != bytesCount) break; |
424 | if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; | 405 | flags = OMX_BUFFERFLAG_ENDOFFRAME; |
406 | if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; | ||
425 | dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, | 407 | dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, |
426 | timestamp); | 408 | timestamp); |
427 | timestamp += timestampIncr; | 409 | timestamp += timestampIncr; |
@@ -433,6 +415,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
433 | dispatchOutputBuffer(omxNode, oBuffer, index); | 415 | dispatchOutputBuffer(omxNode, oBuffer, index); |
434 | oQueued = true; | 416 | oQueued = true; |
435 | } | 417 | } |
418 | // Reset Counters when either input or output buffer is dispatched | ||
436 | if (iQueued || oQueued) | 419 | if (iQueued || oQueued) |
437 | timeOut = TIMEOUT_COUNTER_Q; | 420 | timeOut = TIMEOUT_COUNTER_Q; |
438 | else | 421 | else |
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp index 8d739e89..2ea97016 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | |||
@@ -601,39 +601,16 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
601 | bool signalEOS = true) { | 601 | bool signalEOS = true) { |
602 | android::hardware::media::omx::V1_0::Status status; | 602 | android::hardware::media::omx::V1_0::Status status; |
603 | Message msg; | 603 | Message msg; |
604 | 604 | size_t index; | |
605 | // dispatch output buffers | ||
606 | for (size_t i = 0; i < oBuffer->size(); i++) { | ||
607 | dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode); | ||
608 | } | ||
609 | // dispatch input buffers | ||
610 | uint32_t flags = 0; | 605 | uint32_t flags = 0; |
611 | int frameID = offset; | 606 | int frameID = offset; |
612 | for (size_t i = 0; (i < iBuffer->size()) && (frameID < (int)Info->size()) && | ||
613 | (frameID < (offset + range)); | ||
614 | i++) { | ||
615 | char* ipBuffer = static_cast<char*>( | ||
616 | static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); | ||
617 | ASSERT_LE((*Info)[frameID].bytesCount, | ||
618 | static_cast<int>((*iBuffer)[i].mMemory->getSize())); | ||
619 | eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); | ||
620 | ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); | ||
621 | flags = (*Info)[frameID].flags; | ||
622 | if (signalEOS && ((frameID == (int)Info->size() - 1) || | ||
623 | (frameID == (offset + range - 1)))) | ||
624 | flags |= OMX_BUFFERFLAG_EOS; | ||
625 | dispatchInputBuffer(omxNode, iBuffer, i, (*Info)[frameID].bytesCount, | ||
626 | flags, (*Info)[frameID].timestamp); | ||
627 | frameID++; | ||
628 | } | ||
629 | |||
630 | int timeOut = TIMEOUT_COUNTER_Q; | 607 | int timeOut = TIMEOUT_COUNTER_Q; |
631 | bool iQueued, oQueued; | 608 | bool iQueued, oQueued; |
609 | |||
632 | while (1) { | 610 | while (1) { |
633 | iQueued = oQueued = false; | 611 | iQueued = oQueued = false; |
634 | status = | 612 | status = |
635 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); | 613 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); |
636 | |||
637 | // Port Reconfiguration | 614 | // Port Reconfiguration |
638 | if (status == android::hardware::media::omx::V1_0::Status::OK && | 615 | if (status == android::hardware::media::omx::V1_0::Status::OK && |
639 | msg.type == Message::Type::EVENT) { | 616 | msg.type == Message::Type::EVENT) { |
@@ -645,7 +622,6 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
645 | if (frameID == (int)Info->size() || frameID == (offset + range)) break; | 622 | if (frameID == (int)Info->size() || frameID == (offset + range)) break; |
646 | 623 | ||
647 | // Dispatch input buffer | 624 | // Dispatch input buffer |
648 | size_t index = 0; | ||
649 | if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { | 625 | if ((index = getEmptyBufferID(iBuffer)) < iBuffer->size()) { |
650 | char* ipBuffer = static_cast<char*>( | 626 | char* ipBuffer = static_cast<char*>( |
651 | static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); | 627 | static_cast<void*>((*iBuffer)[index].mMemory->getPointer())); |
@@ -654,6 +630,11 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
654 | eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); | 630 | eleStream.read(ipBuffer, (*Info)[frameID].bytesCount); |
655 | ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); | 631 | ASSERT_EQ(eleStream.gcount(), (*Info)[frameID].bytesCount); |
656 | flags = (*Info)[frameID].flags; | 632 | flags = (*Info)[frameID].flags; |
633 | // Indicate to omx core that the buffer contains a full frame worth | ||
634 | // of data | ||
635 | flags |= OMX_BUFFERFLAG_ENDOFFRAME; | ||
636 | // Indicate the omx core that this is the last buffer it needs to | ||
637 | // process | ||
657 | if (signalEOS && ((frameID == (int)Info->size() - 1) || | 638 | if (signalEOS && ((frameID == (int)Info->size() - 1) || |
658 | (frameID == (offset + range - 1)))) | 639 | (frameID == (offset + range - 1)))) |
659 | flags |= OMX_BUFFERFLAG_EOS; | 640 | flags |= OMX_BUFFERFLAG_EOS; |
@@ -663,10 +644,12 @@ void decodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
663 | frameID++; | 644 | frameID++; |
664 | iQueued = true; | 645 | iQueued = true; |
665 | } | 646 | } |
647 | // Dispatch output buffer | ||
666 | if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { | 648 | if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { |
667 | dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); | 649 | dispatchOutputBuffer(omxNode, oBuffer, index, oPortMode); |
668 | oQueued = true; | 650 | oQueued = true; |
669 | } | 651 | } |
652 | // Reset Counters when either input or output buffer is dispatched | ||
670 | if (iQueued || oQueued) | 653 | if (iQueued || oQueued) |
671 | timeOut = TIMEOUT_COUNTER_Q; | 654 | timeOut = TIMEOUT_COUNTER_Q; |
672 | else | 655 | else |
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp index 23f051d8..74b995b9 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp | |||
@@ -983,58 +983,25 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
983 | sp<CodecProducerListener> listener = nullptr) { | 983 | sp<CodecProducerListener> listener = nullptr) { |
984 | android::hardware::media::omx::V1_0::Status status; | 984 | android::hardware::media::omx::V1_0::Status status; |
985 | Message msg; | 985 | Message msg; |
986 | uint32_t ipCount = 0; | 986 | uint64_t timestamp = 0; |
987 | uint32_t flags = 0; | ||
988 | int timeOut = TIMEOUT_COUNTER_Q; | ||
989 | bool iQueued, oQueued; | ||
987 | 990 | ||
991 | uint32_t ipCount = 0; | ||
988 | if (ipCount == 0) { | 992 | if (ipCount == 0) { |
989 | status = changeFrameRate(omxNode, portIndexOutput, (24U << 16)); | 993 | status = changeFrameRate(omxNode, portIndexOutput, (24U << 16)); |
990 | if (status == ::android::hardware::media::omx::V1_0::Status::OK) | 994 | if (status == ::android::hardware::media::omx::V1_0::Status::OK) |
991 | xFramerate = (24U << 16); | 995 | xFramerate = (24U << 16); |
992 | } | 996 | } |
993 | |||
994 | // dispatch output buffers | ||
995 | for (size_t i = 0; i < oBuffer->size(); i++) { | ||
996 | dispatchOutputBuffer(omxNode, oBuffer, i); | ||
997 | } | ||
998 | // dispatch input buffers | ||
999 | int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16)); | 997 | int32_t timestampIncr = (int)((float)1000000 / (xFramerate >> 16)); |
1000 | // timestamp scale = Nano sec | 998 | if (inputDataIsMeta) timestampIncr *= 1000; // timestamp scale: Nano sec |
1001 | if (inputDataIsMeta) timestampIncr *= 1000; | ||
1002 | uint64_t timestamp = 0; | ||
1003 | uint32_t flags = 0; | ||
1004 | for (size_t i = 0; i < iBuffer->size() && nFrames != 0; i++) { | ||
1005 | if (inputDataIsMeta) { | ||
1006 | if (listener->freeBuffers > listener->minUnDequeuedCount) { | ||
1007 | if (dispatchGraphicBuffer(omxNode, producer, listener, iBuffer, | ||
1008 | portIndexInput, eleStream, timestamp)) | ||
1009 | break; | ||
1010 | timestamp += timestampIncr; | ||
1011 | nFrames--; | ||
1012 | ipCount++; | ||
1013 | } | ||
1014 | } else { | ||
1015 | char* ipBuffer = static_cast<char*>( | ||
1016 | static_cast<void*>((*iBuffer)[i].mMemory->getPointer())); | ||
1017 | ASSERT_LE(bytesCount, | ||
1018 | static_cast<int>((*iBuffer)[i].mMemory->getSize())); | ||
1019 | if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, eleStream)) | ||
1020 | break; | ||
1021 | if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; | ||
1022 | dispatchInputBuffer(omxNode, iBuffer, i, bytesCount, flags, | ||
1023 | timestamp); | ||
1024 | if (timestampUslist) timestampUslist->push_back(timestamp); | ||
1025 | timestamp += timestampIncr; | ||
1026 | nFrames--; | ||
1027 | ipCount++; | ||
1028 | } | ||
1029 | } | ||
1030 | 999 | ||
1031 | int timeOut = TIMEOUT_COUNTER_Q; | ||
1032 | bool iQueued, oQueued; | ||
1033 | while (1) { | 1000 | while (1) { |
1034 | iQueued = oQueued = false; | 1001 | iQueued = oQueued = false; |
1035 | status = | 1002 | status = |
1036 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); | 1003 | observer->dequeueMessage(&msg, DEFAULT_TIMEOUT_Q, iBuffer, oBuffer); |
1037 | 1004 | // Port Reconfiguration | |
1038 | if (status == android::hardware::media::omx::V1_0::Status::OK) { | 1005 | if (status == android::hardware::media::omx::V1_0::Status::OK) { |
1039 | ASSERT_EQ(msg.type, Message::Type::EVENT); | 1006 | ASSERT_EQ(msg.type, Message::Type::EVENT); |
1040 | if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { | 1007 | if (msg.data.eventData.event == OMX_EventPortSettingsChanged) { |
@@ -1076,7 +1043,8 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
1076 | if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, | 1043 | if (fillByteBuffer(omxNode, ipBuffer, portIndexInput, |
1077 | eleStream)) | 1044 | eleStream)) |
1078 | break; | 1045 | break; |
1079 | if (signalEOS && (nFrames == 1)) flags = OMX_BUFFERFLAG_EOS; | 1046 | flags = OMX_BUFFERFLAG_ENDOFFRAME; |
1047 | if (signalEOS && (nFrames == 1)) flags |= OMX_BUFFERFLAG_EOS; | ||
1080 | dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, | 1048 | dispatchInputBuffer(omxNode, iBuffer, index, bytesCount, flags, |
1081 | timestamp); | 1049 | timestamp); |
1082 | if (timestampUslist) timestampUslist->push_back(timestamp); | 1050 | if (timestampUslist) timestampUslist->push_back(timestamp); |
@@ -1086,10 +1054,12 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
1086 | iQueued = true; | 1054 | iQueued = true; |
1087 | } | 1055 | } |
1088 | } | 1056 | } |
1057 | // Dispatch output buffer | ||
1089 | if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { | 1058 | if ((index = getEmptyBufferID(oBuffer)) < oBuffer->size()) { |
1090 | dispatchOutputBuffer(omxNode, oBuffer, index); | 1059 | dispatchOutputBuffer(omxNode, oBuffer, index); |
1091 | oQueued = true; | 1060 | oQueued = true; |
1092 | } | 1061 | } |
1062 | // Reset Counters when either input or output buffer is dispatched | ||
1093 | if (iQueued || oQueued) | 1063 | if (iQueued || oQueued) |
1094 | timeOut = TIMEOUT_COUNTER_Q; | 1064 | timeOut = TIMEOUT_COUNTER_Q; |
1095 | else | 1065 | else |
@@ -1098,6 +1068,7 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer, | |||
1098 | EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; | 1068 | EXPECT_TRUE(false) << "Wait on Input/Output is found indefinite"; |
1099 | break; | 1069 | break; |
1100 | } | 1070 | } |
1071 | // Runtime Param Configuration | ||
1101 | if (ipCount == 15) { | 1072 | if (ipCount == 15) { |
1102 | changeBitrate(omxNode, portIndexOutput, 768000); | 1073 | changeBitrate(omxNode, portIndexOutput, 768000); |
1103 | requestIDR(omxNode, portIndexOutput); | 1074 | requestIDR(omxNode, portIndexOutput); |