shithub: libvpx

Download patch

ref: d32a55ffc40bba75ed8b770b282836a9d248d6a9
parent: 595edb9669e27927726523c3f463d0eb6ea73f30
author: Johann Koenig <johannkoenig@google.com>
date: Tue May 15 10:35:28 EDT 2018

Revert "update libwebm"

This reverts commit 595edb9669e27927726523c3f463d0eb6ea73f30.

Incorrect check_add_cxxflags invocation prevented libwebm from
building. Correcting it causes build failures on jenkins and mac.

Original change's description:
> update libwebm
> 
> Clears "auto_ptr deprecated" warnings when building with
> clang v6.0.0
> 
> Requires C++11 support.
> 
> Change-Id: I5ea2744e73deeaa4e7b2599bacf0b6c9cf355a54

TBR=jzern@google.com,johannkoenig@google.com,builds@webmproject.org

Change-Id: I7340d912a121de035997cbd8ad77a150ee38189a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true

--- a/configure
+++ b/configure
@@ -721,7 +721,9 @@
             check_cxx "$@" <<EOF && soft_enable unit_tests
 int z;
 EOF
-            check_add_cxx_flags -std=c++11 && soft_enable webm_io
+            check_cxx "$@" <<EOF && soft_enable webm_io
+int z;
+EOF
             check_cxx "$@" <<EOF && soft_enable libyuv
 int z;
 EOF
@@ -730,7 +732,9 @@
             enabled pthread_h && check_cxx "$@" <<EOF && soft_enable unit_tests
 int z;
 EOF
-            check_add_cxx_flags -std=c++11 && soft_enable webm_io
+            check_cxx "$@" <<EOF && soft_enable webm_io
+int z;
+EOF
             check_cxx "$@" <<EOF && soft_enable libyuv
 int z;
 EOF
--- a/third_party/libwebm/Android.mk
+++ b/third_party/libwebm/Android.mk
@@ -3,7 +3,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE:= libwebm
 LOCAL_CPPFLAGS:=-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-LOCAL_CPPFLAGS+=-D__STDC_LIMIT_MACROS -std=c++11
+LOCAL_CPPFLAGS+=-D__STDC_LIMIT_MACROS -Wno-extern-c-compat
 LOCAL_C_INCLUDES:= $(LOCAL_PATH)
 LOCAL_EXPORT_C_INCLUDES:= $(LOCAL_PATH)
 
--- a/third_party/libwebm/README.libvpx
+++ b/third_party/libwebm/README.libvpx
@@ -1,5 +1,5 @@
 URL: https://chromium.googlesource.com/webm/libwebm
-Version: af81f26025b7435fa9a14ad07c58b44cf9280430
+Version: 0ae757087f5e6eb01dfea16cc09205b2425cfb74
 License: BSD
 License File: LICENSE.txt
 
@@ -7,14 +7,4 @@
 libwebm is used to handle WebM container I/O.
 
 Local Changes:
-Only keep:
- - Android.mk
- - AUTHORS.TXT
- - common/
-    file_util.cc/h
-    hdr_util.cc/h
-    webmids.h
- - LICENSE.TXT
- - mkvmuxer/
- - mkvparser/
- - PATENTS.TXT
+* <none>
--- a/third_party/libwebm/common/file_util.cc
+++ b/third_party/libwebm/common/file_util.cc
@@ -17,7 +17,6 @@
 #include <cstring>
 #include <fstream>
 #include <ios>
-#include <string>
 
 namespace libwebm {
 
@@ -42,12 +41,7 @@
   return temp_file_name;
 #else
   char tmp_file_name[_MAX_PATH];
-#if defined _MSC_VER || defined MINGW_HAS_SECURE_API
   errno_t err = tmpnam_s(tmp_file_name);
-#else
-  char* fname_pointer = tmpnam(tmp_file_name);
-  errno_t err = (fname_pointer == &tmp_file_name[0]) ? 0 : -1;
-#endif
   if (err == 0) {
     return std::string(tmp_file_name);
   }
@@ -69,15 +63,6 @@
     file_size = st.st_size;
   }
   return file_size;
-}
-
-bool GetFileContents(const std::string& file_name, std::string* contents) {
-  std::ifstream file(file_name.c_str());
-  *contents = std::string(static_cast<size_t>(GetFileSize(file_name)), 0);
-  if (file.good() && contents->size()) {
-    file.read(&(*contents)[0], contents->size());
-  }
-  return !file.fail();
 }
 
 TempFileDeleter::TempFileDeleter() { file_name_ = GetTempFileName(); }
--- a/third_party/libwebm/common/file_util.h
+++ b/third_party/libwebm/common/file_util.h
@@ -22,9 +22,6 @@
 // Returns size of file specified by |file_name|, or 0 upon failure.
 uint64_t GetFileSize(const std::string& file_name);
 
-// Gets the contents file_name as a string. Returns false on error.
-bool GetFileContents(const std::string& file_name, std::string* contents);
-
 // Manages life of temporary file specified at time of construction. Deletes
 // file upon destruction.
 class TempFileDeleter {
@@ -41,4 +38,4 @@
 
 }  // namespace libwebm
 
-#endif  // LIBWEBM_COMMON_FILE_UTIL_H_
+#endif  // LIBWEBM_COMMON_FILE_UTIL_H_
\ No newline at end of file
--- a/third_party/libwebm/common/hdr_util.cc
+++ b/third_party/libwebm/common/hdr_util.cc
@@ -36,10 +36,10 @@
   if (MasteringMetadataValuePresent(parser_mm.luminance_min))
     muxer_mm->set_luminance_min(parser_mm.luminance_min);
 
-  PrimaryChromaticityPtr r_ptr(nullptr);
-  PrimaryChromaticityPtr g_ptr(nullptr);
-  PrimaryChromaticityPtr b_ptr(nullptr);
-  PrimaryChromaticityPtr wp_ptr(nullptr);
+  PrimaryChromaticityPtr r_ptr(NULL);
+  PrimaryChromaticityPtr g_ptr(NULL);
+  PrimaryChromaticityPtr b_ptr(NULL);
+  PrimaryChromaticityPtr wp_ptr(NULL);
 
   if (parser_mm.r) {
     if (!CopyPrimaryChromaticity(*parser_mm.r, &r_ptr))
--- a/third_party/libwebm/common/hdr_util.h
+++ b/third_party/libwebm/common/hdr_util.h
@@ -47,7 +47,15 @@
   int chroma_subsampling;
 };
 
-typedef std::unique_ptr<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr;
+// disable deprecation warnings for auto_ptr
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+typedef std::auto_ptr<mkvmuxer::PrimaryChromaticity> PrimaryChromaticityPtr;
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic pop
+#endif
 
 bool CopyPrimaryChromaticity(const mkvparser::PrimaryChromaticity& parser_pc,
                              PrimaryChromaticityPtr* muxer_pc);
--- a/third_party/libwebm/mkvmuxer/mkvmuxer.cc
+++ b/third_party/libwebm/mkvmuxer/mkvmuxer.cc
@@ -8,8 +8,6 @@
 
 #include "mkvmuxer/mkvmuxer.h"
 
-#include <stdint.h>
-
 #include <cfloat>
 #include <climits>
 #include <cstdio>
@@ -26,6 +24,11 @@
 #include "mkvmuxer/mkvwriter.h"
 #include "mkvparser/mkvparser.h"
 
+// disable deprecation warnings for auto_ptr
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 namespace mkvmuxer {
 
 const float PrimaryChromaticity::kChromaticityMin = 0.0f;
@@ -69,7 +72,7 @@
   return true;
 }
 
-typedef std::unique_ptr<PrimaryChromaticity> PrimaryChromaticityPtr;
+typedef std::auto_ptr<PrimaryChromaticity> PrimaryChromaticityPtr;
 bool CopyChromaticity(const PrimaryChromaticity* src,
                       PrimaryChromaticityPtr* dst) {
   if (!dst)
@@ -1054,22 +1057,22 @@
 bool MasteringMetadata::SetChromaticity(
     const PrimaryChromaticity* r, const PrimaryChromaticity* g,
     const PrimaryChromaticity* b, const PrimaryChromaticity* white_point) {
-  PrimaryChromaticityPtr r_ptr(nullptr);
+  PrimaryChromaticityPtr r_ptr(NULL);
   if (r) {
     if (!CopyChromaticity(r, &r_ptr))
       return false;
   }
-  PrimaryChromaticityPtr g_ptr(nullptr);
+  PrimaryChromaticityPtr g_ptr(NULL);
   if (g) {
     if (!CopyChromaticity(g, &g_ptr))
       return false;
   }
-  PrimaryChromaticityPtr b_ptr(nullptr);
+  PrimaryChromaticityPtr b_ptr(NULL);
   if (b) {
     if (!CopyChromaticity(b, &b_ptr))
       return false;
   }
-  PrimaryChromaticityPtr wp_ptr(nullptr);
+  PrimaryChromaticityPtr wp_ptr(NULL);
   if (white_point) {
     if (!CopyChromaticity(white_point, &wp_ptr))
       return false;
@@ -1235,7 +1238,7 @@
 }
 
 bool Colour::SetMasteringMetadata(const MasteringMetadata& mastering_metadata) {
-  std::unique_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata());
+  std::auto_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata());
   if (!mm_ptr.get())
     return false;
 
@@ -1543,7 +1546,7 @@
 }
 
 bool VideoTrack::SetColour(const Colour& colour) {
-  std::unique_ptr<Colour> colour_ptr(new Colour());
+  std::auto_ptr<Colour> colour_ptr(new Colour());
   if (!colour_ptr.get())
     return false;
 
@@ -1571,7 +1574,7 @@
 }
 
 bool VideoTrack::SetProjection(const Projection& projection) {
-  std::unique_ptr<Projection> projection_ptr(new Projection());
+  std::auto_ptr<Projection> projection_ptr(new Projection());
   if (!projection_ptr.get())
     return false;
 
@@ -2663,7 +2666,7 @@
   // and write it if it is okay to do so (i.e.) no other track has an held back
   // frame with timestamp <= the timestamp of the frame in question.
   std::vector<std::list<Frame*>::iterator> frames_to_erase;
-  for (std::list<Frame*>::iterator
+  for (std::list<Frame *>::iterator
            current_track_iterator = stored_frames_[track_number].begin(),
            end = --stored_frames_[track_number].end();
        current_track_iterator != end; ++current_track_iterator) {
--- a/third_party/libwebm/mkvparser/mkvparser.cc
+++ b/third_party/libwebm/mkvparser/mkvparser.cc
@@ -22,8 +22,12 @@
 
 #include "common/webmids.h"
 
+// disable deprecation warnings for auto_ptr
+#if defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 namespace mkvparser {
-const long long kStringElementSizeLimit = 20 * 1000 * 1000;
 const float MasteringMetadata::kValueNotPresent = FLT_MAX;
 const long long Colour::kValueNotPresent = LLONG_MAX;
 const float Projection::kValueNotPresent = FLT_MAX;
@@ -326,7 +330,7 @@
   delete[] str;
   str = NULL;
 
-  if (size >= LONG_MAX || size < 0 || size > kStringElementSizeLimit)
+  if (size >= LONG_MAX || size < 0)
     return E_FILE_FORMAT_INVALID;
 
   // +1 for '\0' terminator
@@ -5011,7 +5015,7 @@
   if (!reader || *mm)
     return false;
 
-  std::unique_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata());
+  std::auto_ptr<MasteringMetadata> mm_ptr(new MasteringMetadata());
   if (!mm_ptr.get())
     return false;
 
@@ -5031,10 +5035,6 @@
       double value = 0;
       const long long value_parse_status =
           UnserializeFloat(reader, read_pos, child_size, value);
-      if (value < -FLT_MAX || value > FLT_MAX ||
-          (value > 0.0 && value < FLT_MIN)) {
-        return false;
-      }
       mm_ptr->luminance_max = static_cast<float>(value);
       if (value_parse_status < 0 || mm_ptr->luminance_max < 0.0 ||
           mm_ptr->luminance_max > 9999.99) {
@@ -5044,10 +5044,6 @@
       double value = 0;
       const long long value_parse_status =
           UnserializeFloat(reader, read_pos, child_size, value);
-      if (value < -FLT_MAX || value > FLT_MAX ||
-          (value > 0.0 && value < FLT_MIN)) {
-        return false;
-      }
       mm_ptr->luminance_min = static_cast<float>(value);
       if (value_parse_status < 0 || mm_ptr->luminance_min < 0.0 ||
           mm_ptr->luminance_min > 999.9999) {
@@ -5100,7 +5096,7 @@
   if (!reader || *colour)
     return false;
 
-  std::unique_ptr<Colour> colour_ptr(new Colour());
+  std::auto_ptr<Colour> colour_ptr(new Colour());
   if (!colour_ptr.get())
     return false;
 
@@ -5198,7 +5194,7 @@
   if (!reader || *projection)
     return false;
 
-  std::unique_ptr<Projection> projection_ptr(new Projection());
+  std::auto_ptr<Projection> projection_ptr(new Projection());
   if (!projection_ptr.get())
     return false;
 
@@ -7907,10 +7903,6 @@
         return E_FILE_FORMAT_INVALID;
 
       curr.len = static_cast<long>(frame_size);
-      // Check if size + curr.len could overflow.
-      if (size > LLONG_MAX - curr.len) {
-        return E_FILE_FORMAT_INVALID;
-      }
       size += curr.len;  // contribution of this frame
 
       --frame_count;
@@ -7972,11 +7964,6 @@
   const long long tc0 = pCluster->GetTimeCode();
   assert(tc0 >= 0);
 
-  // Check if tc0 + m_timecode would overflow.
-  if (tc0 < 0 || LLONG_MAX - tc0 < m_timecode) {
-    return -1;
-  }
-
   const long long tc = tc0 + m_timecode;
 
   return tc;  // unscaled timecode units
@@ -7994,10 +7981,6 @@
   const long long scale = pInfo->GetTimeCodeScale();
   assert(scale >= 1);
 
-  // Check if tc * scale could overflow.
-  if (tc != 0 && scale > LLONG_MAX / tc) {
-    return -1;
-  }
   const long long ns = tc * scale;
 
   return ns;