summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-merger <android-merger@google.com>2010-12-15 09:25:02 -0800
committerandroid-merger <android-merger@google.com>2010-12-15 09:25:02 -0800
commitf6c49c6b8d4dc22a1a58191494631bd764f6212f (patch)
tree0e9301196a76a95efce618b147eac6c1bc47079e
parent1a9c7fd81bc5e3ad2daf929658f6c04a6f81b772 (diff)
parentd27f1e6959cdcdadfa471b9824686d784ca55def (diff)
downloadframeworks_av-f6c49c6b8d4dc22a1a58191494631bd764f6212f.zip
frameworks_av-f6c49c6b8d4dc22a1a58191494631bd764f6212f.tar.gz
frameworks_av-f6c49c6b8d4dc22a1a58191494631bd764f6212f.tar.bz2
Merge branch 'master' into honeycomb-release
-rw-r--r--media/libstagefright/OMXCodec.cpp1
-rw-r--r--media/libstagefright/WAVExtractor.cpp2
-rw-r--r--media/libstagefright/id3/ID3.cpp28
-rw-r--r--media/libstagefright/include/ID3.h2
4 files changed, 27 insertions, 6 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 43e4e97..69ab75a 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -2675,6 +2675,7 @@ bool OMXCodec::drainInputBuffer(BufferInfo *info) {
signalEOS = true;
mFinalStatus = err;
mSignalledEOS = true;
+ mBufferFilled.signal();
break;
}
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index 446021c..9332120 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -318,7 +318,7 @@ status_t WAVSource::read(
int64_t seekTimeUs;
ReadOptions::SeekMode mode;
if (options != NULL && options->getSeekTo(&seekTimeUs, &mode)) {
- int64_t pos = (seekTimeUs * mSampleRate) / 1000000 * mNumChannels * 2;
+ int64_t pos = (seekTimeUs * mSampleRate) / 1000000 * mNumChannels * (mBitsPerSample >> 3);
if (pos > mSize) {
pos = mSize;
}
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index e9131a6..45e018d 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -149,7 +149,25 @@ struct id3_header {
}
if (header.version_major == 4) {
- if (!removeUnsynchronizationV2_4()) {
+ void *copy = malloc(size);
+ memcpy(copy, mData, size);
+
+ bool success = removeUnsynchronizationV2_4(false /* iTunesHack */);
+ if (!success) {
+ memcpy(mData, copy, size);
+ mSize = size;
+
+ success = removeUnsynchronizationV2_4(true /* iTunesHack */);
+
+ if (success) {
+ LOGV("Had to apply the iTunes hack to parse this ID3 tag");
+ }
+ }
+
+ free(copy);
+ copy = NULL;
+
+ if (!success) {
free(mData);
mData = NULL;
@@ -261,7 +279,7 @@ static void WriteSyncsafeInteger(uint8_t *dst, size_t x) {
}
}
-bool ID3::removeUnsynchronizationV2_4() {
+bool ID3::removeUnsynchronizationV2_4(bool iTunesHack) {
size_t oldSize = mSize;
size_t offset = 0;
@@ -271,7 +289,9 @@ bool ID3::removeUnsynchronizationV2_4() {
}
size_t dataSize;
- if (!ParseSyncsafeInteger(&mData[offset + 4], &dataSize)) {
+ if (iTunesHack) {
+ dataSize = U32_AT(&mData[offset + 4]);
+ } else if (!ParseSyncsafeInteger(&mData[offset + 4], &dataSize)) {
return false;
}
@@ -308,7 +328,7 @@ bool ID3::removeUnsynchronizationV2_4() {
flags &= ~2;
}
- if (flags != prevFlags) {
+ if (flags != prevFlags || iTunesHack) {
WriteSyncsafeInteger(&mData[offset + 4], dataSize);
mData[offset + 8] = flags >> 8;
mData[offset + 9] = flags & 0xff;
diff --git a/media/libstagefright/include/ID3.h b/media/libstagefright/include/ID3.h
index 7ddbb41..98c82a4 100644
--- a/media/libstagefright/include/ID3.h
+++ b/media/libstagefright/include/ID3.h
@@ -80,7 +80,7 @@ private:
bool parseV1(const sp<DataSource> &source);
bool parseV2(const sp<DataSource> &source);
void removeUnsynchronization();
- bool removeUnsynchronizationV2_4();
+ bool removeUnsynchronizationV2_4(bool iTunesHack);
static bool ParseSyncsafeInteger(const uint8_t encoded[4], size_t *x);