am 5c7e2567: am 0b65fac4: Revert "TransferQueue: use a few extra buffers"

* commit '5c7e256704043f0873b33b39bd1c8046b2671a05':
  Revert "TransferQueue: use a few extra buffers"
diff --git a/Android.mk b/Android.mk
index ecff19e..3d59ea7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -298,7 +298,6 @@
 	libicuuc \
 	libicui18n \
 	libmedia \
-	libmedia_native \
 	libnativehelper \
 	libskia \
 	libsqlite \
diff --git a/Source/WebKit/Android.mk b/Source/WebKit/Android.mk
index 07634b6..d440899 100644
--- a/Source/WebKit/Android.mk
+++ b/Source/WebKit/Android.mk
@@ -58,7 +58,6 @@
 	android/content/PhoneEmailDetector.cpp \
 	\
 	android/jni/AndroidHitTestResult.cpp \
-	android/jni/CacheManager.cpp \
 	android/jni/CookieManager.cpp \
 	android/jni/DeviceMotionAndOrientationManager.cpp \
 	android/jni/DeviceMotionClientImpl.cpp \
diff --git a/Source/WebKit/android/jni/CacheManager.cpp b/Source/WebKit/android/jni/CacheManager.cpp
deleted file mode 100644
index b34776d..0000000
--- a/Source/WebKit/android/jni/CacheManager.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2011, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "ChromiumIncludes.h"
-#include "WebCache.h"
-#include "WebCoreJni.h"
-
-#include <JNIHelp.h>
-#include <platform/FileSystem.h>
-#include <platform/text/Base64.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-using namespace WebCore;
-using namespace base;
-using namespace disk_cache;
-using namespace net;
-using namespace std;
-
-namespace android {
-
-// JNI for android.webkit.CacheManager
-static const char* javaCacheManagerClass = "android/webkit/CacheManager";
-
-static void setStringField(JNIEnv* env, const jobject& object, const jfieldID& field, const String& str)
-{
-    jstring jstr = wtfStringToJstring(env, str);
-    env->SetObjectField(object, field, jstr);
-    env->DeleteLocalRef(jstr);
-}
-
-static void setFieldFromHeaderIfPresent(CacheResult* result, const char* header, JNIEnv* env, const jobject& object, const jfieldID& field, bool allowEmptyString)
-{
-  String value;
-  if (result->firstResponseHeader(header, &value, allowEmptyString))
-      setStringField(env, object, field, value);
-}
-
-static String getCacheFileBaseDir(JNIEnv* env)
-{
-    static String baseDir;
-    if (baseDir.isEmpty()) {
-        jclass cacheManagerClass = env->FindClass("android/webkit/CacheManager");
-        jmethodID getCacheFileBaseDirMethod = env->GetStaticMethodID(cacheManagerClass, "getCacheFileBaseDir", "()Ljava/io/File;");
-        jclass fileClass = env->FindClass("java/io/File");
-        jmethodID getPathMethod = env->GetMethodID(fileClass, "getPath", "()Ljava/lang/String;");
-        jobject fileObject = env->CallStaticObjectMethod(cacheManagerClass, getCacheFileBaseDirMethod);
-        baseDir = jstringToWtfString(env, static_cast<jstring>(env->CallObjectMethod(fileObject, getPathMethod)));
-    }
-    return baseDir;
-}
-
-static jobject getCacheResult(JNIEnv* env, jobject, jstring url)
-{
-    // This is called on the UI thread.
-    scoped_refptr<CacheResult> result = WebCache::get(false /*privateBrowsing*/)->getCacheResult(jstringToWtfString(env, url));
-    if (!result)
-        return 0;
-
-    // We create and populate a file with the cache entry. This allows us to
-    // replicate the behaviour of the Android HTTP stack in the Java
-    // CacheManager, which opens the cache file and provides an input stream to
-    // the file as part of the Java CacheResult object!
-    String urlWtfString = jstringToWtfString(env, url);
-    Vector<char> encodedUrl;
-    base64Encode(urlWtfString.utf8().data(), urlWtfString.length(), encodedUrl, false /*insertLFs*/);
-    encodedUrl.append('\0');
-    String filePath = pathByAppendingComponent(getCacheFileBaseDir(env), encodedUrl.data());
-    if (!result->writeToFile(filePath))
-        return 0;
-
-    jclass cacheResultClass = env->FindClass("android/webkit/CacheManager$CacheResult");
-    jmethodID constructor = env->GetMethodID(cacheResultClass, "<init>", "()V");
-    // We only bother with the fields that are made accessible through the public API.
-    jfieldID contentdispositionField = env->GetFieldID(cacheResultClass, "contentdisposition", "Ljava/lang/String;");
-    jfieldID contentLengthField = env->GetFieldID(cacheResultClass, "contentLength", "J");
-    jfieldID etagField = env->GetFieldID(cacheResultClass, "etag", "Ljava/lang/String;");
-    jfieldID encodingField = env->GetFieldID(cacheResultClass, "encoding", "Ljava/lang/String;");
-    jfieldID expiresField = env->GetFieldID(cacheResultClass, "expires", "J");
-    jfieldID expiresStringField = env->GetFieldID(cacheResultClass, "expiresString", "Ljava/lang/String;");
-    jfieldID httpStatusCodeField = env->GetFieldID(cacheResultClass, "httpStatusCode", "I");
-    jfieldID lastModifiedField = env->GetFieldID(cacheResultClass, "lastModified", "Ljava/lang/String;");
-    jfieldID localPathField = env->GetFieldID(cacheResultClass, "localPath", "Ljava/lang/String;");
-    jfieldID locationField = env->GetFieldID(cacheResultClass, "location", "Ljava/lang/String;");
-    jfieldID mimeTypeField = env->GetFieldID(cacheResultClass, "mimeType", "Ljava/lang/String;");
-
-    jobject javaResult = env->NewObject(cacheResultClass, constructor);
-    setFieldFromHeaderIfPresent(result.get(), "content-disposition", env, javaResult, contentdispositionField, true);
-    env->SetLongField(javaResult, contentLengthField, result->contentSize());
-    setFieldFromHeaderIfPresent(result.get(), "etag", env, javaResult, etagField, false);
-    setStringField(env, javaResult, encodingField, "TODO"); // TODO: Where does the Android stack set this?
-    env->SetLongField(javaResult, expiresField, result->expires());
-    env->SetIntField(javaResult, httpStatusCodeField, result->responseCode());
-    setFieldFromHeaderIfPresent(result.get(), "last-modified", env, javaResult, lastModifiedField, false);
-    setStringField(env, javaResult, localPathField, encodedUrl.data());
-    setFieldFromHeaderIfPresent(result.get(), "location", env, javaResult, locationField, false);
-    setStringField(env, javaResult, mimeTypeField, result->mimeType());
-
-    return javaResult;
-}
-
-static JNINativeMethod gCacheManagerMethods[] = {
-    { "nativeGetCacheResult", "(Ljava/lang/String;)Landroid/webkit/CacheManager$CacheResult;", (void*) getCacheResult },
-};
-
-int registerCacheManager(JNIEnv* env)
-{
-#ifndef NDEBUG
-    jclass cacheManager = env->FindClass(javaCacheManagerClass);
-    ALOG_ASSERT(cacheManager, "Unable to find class");
-    env->DeleteLocalRef(cacheManager);
-#endif
-    return jniRegisterNativeMethods(env, javaCacheManagerClass, gCacheManagerMethods, NELEM(gCacheManagerMethods));
-}
-
-} // namespace android
diff --git a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
index ec052f1..d4b1ddb 100644
--- a/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
+++ b/Source/WebKit/android/jni/WebCoreJniOnLoad.cpp
@@ -91,7 +91,6 @@
 #endif
 extern int registerDeviceMotionAndOrientationManager(JNIEnv*);
 extern int registerCookieManager(JNIEnv*);
-extern int registerCacheManager(JNIEnv*);
 
 }
 
@@ -120,7 +119,6 @@
 #endif
     { "DeviceMotionAndOrientationManager", android::registerDeviceMotionAndOrientationManager },
     { "CookieManager", android::registerCookieManager },
-    { "CacheManager", android::registerCacheManager },
 };
 
 EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
diff --git a/Source/WebKit/android/plugins/ANPSoundInterface.cpp b/Source/WebKit/android/plugins/ANPSoundInterface.cpp
index 929832b..0ea9b07 100644
--- a/Source/WebKit/android/plugins/ANPSoundInterface.cpp
+++ b/Source/WebKit/android/plugins/ANPSoundInterface.cpp
@@ -36,6 +36,7 @@
     void*                mUser;
     ANPAudioCallbackProc mProc;
     android::AudioTrack* mTrack;
+    int                  mChannelCount;
 };
 
 static ANPSampleFormat toANPFormat(audio_format_t fm) {
@@ -70,8 +71,8 @@
             
             src = reinterpret_cast<android::AudioTrack::Buffer*>(info);
             dst.bufferData      = src->raw;
-            dst.channelCount    = src->channelCount;
-            dst.format          = toANPFormat((audio_format_t) src->format);
+            dst.channelCount    = track->mChannelCount;
+            dst.format          = toANPFormat(AUDIO_FORMAT_PCM_16_BIT);
             dst.size            = src->size;
             track->mProc(kMoreData_ANPAudioEvent, track->mUser, &dst);
             // return the updated size field
@@ -106,6 +107,7 @@
                                             callbackProc,
                                             track,
                                             0);
+    track->mChannelCount = channelCount;
     
     if (track->mTrack->initCheck() != 0) {  // failure
         delete track->mTrack;