summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-10-02 10:16:47 -0700
committerAndreas Huber <andih@google.com>2012-10-02 10:16:47 -0700
commitc6920dfdca378a168a2168f4a64d21af4d37d539 (patch)
treee446b52f041efc7e5317de4761856bf994526c12 /media/libstagefright
parentbd710197a47e3772763c48bfb5d6be21df173a7f (diff)
downloadframeworks_av-c6920dfdca378a168a2168f4a64d21af4d37d539.zip
frameworks_av-c6920dfdca378a168a2168f4a64d21af4d37d539.tar.gz
frameworks_av-c6920dfdca378a168a2168f4a64d21af4d37d539.tar.bz2
Take advantage of the hardware encoder's ability to prepend SPS/PPS
to IDR frames instead of doing it manually. Change-Id: I994cfbd6539013406dd610393ba1f0b9a0dbf4d5 related-to-bug: 7245308
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/wifi-display/source/Converter.cpp2
-rw-r--r--media/libstagefright/wifi-display/source/PlaybackSession.cpp8
-rw-r--r--media/libstagefright/wifi-display/source/PlaybackSession.h2
-rw-r--r--media/libstagefright/wifi-display/source/TSPacketizer.cpp11
-rw-r--r--media/libstagefright/wifi-display/source/TSPacketizer.h7
5 files changed, 12 insertions, 18 deletions
diff --git a/media/libstagefright/wifi-display/source/Converter.cpp b/media/libstagefright/wifi-display/source/Converter.cpp
index 60cca69..f04010b 100644
--- a/media/libstagefright/wifi-display/source/Converter.cpp
+++ b/media/libstagefright/wifi-display/source/Converter.cpp
@@ -134,7 +134,7 @@ status_t Converter::initEncoder() {
mOutputFormat->setInt32("bitrate", videoBitrate);
mOutputFormat->setInt32("frame-rate", 60);
mOutputFormat->setInt32("i-frame-interval", 1); // Iframes every 1 secs
- // mOutputFormat->setInt32("prepend-sps-pps-to-idr-frames", 1);
+ mOutputFormat->setInt32("prepend-sps-pps-to-idr-frames", 1);
}
ALOGV("output format is '%s'", mOutputFormat->debugString(0).c_str());
diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.cpp b/media/libstagefright/wifi-display/source/PlaybackSession.cpp
index 7de607c..fc5945b 100644
--- a/media/libstagefright/wifi-display/source/PlaybackSession.cpp
+++ b/media/libstagefright/wifi-display/source/PlaybackSession.cpp
@@ -1321,7 +1321,7 @@ bool WifiDisplaySource::PlaybackSession::allTracksHavePacketizerIndex() {
}
status_t WifiDisplaySource::PlaybackSession::packetizeAccessUnit(
- size_t trackIndex, sp<ABuffer> accessUnit) {
+ size_t trackIndex, const sp<ABuffer> &accessUnit) {
const sp<Track> &track = mTracks.valueFor(trackIndex);
uint32_t flags = 0;
@@ -1332,12 +1332,6 @@ status_t WifiDisplaySource::PlaybackSession::packetizeAccessUnit(
if (mHDCP != NULL && !track->isAudio()) {
isHDCPEncrypted = true;
- if (IsIDR(accessUnit)) {
- // XXX remove this once the encoder takes care of this.
- accessUnit = mPacketizer->prependCSD(
- track->packetizerTrackIndex(), accessUnit);
- }
-
status_t err = mHDCP->encrypt(
accessUnit->data(), accessUnit->size(),
trackIndex /* streamCTR */,
diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.h b/media/libstagefright/wifi-display/source/PlaybackSession.h
index 8d88648..7da8440 100644
--- a/media/libstagefright/wifi-display/source/PlaybackSession.h
+++ b/media/libstagefright/wifi-display/source/PlaybackSession.h
@@ -206,7 +206,7 @@ private:
bool allTracksHavePacketizerIndex();
status_t packetizeAccessUnit(
- size_t trackIndex, sp<ABuffer> accessUnit);
+ size_t trackIndex, const sp<ABuffer> &accessUnit);
status_t packetizeQueuedAccessUnits();
diff --git a/media/libstagefright/wifi-display/source/TSPacketizer.cpp b/media/libstagefright/wifi-display/source/TSPacketizer.cpp
index dd18998..e5abd57 100644
--- a/media/libstagefright/wifi-display/source/TSPacketizer.cpp
+++ b/media/libstagefright/wifi-display/source/TSPacketizer.cpp
@@ -294,12 +294,11 @@ status_t TSPacketizer::packetize(
const sp<Track> &track = mTracks.itemAt(trackIndex);
- if (track->isH264() && !(flags & IS_ENCRYPTED)) {
- if (IsIDR(accessUnit)) {
- // prepend codec specific data, i.e. SPS and PPS.
- accessUnit = track->prependCSD(accessUnit);
- }
- } else if (track->lacksADTSHeader()) {
+ if (track->isH264() && (flags & PREPEND_SPS_PPS_TO_IDR_FRAMES)
+ && IsIDR(accessUnit)) {
+ // prepend codec specific data, i.e. SPS and PPS.
+ accessUnit = track->prependCSD(accessUnit);
+ } else if (track->isAudio() && track->lacksADTSHeader()) {
CHECK(!(flags & IS_ENCRYPTED));
accessUnit = track->prependADTSHeader(accessUnit);
}
diff --git a/media/libstagefright/wifi-display/source/TSPacketizer.h b/media/libstagefright/wifi-display/source/TSPacketizer.h
index 01f174a..0733c06 100644
--- a/media/libstagefright/wifi-display/source/TSPacketizer.h
+++ b/media/libstagefright/wifi-display/source/TSPacketizer.h
@@ -38,9 +38,10 @@ struct TSPacketizer : public RefBase {
ssize_t addTrack(const sp<AMessage> &format);
enum {
- EMIT_PAT_AND_PMT = 1,
- EMIT_PCR = 2,
- IS_ENCRYPTED = 4,
+ EMIT_PAT_AND_PMT = 1,
+ EMIT_PCR = 2,
+ IS_ENCRYPTED = 4,
+ PREPEND_SPS_PPS_TO_IDR_FRAMES = 8,
};
status_t packetize(
size_t trackIndex, const sp<ABuffer> &accessUnit,