Merge "Switch LiveSource to use the new http data source instead of the old one." into kraken
This commit is contained in:
committed by
Android (Google) Code Review
commit
fbdb5f1bb6
@@ -18,12 +18,10 @@
|
|||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
|
|
||||||
#include "include/LiveSource.h"
|
#include "include/LiveSource.h"
|
||||||
|
|
||||||
#include "include/HTTPStream.h"
|
|
||||||
#include "include/M3UParser.h"
|
#include "include/M3UParser.h"
|
||||||
|
#include "include/NuHTTPDataSource.h"
|
||||||
|
|
||||||
#include <media/stagefright/foundation/ABuffer.h>
|
#include <media/stagefright/foundation/ABuffer.h>
|
||||||
#include <media/stagefright/HTTPDataSource.h>
|
|
||||||
#include <media/stagefright/MediaDebug.h>
|
#include <media/stagefright/MediaDebug.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
@@ -33,6 +31,7 @@ LiveSource::LiveSource(const char *url)
|
|||||||
mInitCheck(NO_INIT),
|
mInitCheck(NO_INIT),
|
||||||
mPlaylistIndex(0),
|
mPlaylistIndex(0),
|
||||||
mLastFetchTimeUs(-1),
|
mLastFetchTimeUs(-1),
|
||||||
|
mSource(new NuHTTPDataSource),
|
||||||
mSourceSize(0),
|
mSourceSize(0),
|
||||||
mOffsetBias(0) {
|
mOffsetBias(0) {
|
||||||
if (switchToNext()) {
|
if (switchToNext()) {
|
||||||
@@ -115,8 +114,7 @@ bool LiveSource::switchToNext() {
|
|||||||
CHECK(mPlaylist->itemAt(mPlaylistIndex, &uri));
|
CHECK(mPlaylist->itemAt(mPlaylistIndex, &uri));
|
||||||
LOGI("switching to %s", uri.c_str());
|
LOGI("switching to %s", uri.c_str());
|
||||||
|
|
||||||
mSource = new HTTPDataSource(uri.c_str());
|
if (mSource->connect(uri.c_str()) != OK
|
||||||
if (mSource->connect() != OK
|
|
||||||
|| mSource->getSize(&mSourceSize) != OK) {
|
|| mSource->getSize(&mSourceSize) != OK) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -156,8 +154,7 @@ ssize_t LiveSource::readAt(off_t offset, void *data, size_t size) {
|
|||||||
status_t LiveSource::fetchM3U(const char *url, sp<ABuffer> *out) {
|
status_t LiveSource::fetchM3U(const char *url, sp<ABuffer> *out) {
|
||||||
*out = NULL;
|
*out = NULL;
|
||||||
|
|
||||||
mSource = new HTTPDataSource(url);
|
status_t err = mSource->connect(url);
|
||||||
status_t err = mSource->connect();
|
|
||||||
|
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
struct ABuffer;
|
struct ABuffer;
|
||||||
struct HTTPDataSource;
|
struct NuHTTPDataSource;
|
||||||
struct M3UParser;
|
struct M3UParser;
|
||||||
|
|
||||||
struct LiveSource : public DataSource {
|
struct LiveSource : public DataSource {
|
||||||
@@ -52,7 +52,7 @@ private:
|
|||||||
size_t mPlaylistIndex;
|
size_t mPlaylistIndex;
|
||||||
int64_t mLastFetchTimeUs;
|
int64_t mLastFetchTimeUs;
|
||||||
|
|
||||||
sp<HTTPDataSource> mSource;
|
sp<NuHTTPDataSource> mSource;
|
||||||
off_t mSourceSize;
|
off_t mSourceSize;
|
||||||
off_t mOffsetBias;
|
off_t mOffsetBias;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user