[vlc-devel] [PATCH] demux: hls: playlist: fall back to "C" locale

KO Myung-Hun komh78 at gmail.com
Sun Dec 6 10:58:54 CET 2015


Some systems such as OS/2, do not support other locales than C and
POSIX. And those locales cause SIGABRT due to std::runtime_error
exception, especially, when playing youtube live streaming.
---
 modules/demux/hls/playlist/Tags.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/demux/hls/playlist/Tags.cpp b/modules/demux/hls/playlist/Tags.cpp
index c8b0361..72171b3 100644
--- a/modules/demux/hls/playlist/Tags.cpp
+++ b/modules/demux/hls/playlist/Tags.cpp
@@ -20,6 +20,7 @@
 #include "Tags.hpp"
 #include <sstream>
 #include <stack>
+#include <stdexcept>
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -45,7 +46,14 @@ uint64_t Attribute::decimal() const
 double Attribute::floatingPoint() const
 {
     std::istringstream is(value);
-    is.imbue(std::locale(""));
+    try
+    {
+        is.imbue(std::locale(""));
+    }
+    catch(const std::runtime_error &e)
+    {
+        is.imbue(std::locale("C"));
+    }
     double ret;
     is >> ret;
     return ret;
-- 
2.6.0



More information about the vlc-devel mailing list