The number of frames that need to be hold in the video MIO is platform-specific.
We add an extra member variable to the video mio base class, and ask the
derived class to overwrite this value if necessary.
diff --git a/android/android_surface_output.cpp b/android/android_surface_output.cpp
index 748faa8..efd7b03 100644
--- a/android/android_surface_output.cpp
+++ b/android/android_surface_output.cpp
@@ -48,6 +48,7 @@
mPvPlayer = NULL;
mEmulation = false;
iEosReceived = false;
+ mNumberOfFramesToHold = 2;
}
status_t AndroidSurfaceOutput::set(PVPlayer* pvPlayer, const sp<ISurface>& surface, bool emulation)
@@ -935,7 +936,7 @@
LOGV("Flushing buffers after EOS");
processWriteResponseQueue(0);
} else {
- processWriteResponseQueue(2);
+ processWriteResponseQueue(mNumberOfFramesToHold);
}
}
diff --git a/android/android_surface_output.h b/android/android_surface_output.h
index c07d558..095c61e 100644
--- a/android/android_surface_output.h
+++ b/android/android_surface_output.h
@@ -314,6 +314,18 @@
//This bool is set true when all necassary parameters have been received.
bool iIsMIOConfigured;
+ /*
+ * The value of mNumberOfFramesToHold is hardware/platform specific.
+ * 1. On non-overlay based platforms, its value it set to 2
+ * so as to avoid potential tearings oberved during video playback.
+ * 2. On overlay-based platforms, its value should be overwritten.
+ * We have observed video decoder starvation when a value other than 1.
+ *
+ * We set the default value to 2 in this class. Please change its value
+ * accordingly in the derived class.
+ */
+ int mNumberOfFramesToHold;
+
#ifdef PERFORMANCE_MEASUREMENTS_ENABLED
PVProfile PVOmapVideoProfile;
#endif