Merge "Change ANetworkSession implementation to optionally attach timestamps" into jb-mr2-dev
diff --git a/camera/tests/ProCameraTests.cpp b/camera/tests/ProCameraTests.cpp
index 71813ae..ecc0854 100644
--- a/camera/tests/ProCameraTests.cpp
+++ b/camera/tests/ProCameraTests.cpp
@@ -1015,6 +1015,9 @@
     ASSERT_NO_FATAL_FAILURE(createSubmitRequestForStreams(streams, /*count*/2,
                                                     /*requests*/REQUEST_COUNT));
 
+    int depthFrames = 0;
+    int greyFrames = 0;
+
     // Consume two frames simultaneously. Unsynchronized by timestamps.
     for (int i = 0; i < REQUEST_COUNT; ++i) {
 
@@ -1041,6 +1044,8 @@
 
         EXPECT_OK(depthConsumer->unlockBuffer(depthBuffer));
 
+        depthFrames++;
+
 
         /** Consume Greyscale frames if there are any.
           * There may not be since it runs at half FPS */
@@ -1053,9 +1058,14 @@
                 ", timestamp = " << greyBuffer.timestamp << std::endl;
 
             EXPECT_OK(consumer->unlockBuffer(greyBuffer));
+
+            greyFrames++;
         }
     }
 
+    dout << "Done, summary: depth frames " << std::dec << depthFrames
+         << ", grey frames " << std::dec << greyFrames << std::endl;
+
     // Done: clean up
     EXPECT_OK(mCamera->deleteStream(streamId));
     EXPECT_OK(mCamera->exclusiveUnlock());
diff --git a/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c b/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c
index 9ad94e0..cdfc441 100755
--- a/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c
+++ b/libvideoeditor/vss/3gpwriter/src/M4MP4W_Writer.c
@@ -2486,6 +2486,12 @@
 
 #endif
 
+        if ((M4MP4W_Time32)auPtr->CTS < mMp4FileDataPtr->videoTrackPtr->CommonData.lastCTS) {
+            // Do not report as error, it will abort the entire filewrite. Just skip this frame.
+            M4OSA_TRACE1_0("Skip frame. Video frame has too old timestamp.");
+            return M4NO_ERROR;
+        }
+
         mMp4FileDataPtr->videoTrackPtr->currentPos += auPtr->size;
 
         /* Warning: time conversion cast 64to32! */
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 94b9acf..54f8d9e 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -224,6 +224,7 @@
         pContext->pBundledContext->NumberEffectsEnabled     = 0;
         pContext->pBundledContext->NumberEffectsCalled      = 0;
         pContext->pBundledContext->firstVolume              = LVM_TRUE;
+        pContext->pBundledContext->volume                   = 0;
 
         #ifdef LVM_PCM
         char fileName[256];
diff --git a/media/libstagefright/rtsp/MyHandler.h b/media/libstagefright/rtsp/MyHandler.h
index 5d760d3..95ed43a 100644
--- a/media/libstagefright/rtsp/MyHandler.h
+++ b/media/libstagefright/rtsp/MyHandler.h
@@ -511,6 +511,9 @@
 
                     if (response->mStatusCode != 200) {
                         result = UNKNOWN_ERROR;
+                    } else if (response->mContent == NULL) {
+                        result = ERROR_MALFORMED;
+                        ALOGE("The response has no content.");
                     } else {
                         mSessionDesc = new ASessionDescription;
 
diff --git a/services/camera/libcameraservice/Camera2Device.cpp b/services/camera/libcameraservice/Camera2Device.cpp
index 37ba5ae..946cdba 100644
--- a/services/camera/libcameraservice/Camera2Device.cpp
+++ b/services/camera/libcameraservice/Camera2Device.cpp
@@ -426,7 +426,7 @@
         totalTime += kSleepTime;
         if (totalTime > kMaxSleepTime) {
             ALOGE("%s: Waited %d us, %d requests still in flight", __FUNCTION__,
-                    mHal2Device->ops->get_in_progress_count(mHal2Device), totalTime);
+                    totalTime, mHal2Device->ops->get_in_progress_count(mHal2Device));
             return TIMED_OUT;
         }
     }