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

Commit 94971442 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Remove legacy, AwesomePlayer-based http live implementation."

parents 675a6527 d6c421f1
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -732,9 +732,6 @@ player_type getPlayerType(const char* url)
        return TEST_PLAYER;
    }

    char value[PROPERTY_VALUE_MAX];
    if (!property_get("media.httplive.disable-nuplayer", value, NULL)
            || (strcasecmp(value, "true") && strcmp(value, "1"))) {
    if (!strncasecmp("http://", url, 7)) {
        size_t len = strlen(url);
        if (len >= 5 && !strcasecmp(".m3u8", &url[len - 5])) {
@@ -745,7 +742,6 @@ player_type getPlayerType(const char* url)
            return NU_PLAYER;
        }
    }
    }

    // use MidiFile for MIDI extensions
    int lenURL = strlen(url);
+1 −84
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@

#include <media/stagefright/foundation/ALooper.h>
#include <media/stagefright/foundation/AMessage.h>
#include "include/LiveSession.h"

#define USE_SURFACE_ALLOC 1
#define FRAME_DROP_FREQ 7
@@ -233,17 +232,6 @@ status_t AwesomePlayer::setDataSource_l(

    mUri = uri;

    if (!strncmp("http://", uri, 7)) {
        // Hack to support http live.

        size_t len = strlen(uri);
        if (!strcasecmp(&uri[len - 5], ".m3u8")
                || strstr(&uri[7], "m3u8") != NULL) {
            mUri = "httplive://";
            mUri.append(&uri[7]);
        }
    }

    if (headers) {
        mUriHeaders = *headers;
    }
@@ -448,11 +436,6 @@ void AwesomePlayer::reset_l() {
        mRTSPController.clear();
    }

    if (mLiveSession != NULL) {
        mLiveSession->disconnect();
        mLiveSession.clear();
    }

    if (mVideoSource != NULL) {
        mVideoSource->stop();

@@ -655,35 +638,6 @@ void AwesomePlayer::onBufferingUpdate() {
    postBufferingEvent_l();
}

void AwesomePlayer::partial_reset_l() {
    // Only reset the video renderer and shut down the video decoder.
    // Then instantiate a new video decoder and resume video playback.

    mVideoRenderer.clear();

    if (mVideoBuffer) {
        mVideoBuffer->release();
        mVideoBuffer = NULL;
    }

    {
        mVideoSource->stop();

        // The following hack is necessary to ensure that the OMX
        // component is completely released by the time we may try
        // to instantiate it again.
        wp<MediaSource> tmp = mVideoSource;
        mVideoSource.clear();
        while (tmp.promote() != NULL) {
            usleep(1000);
        }
        IPCThreadState::self()->flushCommands();
    }

    CHECK_EQ((status_t)OK,
             initVideoDecoder(OMXCodec::kIgnoreCodecSpecificData));
}

void AwesomePlayer::onStreamDone() {
    // Posted whenever any stream finishes playing.

@@ -693,21 +647,7 @@ void AwesomePlayer::onStreamDone() {
    }
    mStreamDoneEventPending = false;

    if (mStreamDoneStatus == INFO_DISCONTINUITY) {
        // This special status is returned because an http live stream's
        // video stream switched to a different bandwidth at this point
        // and future data may have been encoded using different parameters.
        // This requires us to shutdown the video decoder and reinstantiate
        // a fresh one.

        LOGV("INFO_DISCONTINUITY");

        CHECK(mVideoSource != NULL);

        partial_reset_l();
        postVideoEvent_l();
        return;
    } else if (mStreamDoneStatus != ERROR_END_OF_STREAM) {
    if (mStreamDoneStatus != ERROR_END_OF_STREAM) {
        LOGV("MEDIA_ERROR %d", mStreamDoneStatus);

        notifyListener_l(
@@ -1593,29 +1533,6 @@ status_t AwesomePlayer::finishSetDataSource_l() {
            LOGI("Prepare cancelled while waiting for initial cache fill.");
            return UNKNOWN_ERROR;
        }
    } else if (!strncasecmp(mUri.string(), "httplive://", 11)) {
        String8 uri("http://");
        uri.append(mUri.string() + 11);

        if (mLooper == NULL) {
            mLooper = new ALooper;
            mLooper->setName("httplive");
            mLooper->start();
        }

        mLiveSession = new LiveSession;
        mLooper->registerHandler(mLiveSession);

        mLiveSession->connect(uri.string());
        dataSource = mLiveSession->getDataSource();

        sp<MediaExtractor> extractor =
            MediaExtractor::Create(dataSource, MEDIA_MIMETYPE_CONTAINER_MPEG2TS);

        static_cast<MPEG2TSExtractor *>(extractor.get())
            ->setLiveSession(mLiveSession);

        return setDataSource_l(extractor);
    } else if (!strncasecmp("rtsp://", mUri.string(), 7)) {
        if (mLooper == NULL) {
            mLooper = new ALooper;
+0 −12
Original line number Diff line number Diff line
@@ -168,18 +168,6 @@ void LiveSession::onConnect(const sp<AMessage> &msg) {
        CHECK_GT(mBandwidthItems.size(), 0u);

        mBandwidthItems.sort(SortByBandwidth);

        char value[PROPERTY_VALUE_MAX];
        if (property_get("media.httplive.disable-nuplayer", value, NULL)
                && (!strcasecmp(value, "true") || !strcmp(value, "1"))) {
            // The "legacy" player cannot deal with audio format changes,
            // some streams use different audio encoding parameters for
            // their lowest bandwidth stream.
            if (mBandwidthItems.size() > 1) {
                // XXX Remove the lowest bitrate stream for now...
                mBandwidthItems.removeAt(0);
            }
        }
    }

    postMonitorQueue();
+0 −5
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@ struct ARTSPController;
class DrmManagerClinet;
class DecryptHandle;

struct LiveSession;

struct AwesomeRenderer : public RefBase {
    AwesomeRenderer() {}

@@ -207,8 +205,6 @@ private:
    sp<ARTSPController> mRTSPController;
    sp<ARTSPController> mConnectingRTSPController;

    sp<LiveSession> mLiveSession;

    DrmManagerClient *mDrmManagerClient;
    DecryptHandle *mDecryptHandle;

@@ -219,7 +215,6 @@ private:
    status_t setDataSource_l(const sp<DataSource> &dataSource);
    status_t setDataSource_l(const sp<MediaExtractor> &extractor);
    void reset_l();
    void partial_reset_l();
    status_t seekTo_l(int64_t timeUs);
    status_t pause_l(bool at_eos = false);
    void initRenderer_l();
+0 −15
Original line number Diff line number Diff line
@@ -371,21 +371,6 @@ void ATSParser::Stream::signalDiscontinuity(DiscontinuityType type) {
    mBuffer->setRange(0, 0);

    switch (type) {
        case DISCONTINUITY_HTTPLIVE:
        {
            mQueue.clear(true);

            if (mStreamType == 0x1b) {
                // Don't signal discontinuities on audio streams.
                if (mSource != NULL) {
                    mSource->queueDiscontinuity(type);
                } else {
                    deferDiscontinuity(type);
                }
            }
            break;
        }

        case DISCONTINUITY_SEEK:
        case DISCONTINUITY_FORMATCHANGE:
        {
Loading