summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-10-03 09:01:11 -0700
committerAndreas Huber <andih@google.com>2012-10-03 09:01:11 -0700
commit8d16bbc5a354d302abfd912b8d88d9c7feb3948f (patch)
tree8280fbf907ec72b8345aebe44b2d9b0d1b0105a7
parent47aa9c47a0796bb695d09aa307b2d1c2c913f0eb (diff)
downloadframeworks_av-8d16bbc5a354d302abfd912b8d88d9c7feb3948f.zip
frameworks_av-8d16bbc5a354d302abfd912b8d88d9c7feb3948f.tar.gz
frameworks_av-8d16bbc5a354d302abfd912b8d88d9c7feb3948f.tar.bz2
Increase polling frequency again temporarily to fix A/V issues
Fixes a bug in the silence detection and increases the timeout after which we enter "silent mode" to 10 secs. Change-Id: I802b058f054becd5c377186664437f7b3970193f related-to-bug: 7248248
-rw-r--r--media/libstagefright/wifi-display/source/Converter.cpp29
-rw-r--r--media/libstagefright/wifi-display/source/PlaybackSession.cpp9
2 files changed, 24 insertions, 14 deletions
diff --git a/media/libstagefright/wifi-display/source/Converter.cpp b/media/libstagefright/wifi-display/source/Converter.cpp
index 6f336c7..f044666 100644
--- a/media/libstagefright/wifi-display/source/Converter.cpp
+++ b/media/libstagefright/wifi-display/source/Converter.cpp
@@ -242,16 +242,18 @@ void Converter::onMessageReceived(const sp<AMessage> &msg) {
#if ENABLE_SILENCE_DETECTION
if (!mIsVideo) {
if (IsSilence(accessUnit)) {
- if (!mInSilentMode) {
- int64_t nowUs = ALooper::GetNowUs();
-
- if (mFirstSilentFrameUs < 0ll) {
- mFirstSilentFrameUs = nowUs;
- } else if (nowUs >= mFirstSilentFrameUs + 1000000ll) {
- mInSilentMode = true;
- ALOGI("audio in silent mode now.");
- break;
- }
+ if (mInSilentMode) {
+ break;
+ }
+
+ int64_t nowUs = ALooper::GetNowUs();
+
+ if (mFirstSilentFrameUs < 0ll) {
+ mFirstSilentFrameUs = nowUs;
+ } else if (nowUs >= mFirstSilentFrameUs + 10000000ll) {
+ mInSilentMode = true;
+ ALOGI("audio in silent mode now.");
+ break;
}
} else {
if (mInSilentMode) {
@@ -326,7 +328,7 @@ void Converter::scheduleDoMoreWork() {
}
mDoMoreWorkPending = true;
- (new AMessage(kWhatDoMoreWork, id()))->post(mIsVideo ? 10000ll : 5000ll);
+ (new AMessage(kWhatDoMoreWork, id()))->post(1000ll);
}
status_t Converter::feedEncoderInputBuffers() {
@@ -404,9 +406,8 @@ status_t Converter::doMoreWork() {
sp<ABuffer> buffer = new ABuffer(size);
buffer->meta()->setInt64("timeUs", timeUs);
- if (!mIsVideo) {
- ALOGV("audio time %lld us (%.2f secs)", timeUs, timeUs / 1E6);
- }
+ ALOGV("[%s] time %lld us (%.2f secs)",
+ mIsVideo ? "video" : "audio", timeUs, timeUs / 1E6);
memcpy(buffer->data(),
mEncoderOutputBuffers.itemAt(bufferIndex)->base() + offset,
diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.cpp b/media/libstagefright/wifi-display/source/PlaybackSession.cpp
index c91b4c8..ffdafed 100644
--- a/media/libstagefright/wifi-display/source/PlaybackSession.cpp
+++ b/media/libstagefright/wifi-display/source/PlaybackSession.cpp
@@ -919,13 +919,22 @@ status_t WifiDisplaySource::PlaybackSession::addVideoSource() {
source->setUseAbsoluteTimestamps();
+#if 1
sp<RepeaterSource> videoSource =
new RepeaterSource(source, 30.0 /* rateHz */);
+#endif
+#if 1
size_t numInputBuffers;
status_t err = addSource(
true /* isVideo */, videoSource, true /* isRepeaterSource */,
&numInputBuffers);
+#else
+ size_t numInputBuffers;
+ status_t err = addSource(
+ true /* isVideo */, source, false /* isRepeaterSource */,
+ &numInputBuffers);
+#endif
if (err != OK) {
return err;