summaryrefslogtreecommitdiffstats
path: root/camera/Encoder_libjpeg.cpp
diff options
context:
space:
mode:
authorEmilian Peev <epeev@mm-sol.com>2012-05-21 12:38:23 +0300
committerEino-Ville Talvala <etalvala@google.com>2012-05-23 14:38:01 -0700
commitc78626b15e9f29a5bcf85447ceafb17dcbf58b69 (patch)
treeb6fcc502eceb58bfda03fcc60f597ce121b56585 /camera/Encoder_libjpeg.cpp
parent8fa731ddc4e629880eda7f1f69de4fc4556cb7cb (diff)
downloadhardware_ti_omap4xxx-c78626b15e9f29a5bcf85447ceafb17dcbf58b69.tar.gz
hardware_ti_omap4xxx-c78626b15e9f29a5bcf85447ceafb17dcbf58b69.tar.bz2
hardware_ti_omap4xxx-c78626b15e9f29a5bcf85447ceafb17dcbf58b69.zip
CameraHal: Avoids possible race conditions while accessing 'mParams'
- Direct access of 'mParams' outside of 'get-/setParameters()' should be avoided. The underlying strings can get invalidated with each call to 'setParameters()', which can lead to instabilities. - This change also removes legacy stereo code, which is not used any more. Bug: 6509329 Change-Id: Ief6df206c33fbdc666644cea8630e0bce6a36c00 Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Diffstat (limited to 'camera/Encoder_libjpeg.cpp')
-rw-r--r--camera/Encoder_libjpeg.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/camera/Encoder_libjpeg.cpp b/camera/Encoder_libjpeg.cpp
index d50b2ea..c7da115 100644
--- a/camera/Encoder_libjpeg.cpp
+++ b/camera/Encoder_libjpeg.cpp
@@ -47,17 +47,17 @@ extern "C" {
#define MIN(x,y) ((x < y) ? x : y)
namespace android {
-struct string_pair {
- const char* string1;
- const char* string2;
+struct integer_string_pair {
+ unsigned int integer;
+ const char* string;
};
-static string_pair degress_to_exif_lut [] = {
+static integer_string_pair degress_to_exif_lut [] = {
// degrees, exif_orientation
- {"0", "1"},
- {"90", "6"},
- {"180", "3"},
- {"270", "8"},
+ {0, "1"},
+ {90, "6"},
+ {180, "3"},
+ {270, "8"},
};
struct libjpeg_destination_mgr : jpeg_destination_mgr {
libjpeg_destination_mgr(uint8_t* input, int size);
@@ -200,10 +200,10 @@ static void resize_nv12(Encoder_libjpeg::params* params, uint8_t* dst_buffer) {
}
/* public static functions */
-const char* ExifElementsTable::degreesToExifOrientation(const char* degrees) {
+const char* ExifElementsTable::degreesToExifOrientation(unsigned int degrees) {
for (unsigned int i = 0; i < ARRAY_SIZE(degress_to_exif_lut); i++) {
- if (!strcmp(degrees, degress_to_exif_lut[i].string1)) {
- return degress_to_exif_lut[i].string2;
+ if (degrees == degress_to_exif_lut[i].integer) {
+ return degress_to_exif_lut[i].string;
}
}
return NULL;