summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-12-08 12:27:47 -0800
committerAndreas Huber <andih@google.com>2011-12-08 12:27:47 -0800
commit1906e5c7492b9cbc88601365536a69e9a490c963 (patch)
treee6cb486b8987b716312076a28c695c10115fe61a /media/libstagefright
parent894f3ca9a9f94225bb64f36847508a91d0b17a6e (diff)
downloadframeworks_av-1906e5c7492b9cbc88601365536a69e9a490c963.zip
frameworks_av-1906e5c7492b9cbc88601365536a69e9a490c963.tar.gz
frameworks_av-1906e5c7492b9cbc88601365536a69e9a490c963.tar.bz2
Fix Bitreader "putBits" implementation, make sure we emulate timestamps
if we don't receive npt time mapping from the rtsp server (i.e. live stream) Change-Id: I5147d665bd90c9a303ad6ffdafbf770f930f917c related-to-bug: 5660357
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/foundation/ABitReader.cpp8
-rw-r--r--media/libstagefright/rtsp/MyHandler.h14
2 files changed, 16 insertions, 6 deletions
diff --git a/media/libstagefright/foundation/ABitReader.cpp b/media/libstagefright/foundation/ABitReader.cpp
index f07dd4f..5499c32 100644
--- a/media/libstagefright/foundation/ABitReader.cpp
+++ b/media/libstagefright/foundation/ABitReader.cpp
@@ -79,7 +79,13 @@ void ABitReader::skipBits(size_t n) {
}
void ABitReader::putBits(uint32_t x, size_t n) {
- CHECK_LE(mNumBitsLeft + n, 32u);
+ CHECK_LE(n, 32u);
+
+ while (mNumBitsLeft + n > 32) {
+ mNumBitsLeft -= 8;
+ --mData;
+ ++mSize;
+ }
mReservoir = (mReservoir >> n) | (x << (32 - n));
mNumBitsLeft += n;
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 794c60b..5a95f9c 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -1100,6 +1100,8 @@ struct MyHandler : public AHandler {
float npt1, npt2;
if (!ASessionDescription::parseNTPRange(val.c_str(), &npt1, &npt2)) {
// This is a live stream and therefore not seekable.
+
+ LOGI("This is a live stream");
return;
}
@@ -1386,12 +1388,14 @@ private:
msg->setInt32("what", kWhatConnected);
msg->post();
- for (size_t i = 0; i < mTracks.size(); ++i) {
- TrackInfo *info = &mTracks.editItemAt(i);
+ if (mSeekable) {
+ for (size_t i = 0; i < mTracks.size(); ++i) {
+ TrackInfo *info = &mTracks.editItemAt(i);
- postNormalPlayTimeMapping(
- i,
- info->mNormalPlayTimeRTP, info->mNormalPlayTimeUs);
+ postNormalPlayTimeMapping(
+ i,
+ info->mNormalPlayTimeRTP, info->mNormalPlayTimeUs);
+ }
}
mFirstAccessUnit = false;