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

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

Merge "NuPlayer is now taking on the task of streaming over RTSP."

parents 35d02775 a6be6dcd
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <binder/ProcessState.h>
#include <media/IMediaPlayerService.h>
#include <media/stagefright/foundation/ALooper.h>
#include "include/ARTSPController.h"
#include "include/LiveSession.h"
#include "include/NuCachedSource2.h"
#include <media/stagefright/AudioPlayer.h>
@@ -636,7 +635,6 @@ int main(int argc, char **argv) {
    gDisplayHistogram = false;

    sp<ALooper> looper;
    sp<ARTSPController> rtspController;
    sp<LiveSession> liveSession;

    int res;
@@ -948,7 +946,6 @@ int main(int argc, char **argv) {
        sp<DataSource> dataSource = DataSource::CreateFromURI(filename);

        if (strncasecmp(filename, "sine:", 5)
                && strncasecmp(filename, "rtsp://", 7)
                && strncasecmp(filename, "httplive://", 11)
                && dataSource == NULL) {
            fprintf(stderr, "Unable to create data source.\n");
@@ -984,23 +981,7 @@ int main(int argc, char **argv) {
        } else {
            sp<MediaExtractor> extractor;

            if (!strncasecmp("rtsp://", filename, 7)) {
                if (looper == NULL) {
                    looper = new ALooper;
                    looper->start();
                }

                rtspController = new ARTSPController(looper);
                status_t err = rtspController->connect(filename);
                if (err != OK) {
                    fprintf(stderr, "could not connect to rtsp server.\n");
                    return -1;
                }

                extractor = rtspController.get();

                syncInfoPresent = false;
            } else if (!strncasecmp("httplive://", filename, 11)) {
            if (!strncasecmp("httplive://", filename, 11)) {
                String8 uri("http://");
                uri.append(filename + 11);

@@ -1117,13 +1098,6 @@ int main(int argc, char **argv) {
        } else {
            playSource(&client, mediaSource);
        }

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

            sleep(3);
        }
    }

    if ((useSurfaceAlloc || useSurfaceTexAlloc) && !audioOnly) {
+1 −1
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ LOCAL_SHARED_LIBRARIES := \
	libdl

LOCAL_STATIC_LIBRARIES := \
        libstagefright_rtsp                     \
        libstagefright_nuplayer                 \
        libstagefright_rtsp                     \

LOCAL_C_INCLUDES :=                                                 \
	$(JNI_H_INCLUDE)                                                \
+4 −0
Original line number Diff line number Diff line
@@ -584,6 +584,10 @@ player_type getPlayerType(const char* url)
        }
    }

    if (!strncasecmp("rtsp://", url, 7)) {
        return NU_PLAYER;
    }

    // use MidiFile for MIDI extensions
    int lenURL = strlen(url);
    for (int i = 0; i < NELEM(FILE_EXTS); ++i) {
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ LOCAL_SRC_FILES:= \
        NuPlayerDriver.cpp              \
        NuPlayerRenderer.cpp            \
        NuPlayerStreamListener.cpp      \
        RTSPSource.cpp                  \
        StreamingSource.cpp             \

LOCAL_C_INCLUDES := \
@@ -15,6 +16,7 @@ LOCAL_C_INCLUDES := \
	$(TOP)/frameworks/base/media/libstagefright/include             \
        $(TOP)/frameworks/base/media/libstagefright/mpeg2ts             \
        $(TOP)/frameworks/base/media/libstagefright/httplive            \
        $(TOP)/frameworks/base/media/libstagefright/rtsp                \

LOCAL_MODULE:= libstagefright_nuplayer

+17 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include "NuPlayerDriver.h"
#include "NuPlayerRenderer.h"
#include "NuPlayerSource.h"
#include "RTSPSource.h"
#include "StreamingSource.h"

#include "ATSParser.h"
@@ -87,7 +88,14 @@ void NuPlayer::setDataSource(
        const char *url, const KeyedVector<String8, String8> *headers) {
    sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());

    msg->setObject("source", new HTTPLiveSource(url, headers, mUIDValid, mUID));
    if (!strncasecmp(url, "rtsp://", 7)) {
        msg->setObject(
                "source", new RTSPSource(url, headers, mUIDValid, mUID));
    } else {
        msg->setObject(
                "source", new HTTPLiveSource(url, headers, mUIDValid, mUID));
    }

    msg->post();
}

@@ -568,8 +576,15 @@ void NuPlayer::finishReset() {
    CHECK(mAudioDecoder == NULL);
    CHECK(mVideoDecoder == NULL);

    ++mScanSourcesGeneration;
    mScanSourcesPending = false;

    mRenderer.clear();

    if (mSource != NULL) {
        mSource->stop();
        mSource.clear();
    }

    if (mDriver != NULL) {
        sp<NuPlayerDriver> driver = mDriver.promote();
Loading