[Android] Util: use -1 as default for consistency and add debug

Edward Wang git at videolan.org
Thu Jul 24 16:52:51 CEST 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jul 24 10:48:27 2014 -0400| [22e966e9e49faa6f0a8e7c5a55d6cca1dd8426be] | committer: Edward Wang

Util: use -1 as default for consistency and add debug

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=22e966e9e49faa6f0a8e7c5a55d6cca1dd8426be
---

 vlc-android/src/org/videolan/libvlc/LibVlcUtil.java |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
index 014aaf3..2c7fb70 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
@@ -218,18 +218,21 @@ public class LibVlcUtil {
             }
         }
 
-        float frequency = 0.f;
+        float frequency = -1;
         try {
             FileReader fileReader = new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
             BufferedReader br = new BufferedReader(fileReader);
+            String line = "";
             try {
-                frequency = Float.parseFloat(br.readLine()) / 1000.f; /* Convert to MHz */
+                line = br.readLine();
+                frequency = Float.parseFloat(line) / 1000.f; /* Convert to MHz */
             } catch(NumberFormatException e) {
-                /* keep default value of 0.f */
+                Log.w(TAG, "Could not parse maximum CPU frequency!");
+                Log.w(TAG, "Failed to parse: " + line);
             }
             fileReader.close();
         } catch(IOException ex) {
-            Log.w(TAG, "Could not find maximum CPU frequency.");
+            Log.w(TAG, "Could not find maximum CPU frequency!");
         }
 
         errorMsg = null;



More information about the Android mailing list