Transcoder: Fix error with short clips

- Fixes a bug in the sample reader where an error was incorrectly
reported if one track reached EOS right before switching to
sequential access.
- Adds more sample reader tests for different combinations of
sample access patterns and access modes.

Bug: 153453392
Fixes: 173643110
Test: Unit test (MediaSampleReaderNDKTests)
Change-Id: I3b683c5d8eb18a5b57d419ce113e08b40363ba9e
diff --git a/media/libmediatranscoding/transcoder/MediaSampleReaderNDK.cpp b/media/libmediatranscoding/transcoder/MediaSampleReaderNDK.cpp
index d2f6c40..92ba818 100644
--- a/media/libmediatranscoding/transcoder/MediaSampleReaderNDK.cpp
+++ b/media/libmediatranscoding/transcoder/MediaSampleReaderNDK.cpp
@@ -99,6 +99,7 @@
     }
 
     if (!AMediaExtractor_advance(mExtractor)) {
+        LOG(DEBUG) << "  EOS in advanceExtractor_l";
         mEosReached = true;
         for (auto it = mTrackSignals.begin(); it != mTrackSignals.end(); ++it) {
             it->second.notify_all();
@@ -137,6 +138,8 @@
         LOG(ERROR) << "Unable to seek to " << seekToTimeUs << ", target " << targetTimeUs;
         return status;
     }
+
+    mEosReached = false;
     mExtractorTrackIndex = AMediaExtractor_getSampleTrackIndex(mExtractor);
     int64_t sampleTimeUs = AMediaExtractor_getSampleTime(mExtractor);
 
@@ -233,6 +236,8 @@
 }
 
 media_status_t MediaSampleReaderNDK::setEnforceSequentialAccess(bool enforce) {
+    LOG(DEBUG) << "setEnforceSequentialAccess( " << enforce << " )";
+
     std::scoped_lock lock(mExtractorMutex);
 
     if (mEnforceSequentialAccess && !enforce) {
@@ -374,7 +379,11 @@
         info->presentationTimeUs = 0;
         info->flags = SAMPLE_FLAG_END_OF_STREAM;
         info->size = 0;
+        LOG(DEBUG) << "  getSampleInfoForTrack #" << trackIndex << ": End Of Stream";
+    } else {
+        LOG(ERROR) << "  getSampleInfoForTrack #" << trackIndex << ": Error " << status;
     }
+
     return status;
 }