summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-11-15 18:31:50 -0800
committerJames Dong <jdong@google.com>2012-11-28 15:03:57 -0800
commit13e8a0e8a14faaf3fe0bcebf4da1f2694d59565d (patch)
tree2be664ce0155abfa4edd62ca4ac582c649636a19
parentb7c8e91880463ff4981e3e53e98e45d68e2fe374 (diff)
downloadframeworks_av-13e8a0e8a14faaf3fe0bcebf4da1f2694d59565d.zip
frameworks_av-13e8a0e8a14faaf3fe0bcebf4da1f2694d59565d.tar.gz
frameworks_av-13e8a0e8a14faaf3fe0bcebf4da1f2694d59565d.tar.bz2
Reduce the frequency of IDR frames and add intra-fresh mode support for WiFi display
The time interval between periodic neighboring IDR frames is increased from 1 second to 15 seconds. o related-to-bug: 7524791 Change-Id: Ic32f37448f952f329549eda5e73637ee3b02f046
-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());