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

Commit 4b77dc28 authored by John Grossman's avatar John Grossman
Browse files

LibAAH_RTP: Add support for AAC in MP4.



Cherry picked from Ie8298eb9d253fc6ede448da87660a60d23170987 and
conflicts fixed by hand.

Change-Id: I6f0a59357ba1a3d57caf67d2eb0ade7486723e7b
Signed-off-by: default avatarJohn Grossman <johngro@google.com>
parent f08d7d0e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -159,8 +159,8 @@ void AAH_DecoderPump::queueToRenderer(MediaBuffer* decoded_sample) {

                res = renderer_->queueTimedBuffer(pcm_payload, ts);
                if (res != OK) {
                    ALOGE("Failed to queue %d byte audio track buffer with media"
                          " PTS %lld. (res = %d)", decoded_amt, ts, res);
                    ALOGE("Failed to queue %d byte audio track buffer with"
                          " media PTS %lld. (res = %d)", decoded_amt, ts, res);
                } else {
                    last_queued_pts_valid_ = true;
                    last_queued_pts_ = ts;
@@ -291,8 +291,8 @@ void* AAH_DecoderPump::workThread() {
    // thread_status_.
    thread_status_ = decoder_->start(format_.get());
    if (OK != thread_status_) {
        ALOGE("AAH_DecoderPump's work thread failed to start decoder (res = %d)",
                thread_status_);
        ALOGE("AAH_DecoderPump's work thread failed to start decoder"
              " (res = %d)", thread_status_);
        return NULL;
    }

+8 −3
Original line number Diff line number Diff line
@@ -217,14 +217,15 @@ class AAH_RXPlayer : public MediaPlayerInterface {
        status_t getStatus() const { return status_; }

      protected:
        virtual ~Substream() {
            shutdown();
        }
        virtual ~Substream();

      private:
        void                cleanupDecoder();
        bool                shouldAbort(const char* log_tag);
        void                processCompletedBuffer();
        bool                setupSubstreamMeta();
        bool                setupMP3SubstreamMeta();
        bool                setupAACSubstreamMeta();
        bool                setupSubstreamType(uint8_t substream_type,
                                               uint8_t codec_type);

@@ -235,12 +236,16 @@ class AAH_RXPlayer : public MediaPlayerInterface {
        bool                substream_details_known_;
        uint8_t             substream_type_;
        uint8_t             codec_type_;
        const char*         codec_mime_type_;
        sp<MetaData>        substream_meta_;

        MediaBuffer*        buffer_in_progress_;
        uint32_t            expected_buffer_size_;
        uint32_t            buffer_filled_;

        Vector<uint8_t>     aux_data_in_progress_;
        uint32_t            aux_data_expected_size_;

        sp<AAH_DecoderPump> decoder_;

        static int64_t      kAboutToUnderflowThreshold;
+6 −4
Original line number Diff line number Diff line
@@ -431,8 +431,8 @@ bool AAH_RXPlayer::processRX(PacketBuffer* pb) {
        // Looks like a NAK packet; make sure its long enough.

        if (amt < static_cast<ssize_t>(sizeof(RetransRequest))) {
            ALOGV("Dropping packet, too short to contain NAK payload (%u bytes)",
                  static_cast<uint32_t>(amt));
            ALOGV("Dropping packet, too short to contain NAK payload"
                  " (%u bytes)", static_cast<uint32_t>(amt));
            goto drop_packet;
        }

@@ -441,7 +441,8 @@ bool AAH_RXPlayer::processRX(PacketBuffer* pb) {
        gap.start_seq_ = ntohs(rtr->start_seq_);
        gap.end_seq_   = ntohs(rtr->end_seq_);

        ALOGV("Process NAK for gap at [%hu, %hu]", gap.start_seq_, gap.end_seq_);
        ALOGV("Process NAK for gap at [%hu, %hu]",
                gap.start_seq_, gap.end_seq_);
        ring_buffer_.processNAK(&gap);

        return true;
@@ -770,7 +771,8 @@ bool AAH_RXPlayer::processGaps() {
            ALOGE("Error when sending retransmit request (%d)", errno);
        } else {
            ALOGV("%s request for range [%hu, %hu] sent",
                  (kGS_FastStartGap == gap_status) ? "Fast Start" : "Retransmit",
                  (kGS_FastStartGap == gap_status) ? "Fast Start"
                                                   : "Retransmit",
                  gap.start_seq_, gap.end_seq_);
        }

+2 −2
Original line number Diff line number Diff line
@@ -116,8 +116,8 @@ bool AAH_RXPlayer::RXRingBuffer::pushBuffer(PacketBuffer* buf,

    // Check for overflow first.
    if ((!(norm_seq & 0x8000)) && (norm_seq >= (capacity_ - 1))) {
        ALOGW("Ring buffer overflow; cap = %u, [rd, wr] = [%hu, %hu], seq = %hu",
              capacity_, rd_seq_, norm_wr_seq + rd_seq_, seq);
        ALOGW("Ring buffer overflow; cap = %u, [rd, wr] = [%hu, %hu],"
              " seq = %hu", capacity_, rd_seq_, norm_wr_seq + rd_seq_, seq);
        PacketBuffer::destroy(buf);
        return false;
    }
+280 −101

File changed.

Preview size limit exceeded, changes collapsed.

Loading