Fix face detection bug
authorVivek Ellur <vivek.ellur@samsung.com>
Thu, 22 Dec 2016 09:04:00 +0000 (14:34 +0530)
committerVivek Ellur <vivek.ellur@samsung.com>
Thu, 22 Dec 2016 09:44:47 +0000 (15:14 +0530)
Fixed crashing issue while converting pointer to structure
in StartFaceDetection method.

Change-Id: Icef7b0416f508d79e03c71d4a376a51c95ee2eb2
Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
packaging/csapi-multimedia.spec
src/Tizen.Multimedia/Camera/Camera.cs

index f06dedf..1c8afac 100644 (file)
@@ -1,6 +1,6 @@
 Name:       csapi-multimedia
 Summary:    Tizen Multimedia API for C#
-Version:    1.0.21
+Version:    1.0.22
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index 661a9f2..8fbf2c3 100755 (executable)
@@ -972,7 +972,7 @@ namespace Tizen.Multimedia
                 IntPtr current = faces;
                 for (int i = 0; i < count; i++)
                 {
-                    Marshal.PtrToStructure(current, faceStruct[i]);
+                    faceStruct[i] = Marshal.PtrToStructure<Interop.Camera.DetectedFaceStruct>(current);
                     FaceDetectedData face = new FaceDetectedData(faceStruct[i].id, faceStruct[i].score, faceStruct[i].x, faceStruct[i].y, faceStruct[i].width, faceStruct[i].height);
                     _faces.Add(face);
                     current = (IntPtr)((long)current + Marshal.SizeOf(faceStruct[i]));
@@ -1160,8 +1160,8 @@ namespace Tizen.Multimedia
                 encodedData.TimeStamp = previewStruct.timestamp;
                 encodedData.Width = previewStruct.width;
                 Interop.Camera.EncodedPlane encodedPlane = previewStruct.frameData.encodedPlane;
-                encodedData.Data = new byte[encodedPlane.size];\r
-\r
+                encodedData.Data = new byte[encodedPlane.size];
+
                 if (encodedPlane.size > 0)
                     Marshal.Copy(encodedPlane.data, encodedData.Data, 0, (int)encodedPlane.size);