summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/wifi-display/source/Converter.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-11-12 13:08:44 -0800
committerAndreas Huber <andih@google.com>2012-11-13 13:21:36 -0800
commit0224bf170a3904576bba81593eaab113c5d3a4e7 (patch)
tree36db389aee1c43d3225d07ef4bdbcfdb8e560022 /media/libstagefright/wifi-display/source/Converter.cpp
parent78b012f5bc05706d1ce412811ccfaa9385dae0ab (diff)
downloadframeworks_av-0224bf170a3904576bba81593eaab113c5d3a4e7.zip
frameworks_av-0224bf170a3904576bba81593eaab113c5d3a4e7.tar.gz
frameworks_av-0224bf170a3904576bba81593eaab113c5d3a4e7.tar.bz2
Various improvements of wifi display code
- manually prepend SPS/PPS if encoder doesn't support it - latency improvements - support for "our" method of optional RTP retransmission - improvements to the wfd commandline tool for testing - make it easier to turn on/off suspension of the video pipeline on idle - fixes an issue where an error during encryption would cause a SEGV - add HDCP descriptor if necessary Squashed commit of the following: commit 1115be0ebb3b885b4f1b7dba56761ca013d0ec4a Author: Andreas Huber <andih@google.com> Date: Fri Nov 9 11:32:23 2012 -0800 Better shutdown of wfd -l sessions. Change-Id: Id898a14ae21efd3b065b00a729830063d39195a7 commit 0e7d106dfe4eb6e2640b0b66c65deaba265f7ff0 Author: Andreas Huber <andih@google.com> Date: Thu Nov 8 16:38:55 2012 -0800 No more sending delay, create rtp packets upfront. Change-Id: I809a225f664fdb485c7d9a49a27886601a6a26b2 commit d399e8571b77353d59afb57508dfd2a82c1ef93a Author: Andreas Huber <andih@google.com> Date: Thu Nov 8 14:19:43 2012 -0800 Restore AudioSource buffer size, factor out TimeSeries, make suspending video optional. Change-Id: Ifdfe4d447b901e714abf52856b4641d1d55a5d41 commit f8b649f0b8f917d59f4b8a2e8e6d7db61a684a78 Author: Andreas Huber <andih@google.com> Date: Thu Nov 8 09:34:06 2012 -0800 Pull 480 frames at a time from AudioSource/AudioRecord Change-Id: I1e215abd329faec3da026631122c0f4c800c0ac4 commit 1bc13452eb35eebbba00f5da93fa86535be5db59 Author: Andreas Huber <andih@google.com> Date: Thu Nov 8 08:50:30 2012 -0800 fixed bitrate traffic simulation Change-Id: Ic5efb7cbb0b5d3b4917bc77b8ba73d447249e695 commit 016cdff18e74bdc631a5679e97192645ed095aa2 Author: Andreas Huber <andih@google.com> Date: Wed Nov 7 14:00:03 2012 -0800 resurrected "our" style of retransmission. Change-Id: I34d757aba67428437cb39b8293a9651750ad20d9 commit 384cf1a3c8fb4ec410bdf8fa5722c298e6028f3e Author: Andreas Huber <andih@google.com> Date: Tue Nov 6 09:38:55 2012 -0800 Changes to make wfd work on manta. Change-Id: I7a4e00cf16581fe2146edd1b359af195774090e4 commit 9628f24b22b35f28630d99dda3614babf51bc07e Author: Andreas Huber <andih@google.com> Date: Wed Nov 7 09:15:44 2012 -0800 Patch up rtp timestamps to more accurately measure network jitter. Change-Id: I9502a4615575f97f98a215a13131a89a6ae93c6d commit 7c891a1a24f08bbd50f55be13f7d05f43e807eb8 Author: Andreas Huber <andih@google.com> Date: Tue Nov 6 09:37:24 2012 -0800 Additions to the "wfd" tool to create a local wfd source. Change-Id: I99558653a70fdc703f9d13990b3ce1c4d3ae227a Change-Id: Ia94c63fc390f597014531073485f0cfc53b3418a
Diffstat (limited to 'media/libstagefright/wifi-display/source/Converter.cpp')
-rw-r--r--media/libstagefright/wifi-display/source/Converter.cpp46
1 files changed, 40 insertions, 6 deletions
diff --git a/media/libstagefright/wifi-display/source/Converter.cpp b/media/libstagefright/wifi-display/source/Converter.cpp
index 01a394f..82c98b9 100644
--- a/media/libstagefright/wifi-display/source/Converter.cpp
+++ b/media/libstagefright/wifi-display/source/Converter.cpp
@@ -48,6 +48,7 @@ Converter::Converter(
mInputFormat(format),
mIsVideo(false),
mIsPCMAudio(usePCMAudio),
+ mNeedToManuallyPrependSPSPPS(false),
mDoMoreWorkPending(false)
#if ENABLE_SILENCE_DETECTION
,mFirstSilentFrameUs(-1ll)
@@ -94,6 +95,10 @@ sp<AMessage> Converter::getOutputFormat() const {
return mOutputFormat;
}
+bool Converter::needToManuallyPrependSPSPPS() const {
+ return mNeedToManuallyPrependSPSPPS;
+}
+
static int32_t getBitrate(const char *propName, int32_t defaultValue) {
char val[PROPERTY_VALUE_MAX];
if (property_get(propName, val, NULL)) {
@@ -157,16 +162,45 @@ status_t Converter::initEncoder() {
mOutputFormat->setInt32("bitrate-mode", OMX_Video_ControlRateConstant);
mOutputFormat->setInt32("frame-rate", 30);
mOutputFormat->setInt32("i-frame-interval", 1); // Iframes every 1 secs
- mOutputFormat->setInt32("prepend-sps-pps-to-idr-frames", 1);
}
ALOGV("output format is '%s'", mOutputFormat->debugString(0).c_str());
- status_t err = mEncoder->configure(
- mOutputFormat,
- NULL /* nativeWindow */,
- NULL /* crypto */,
- MediaCodec::CONFIGURE_FLAG_ENCODE);
+ mNeedToManuallyPrependSPSPPS = false;
+
+ status_t err = NO_INIT;
+
+ if (!isAudio) {
+ sp<AMessage> tmp = mOutputFormat->dup();
+ tmp->setInt32("prepend-sps-pps-to-idr-frames", 1);
+
+ err = mEncoder->configure(
+ tmp,
+ NULL /* nativeWindow */,
+ NULL /* crypto */,
+ MediaCodec::CONFIGURE_FLAG_ENCODE);
+
+ if (err == OK) {
+ // Encoder supported prepending SPS/PPS, we don't need to emulate
+ // it.
+ mOutputFormat = tmp;
+ } else {
+ mNeedToManuallyPrependSPSPPS = true;
+
+ ALOGI("We going to manually prepend SPS and PPS to IDR frames.");
+ }
+ }
+
+ if (err != OK) {
+ // We'll get here for audio or if we failed to configure the encoder
+ // to automatically prepend SPS/PPS in the case of video.
+
+ err = mEncoder->configure(
+ mOutputFormat,
+ NULL /* nativeWindow */,
+ NULL /* crypto */,
+ MediaCodec::CONFIGURE_FLAG_ENCODE);
+ }
if (err != OK) {
return err;