Remove legacy, AwesomePlayer-based http live implementation.
Change-Id: I455d0faa5612dcd4d2bb6f2b3c7b64a1caaabf69
This commit is contained in:
@@ -732,18 +732,14 @@ 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])) {
|
||||
return NU_PLAYER;
|
||||
}
|
||||
if (!strncasecmp("http://", url, 7)) {
|
||||
size_t len = strlen(url);
|
||||
if (len >= 5 && !strcasecmp(".m3u8", &url[len - 5])) {
|
||||
return NU_PLAYER;
|
||||
}
|
||||
|
||||
if (strstr(url,"m3u8")) {
|
||||
return NU_PLAYER;
|
||||
}
|
||||
if (strstr(url,"m3u8")) {
|
||||
return NU_PLAYER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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:
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ struct MediaSource;
|
||||
struct ATSParser : public RefBase {
|
||||
enum DiscontinuityType {
|
||||
DISCONTINUITY_NONE,
|
||||
DISCONTINUITY_HTTPLIVE,
|
||||
DISCONTINUITY_SEEK,
|
||||
DISCONTINUITY_FORMATCHANGE
|
||||
};
|
||||
|
||||
@@ -202,20 +202,13 @@ void MPEG2TSExtractor::init() {
|
||||
LOGI("haveAudio=%d, haveVideo=%d", haveAudio, haveVideo);
|
||||
}
|
||||
|
||||
static bool isDiscontinuity(const uint8_t *data, ssize_t size) {
|
||||
return size == 188 && data[0] == 0x00;
|
||||
}
|
||||
|
||||
status_t MPEG2TSExtractor::feedMore() {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
uint8_t packet[kTSPacketSize];
|
||||
ssize_t n = mDataSource->readAt(mOffset, packet, kTSPacketSize);
|
||||
|
||||
if (isDiscontinuity(packet, n)) {
|
||||
LOGI("XXX discontinuity detected");
|
||||
mParser->signalDiscontinuity(ATSParser::DISCONTINUITY_HTTPLIVE);
|
||||
} else if (n < (ssize_t)kTSPacketSize) {
|
||||
if (n < (ssize_t)kTSPacketSize) {
|
||||
return (n < 0) ? (status_t)n : ERROR_END_OF_STREAM;
|
||||
} else {
|
||||
mParser->feedTSPacket(packet, kTSPacketSize);
|
||||
|
||||
Reference in New Issue
Block a user