Merge "Some more fixes regarding HTTP live in NuPlayer."
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index c7f0b15..c95f31e 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -106,7 +106,7 @@
 
 // camera fatal errors
 enum {
-    CAMERA_ERROR_UKNOWN  = 1,
+    CAMERA_ERROR_UNKNOWN  = 1,
     CAMERA_ERROR_SERVER_DIED = 100
 };
 
diff --git a/include/media/stagefright/CameraSourceTimeLapse.h b/include/media/stagefright/CameraSourceTimeLapse.h
index afe7287..0e5d534 100644
--- a/include/media/stagefright/CameraSourceTimeLapse.h
+++ b/include/media/stagefright/CameraSourceTimeLapse.h
@@ -182,10 +182,10 @@
     // buffer.
     void fillLastReadBufferCopy(MediaBuffer& sourceBuffer);
 
-    // If the passed in size (width x height) is a supported preview size,
-    // the function sets the camera's preview size to it and returns true.
+    // If the passed in size (width x height) is a supported video/preview size,
+    // the function sets the camera's video/preview size to it and returns true.
     // Otherwise returns false.
-    bool trySettingPreviewSize(int32_t width, int32_t height);
+    bool trySettingVideoSize(int32_t width, int32_t height);
 
     // The still camera may not support the demanded video width and height.
     // We look for the supported picture sizes from the still camera and
diff --git a/media/libstagefright/CameraSourceTimeLapse.cpp b/media/libstagefright/CameraSourceTimeLapse.cpp
index 0b158be..9677838 100644
--- a/media/libstagefright/CameraSourceTimeLapse.cpp
+++ b/media/libstagefright/CameraSourceTimeLapse.cpp
@@ -76,7 +76,7 @@
     mVideoWidth = videoSize.width;
     mVideoHeight = videoSize.height;
 
-    if (trySettingPreviewSize(videoSize.width, videoSize.height)) {
+    if (trySettingVideoSize(videoSize.width, videoSize.height)) {
         mUseStillCameraForTimeLapse = false;
     } else {
         // TODO: Add a check to see that mTimeBetweenTimeLapseFrameCaptureUs is greater
@@ -115,29 +115,39 @@
     }
 }
 
-bool CameraSourceTimeLapse::trySettingPreviewSize(int32_t width, int32_t height) {
-    LOGV("trySettingPreviewSize: %dx%d", width, height);
+bool CameraSourceTimeLapse::trySettingVideoSize(int32_t width, int32_t height) {
+    LOGV("trySettingVideoSize: %dx%d", width, height);
     int64_t token = IPCThreadState::self()->clearCallingIdentity();
     String8 s = mCamera->getParameters();
 
     CameraParameters params(s);
     Vector<Size> supportedSizes;
-    params.getSupportedPreviewSizes(supportedSizes);
+    params.getSupportedVideoSizes(supportedSizes);
+    bool videoOutputSupported = false;
+    if (supportedSizes.size() == 0) {
+        params.getSupportedPreviewSizes(supportedSizes);
+    } else {
+        videoOutputSupported = true;
+    }
 
-    bool previewSizeSupported = false;
+    bool videoSizeSupported = false;
     for (uint32_t i = 0; i < supportedSizes.size(); ++i) {
         int32_t pictureWidth = supportedSizes[i].width;
         int32_t pictureHeight = supportedSizes[i].height;
 
         if ((pictureWidth == width) && (pictureHeight == height)) {
-            previewSizeSupported = true;
+            videoSizeSupported = true;
         }
     }
 
     bool isSuccessful = false;
-    if (previewSizeSupported) {
-        LOGV("Video size (%d, %d) is a supported preview size", width, height);
-        params.setPreviewSize(width, height);
+    if (videoSizeSupported) {
+        LOGV("Video size (%d, %d) is supported", width, height);
+        if (videoOutputSupported) {
+            params.setVideoSize(width, height);
+        } else {
+            params.setPreviewSize(width, height);
+        }
         if (mCamera->setParameters(params.flatten()) == OK) {
             isSuccessful = true;
         } else {