Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6920dfd authored by Andreas Huber's avatar Andreas Huber
Browse files

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
parent bd710197
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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());
+1 −7
Original line number Diff line number Diff line
@@ -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 */,
+1 −1
Original line number Diff line number Diff line
@@ -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();

+5 −6
Original line number Diff line number Diff line
@@ -294,12 +294,11 @@ status_t TSPacketizer::packetize(

    const sp<Track> &track = mTracks.itemAt(trackIndex);

    if (track->isH264() && !(flags & IS_ENCRYPTED)) {
        if (IsIDR(accessUnit)) {
    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->lacksADTSHeader()) {
    } else if (track->isAudio() && track->lacksADTSHeader()) {
        CHECK(!(flags & IS_ENCRYPTED));
        accessUnit = track->prependADTSHeader(accessUnit);
    }
+4 −3
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ struct TSPacketizer : public RefBase {
        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,