Merge "Remove unused functions from libstagefright_m4vh263dec"
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index 271e186..3d0d622 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -388,6 +388,9 @@
mFramesReadServerOffset -= mFramesRead + framesFlushed;
mFramesRead = 0;
mProxy->clearTimestamp(); // timestamp is invalid until next server push
+ mPreviousTimestamp.clear();
+ mTimestampRetrogradePositionReported = false;
+ mTimestampRetrogradeTimeReported = false;
// reset current position as seen by client to 0
mProxy->setEpoch(mProxy->getEpoch() - mProxy->getPosition());
@@ -570,6 +573,39 @@
timestamp->mPosition[i] += mFramesReadServerOffset;
}
}
+
+ bool timestampRetrogradeTimeReported = false;
+ bool timestampRetrogradePositionReported = false;
+ for (int i = 0; i < ExtendedTimestamp::LOCATION_MAX; ++i) {
+ if (timestamp->mTimeNs[i] >= 0 && mPreviousTimestamp.mTimeNs[i] >= 0) {
+ if (timestamp->mTimeNs[i] < mPreviousTimestamp.mTimeNs[i]) {
+ if (!mTimestampRetrogradeTimeReported) {
+ ALOGD("%s: retrograde time adjusting [%d] current:%lld to previous:%lld",
+ __func__, i, (long long)timestamp->mTimeNs[i],
+ (long long)mPreviousTimestamp.mTimeNs[i]);
+ timestampRetrogradeTimeReported = true;
+ }
+ timestamp->mTimeNs[i] = mPreviousTimestamp.mTimeNs[i];
+ }
+ if (timestamp->mPosition[i] < mPreviousTimestamp.mPosition[i]) {
+ if (!mTimestampRetrogradePositionReported) {
+ ALOGD("%s: retrograde position"
+ " adjusting [%d] current:%lld to previous:%lld",
+ __func__, i, (long long)timestamp->mPosition[i],
+ (long long)mPreviousTimestamp.mPosition[i]);
+ timestampRetrogradePositionReported = true;
+ }
+ timestamp->mPosition[i] = mPreviousTimestamp.mPosition[i];
+ }
+ }
+ }
+ mPreviousTimestamp = *timestamp;
+ if (timestampRetrogradeTimeReported) {
+ mTimestampRetrogradeTimeReported = true;
+ }
+ if (timestampRetrogradePositionReported) {
+ mTimestampRetrogradePositionReported = true;
+ }
}
return status;
}
diff --git a/media/libaudioclient/include/media/AudioRecord.h b/media/libaudioclient/include/media/AudioRecord.h
index 574302b..20a7d14 100644
--- a/media/libaudioclient/include/media/AudioRecord.h
+++ b/media/libaudioclient/include/media/AudioRecord.h
@@ -711,6 +711,10 @@
bool mInOverrun; // whether recorder is currently in overrun state
+ ExtendedTimestamp mPreviousTimestamp{}; // used to detect retrograde motion
+ bool mTimestampRetrogradePositionReported = false; // reduce log spam
+ bool mTimestampRetrogradeTimeReported = false; // reduce log spam
+
private:
class DeathNotifier : public IBinder::DeathRecipient {
public:
diff --git a/media/libmediahelper/Android.bp b/media/libmediahelper/Android.bp
index 72edeec..ae135af 100644
--- a/media/libmediahelper/Android.bp
+++ b/media/libmediahelper/Android.bp
@@ -2,6 +2,12 @@
name: "libmedia_helper_headers",
vendor_available: true,
export_include_dirs: ["include"],
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
cc_library {
@@ -26,4 +32,10 @@
"libmedia_helper_headers",
],
clang: true,
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
diff --git a/media/libstagefright/Android.bp b/media/libstagefright/Android.bp
index 18dacb8..abb58be 100644
--- a/media/libstagefright/Android.bp
+++ b/media/libstagefright/Android.bp
@@ -2,6 +2,12 @@
name: "libstagefright_headers",
export_include_dirs: ["include"],
vendor_available: true,
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
cc_library_static {
diff --git a/media/libstagefright/MediaExtractorFactory.cpp b/media/libstagefright/MediaExtractorFactory.cpp
index 9e85475..8bce917 100644
--- a/media/libstagefright/MediaExtractorFactory.cpp
+++ b/media/libstagefright/MediaExtractorFactory.cpp
@@ -298,6 +298,12 @@
#endif
"/extractors", NULL, *newList);
+ RegisterExtractors("/system_ext/lib"
+#ifdef __LP64__
+ "64"
+#endif
+ "/extractors", NULL, *newList);
+
newList->sort(compareFunc);
gPlugins = newList;
diff --git a/media/libstagefright/foundation/Android.bp b/media/libstagefright/foundation/Android.bp
index effbb4e..5c927e6 100644
--- a/media/libstagefright/foundation/Android.bp
+++ b/media/libstagefright/foundation/Android.bp
@@ -23,7 +23,6 @@
],
header_libs: [
- "libhardware_headers",
"libstagefright_foundation_headers",
"media_ndk_headers",
"media_plugin_headers",
diff --git a/media/libstagefright/tests/writer/AndroidTest.xml b/media/libstagefright/tests/writer/AndroidTest.xml
index d831555..a21be8a 100644
--- a/media/libstagefright/tests/writer/AndroidTest.xml
+++ b/media/libstagefright/tests/writer/AndroidTest.xml
@@ -19,12 +19,13 @@
<option name="cleanup" value="true" />
<option name="push" value="writerTest->/data/local/tmp/writerTest" />
<option name="push-file"
- key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/tests/writer/Writer.zip?unzip=true"
- value="/data/local/tmp/writerTestRes/" />
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/tests/writer/WriterTestRes.zip?unzip=true"
+ value="/data/local/tmp/WriterTestRes/" />
</target_preparer>
<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" />
<option name="module-name" value="writerTest" />
- <option name="native-test-flag" value="-P /data/local/tmp/writerTestRes/" />
+ <option name="native-test-flag" value="-P /data/local/tmp/WriterTestRes/" />
+ <option name="native-test-flag" value="-C true" />
</test>
</configuration>
diff --git a/media/libstagefright/tests/writer/README.md b/media/libstagefright/tests/writer/README.md
index ae07917..e103613 100644
--- a/media/libstagefright/tests/writer/README.md
+++ b/media/libstagefright/tests/writer/README.md
@@ -19,13 +19,18 @@
adb push ${OUT}/data/nativetest/writerTest/writerTest /data/local/tmp/
-The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/tests/writer/writerTestRes.zip).
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/tests/writer/WriterTestRes.zip).
Download and extract the folder. Push all the files in this folder to /data/local/tmp/ on the device.
```
-adb push writerTestRes /data/local/tmp/
+adb push WriterTestRes /data/local/tmp/
```
-usage: writerTest -P \<path_to_res_folder\>
+usage: writerTest -P \<path_to_res_folder\> -C <remove_output_file>
```
-adb shell /data/local/tmp/writerTest -P /data/local/tmp/
+adb shell /data/local/tmp/writerTest -P /data/local/tmp/WriterTestRes/ -C true
+```
+Alternatively, the test can also be run using atest command.
+
+```
+atest writerTest -- --enable-module-dynamic-download=true
```
diff --git a/media/libstagefright/tests/writer/WriterTest.cpp b/media/libstagefright/tests/writer/WriterTest.cpp
index 3fa2aa6..4d8df2d 100644
--- a/media/libstagefright/tests/writer/WriterTest.cpp
+++ b/media/libstagefright/tests/writer/WriterTest.cpp
@@ -107,6 +107,7 @@
}
mBufferInfo.clear();
if (mInputStream.is_open()) mInputStream.close();
+ if (gEnv->cleanUp()) remove(OUTPUT_FILE_NAME);
}
void setupWriterType(string writerFormat) {
diff --git a/media/libstagefright/tests/writer/WriterTestEnvironment.h b/media/libstagefright/tests/writer/WriterTestEnvironment.h
index 99e686f..7da0a62 100644
--- a/media/libstagefright/tests/writer/WriterTestEnvironment.h
+++ b/media/libstagefright/tests/writer/WriterTestEnvironment.h
@@ -25,7 +25,7 @@
class WriterTestEnvironment : public ::testing::Environment {
public:
- WriterTestEnvironment() : res("/data/local/tmp/") {}
+ WriterTestEnvironment() : res("/data/local/tmp/"), deleteOutput(true) {}
// Parses the command line arguments
int initFromOptions(int argc, char **argv);
@@ -34,16 +34,21 @@
const string getRes() const { return res; }
+ bool cleanUp() const { return deleteOutput; }
+
private:
string res;
+ bool deleteOutput;
};
int WriterTestEnvironment::initFromOptions(int argc, char **argv) {
- static struct option options[] = {{"res", required_argument, 0, 'P'}, {0, 0, 0, 0}};
+ static struct option options[] = {{"res", required_argument, 0, 'P'},
+ {"cleanUp", optional_argument, 0, 'C'},
+ {0, 0, 0, 0}};
while (true) {
int index = 0;
- int c = getopt_long(argc, argv, "P:", options, &index);
+ int c = getopt_long(argc, argv, "P:C:", options, &index);
if (c == -1) {
break;
}
@@ -52,6 +57,11 @@
case 'P':
setRes(optarg);
break;
+ case 'C':
+ if (!strcmp(optarg, "false")) {
+ deleteOutput = false;
+ }
+ break;
default:
break;
}
@@ -62,7 +72,8 @@
"unrecognized option: %s\n\n"
"usage: %s <gtest options> <test options>\n\n"
"test options are:\n\n"
- "-P, --path: Resource files directory location\n",
+ "-P, --path: Resource files directory location\n"
+ "-C, default:true. Delete output file after test completes\n",
argv[optind ?: 1], argv[0]);
return 2;
}
diff --git a/media/ndk/Android.bp b/media/ndk/Android.bp
index ce91249..4b60475 100644
--- a/media/ndk/Android.bp
+++ b/media/ndk/Android.bp
@@ -35,7 +35,13 @@
cc_library_headers {
name: "media_ndk_headers",
vendor_available: true,
- export_include_dirs: ["include"]
+ export_include_dirs: ["include"],
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
cc_library_shared {