summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-11-28 15:40:54 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-28 15:40:59 -0800
commit79c56d3f17d3193a0a86eb3c9bfdea90b89ae3f9 (patch)
treef18d83816b3c2cc3ec7d05d44b26e7ffccccd7c2
parent0dbe5a9321b24b6883fbb2fe97cd9d525128b0b5 (diff)
parent13e8a0e8a14faaf3fe0bcebf4da1f2694d59565d (diff)
downloadframeworks_av-79c56d3f17d3193a0a86eb3c9bfdea90b89ae3f9.zip
frameworks_av-79c56d3f17d3193a0a86eb3c9bfdea90b89ae3f9.tar.gz
frameworks_av-79c56d3f17d3193a0a86eb3c9bfdea90b89ae3f9.tar.bz2
Merge "Reduce the frequency of IDR frames and add intra-fresh mode support for WiFi display" into jb-mr1.1-dev
-rw-r--r--media/libstagefright/wifi-display/source/Converter.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/media/libstagefright/wifi-display/source/Converter.cpp b/media/libstagefright/wifi-display/source/Converter.cpp
index 82c98b9..7a87444 100644
--- a/media/libstagefright/wifi-display/source/Converter.cpp
+++ b/media/libstagefright/wifi-display/source/Converter.cpp
@@ -161,7 +161,24 @@ status_t Converter::initEncoder() {
mOutputFormat->setInt32("bitrate", videoBitrate);
mOutputFormat->setInt32("bitrate-mode", OMX_Video_ControlRateConstant);
mOutputFormat->setInt32("frame-rate", 30);
- mOutputFormat->setInt32("i-frame-interval", 1); // Iframes every 1 secs
+ mOutputFormat->setInt32("i-frame-interval", 15); // Iframes every 15 secs
+
+ // Configure encoder to use intra macroblock refresh mode
+ mOutputFormat->setInt32("intra-refresh-mode", OMX_VIDEO_IntraRefreshCyclic);
+
+ int width, height, mbs;
+ if (!mOutputFormat->findInt32("width", &width)
+ || !mOutputFormat->findInt32("height", &height)) {
+ return ERROR_UNSUPPORTED;
+ }
+
+ // Update macroblocks in a cyclic fashion with 10% of all MBs within
+ // frame gets updated at one time. It takes about 10 frames to
+ // completely update a whole video frame. If the frame rate is 30,
+ // it takes about 333 ms in the best case (if next frame is not an IDR)
+ // to recover from a lost/corrupted packet.
+ mbs = (((width + 15) / 16) * ((height + 15) / 16) * 10) / 100;
+ mOutputFormat->setInt32("intra-refresh-CIR-mbs", mbs);
}
ALOGV("output format is '%s'", mOutputFormat->debugString(0).c_str());