summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive/LiveSession.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/httplive/LiveSession.cpp')
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index 74f58e9..4886000 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -171,6 +171,8 @@ LiveSession::LiveSession(
mOrigBandwidthIndex(-1),
mLastBandwidthBps(-1ll),
mBandwidthEstimator(new BandwidthEstimator()),
+ mMaxWidth(720),
+ mMaxHeight(480),
mStreamMask(0),
mNewStreamMask(0),
mSwapMask(0),
@@ -345,6 +347,9 @@ status_t LiveSession::getStreamFormat(StreamType stream, sp<AMessage> *format) {
if (stream == STREAMTYPE_AUDIO) {
// set AAC input buffer size to 32K bytes (256kbps x 1sec)
meta->setInt32(kKeyMaxInputSize, 32 * 1024);
+ } else if (stream == STREAMTYPE_VIDEO) {
+ meta->setInt32(kKeyMaxWidth, mMaxWidth);
+ meta->setInt32(kKeyMaxHeight, mMaxHeight);
}
return convertMetaDataToMessage(meta, format);
@@ -847,6 +852,9 @@ void LiveSession::onConnect(const sp<AMessage> &msg) {
size_t initialBandwidth = 0;
size_t initialBandwidthIndex = 0;
+ int32_t maxWidth = 0;
+ int32_t maxHeight = 0;
+
if (mPlaylist->isVariantPlaylist()) {
Vector<BandwidthItem> itemsWithVideo;
for (size_t i = 0; i < mPlaylist->size(); ++i) {
@@ -860,6 +868,14 @@ void LiveSession::onConnect(const sp<AMessage> &msg) {
CHECK(meta->findInt32("bandwidth", (int32_t *)&item.mBandwidth));
+ int32_t width, height;
+ if (meta->findInt32("width", &width)) {
+ maxWidth = max(maxWidth, width);
+ }
+ if (meta->findInt32("height", &height)) {
+ maxHeight = max(maxHeight, height);
+ }
+
mBandwidthItems.push(item);
if (mPlaylist->hasType(i, "video")) {
itemsWithVideo.push(item);
@@ -893,6 +909,9 @@ void LiveSession::onConnect(const sp<AMessage> &msg) {
mBandwidthItems.push(item);
}
+ mMaxWidth = maxWidth > 0 ? maxWidth : mMaxWidth;
+ mMaxHeight = maxHeight > 0 ? maxHeight : mMaxHeight;
+
mPlaylist->pickRandomMediaItems();
changeConfiguration(
0ll /* timeUs */, initialBandwidthIndex, false /* pickTrack */);