-Fix HOST_OS detection in build_ffpeg.sh
-https://bugs.gentoo.org/show_bug.cgi?id=491466
-
-Enable gold linker
-https://bugs.gentoo.org/show_bug.cgi?id=491850
-
---- a/third_party/ffmpeg/chromium/scripts/build_ffmpeg.sh
-+++ b/third_party/ffmpeg/chromium/scripts/build_ffmpeg.sh
-@@ -75,7 +75,7 @@
- LIBAVUTIL_VERSION_MAJOR=52
+--- a/media/ffmpeg/ffmpeg_common.h 2015-11-27 12:01:56.155462264 +0000
++++ b/media/ffmpeg/ffmpeg_common.h 2015-11-27 12:03:03.348846300 +0000
+@@ -19,10 +19,6 @@
- case $(uname -sm) in
-- Linux\ i386)
-+ Linux\ i?86)
- HOST_OS=linux
- HOST_ARCH=ia32
- JOBS=$(grep processor /proc/cpuinfo | wc -l)
-@@ -85,6 +85,11 @@
- HOST_ARCH=x64
- JOBS=$(grep processor /proc/cpuinfo | wc -l)
- ;;
-+ Linux\ arm*)
-+ HOST_OS=linux
-+ HOST_ARCH=arm
-+ JOBS=$(grep processor /proc/cpuinfo | wc -l)
-+ ;;
- Darwin\ i386)
- HOST_OS=mac
- HOST_ARCH=ia32
-@@ -117,14 +122,6 @@
- echo "LD = $(ld --version | head -n1)"
- echo
+ // Include FFmpeg header files.
+ extern "C" {
+-// Disable deprecated features which result in spammy compile warnings. This
+-// list of defines must mirror those in the 'defines' section of BUILD.gn file &
+-// ffmpeg.gyp file or the headers below will generate different structures!
+-#define FF_API_CONVERGENCE_DURATION 0
+ // Upstream libavcodec/utils.c still uses the deprecated
+ // av_dup_packet(), causing deprecation warnings.
+ // The normal fix for such things is to disable the feature as below,
+@@ -36,7 +32,6 @@
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+-#include <libavformat/internal.h>
+ #include <libavformat/avio.h>
+ #include <libavutil/avutil.h>
+ #include <libavutil/imgutils.h>
+diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
+index 155e980..7ba327a 100644
+--- a/media/filters/ffmpeg_demuxer.cc
++++ b/media/filters/ffmpeg_demuxer.cc
+@@ -966,24 +966,6 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
+ // If no estimate is found, the stream entry will be kInfiniteDuration().
+ std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams,
+ kInfiniteDuration());
+- const AVFormatInternal* internal = format_context->internal;
+- if (internal && internal->packet_buffer &&
+- format_context->start_time != static_cast<int64>(AV_NOPTS_VALUE)) {
+- struct AVPacketList* packet_buffer = internal->packet_buffer;
+- while (packet_buffer != internal->packet_buffer_end) {
+- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
+- start_time_estimates.size());
+- const AVStream* stream =
+- format_context->streams[packet_buffer->pkt.stream_index];
+- if (packet_buffer->pkt.pts != static_cast<int64>(AV_NOPTS_VALUE)) {
+- const base::TimeDelta packet_pts =
+- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
+- if (packet_pts < start_time_estimates[stream->index])
+- start_time_estimates[stream->index] = packet_pts;
+- }
+- packet_buffer = packet_buffer->next;
+- }
+- }
--# As of this writing gold 2.20.1-system.20100303 is unable to link FFmpeg.
--if ld --version | grep -q gold; then
-- echo "gold is unable to link FFmpeg"
-- echo
-- echo "Switch /usr/bin/ld to the regular binutils ld and try again"
-- exit 1
--fi
--
- # We want to use a sufficiently recent version of yasm on Windows.
- if [[ "$TARGET_OS" == "win" || "$TARGET_OS" == "win-vs2013" ]]; then
- if !(which yasm 2>&1 > /dev/null); then
-@@ -292,14 +289,16 @@
- add_flag_common --extra-cflags=-m32
- add_flag_common --extra-ldflags=-m32
- elif [ "$TARGET_ARCH" = "arm" ]; then
-- # This if-statement essentially is for chroot tegra2.
-- add_flag_common --enable-cross-compile
-+ if [ "$HOST_ARCH" != "arm" ]; then
-+ # This if-statement essentially is for chroot tegra2.
-+ add_flag_common --enable-cross-compile
-
-- # Location is for CrOS chroot. If you want to use this, enter chroot
-- # and copy ffmpeg to a location that is reachable.
-- add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
-- add_flag_common --target-os=linux
-- add_flag_common --arch=arm
-+ # Location is for CrOS chroot. If you want to use this, enter chroot
-+ # and copy ffmpeg to a location that is reachable.
-+ add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
-+ add_flag_common --target-os=linux
-+ add_flag_common --arch=arm
-+ fi
-
- # TODO(ihf): ARM compile flags are tricky. The final options
- # overriding everything live in chroot /build/*/etc/make.conf
-@@ -322,11 +321,13 @@
- # NOTE: softfp/hardfp selected at gyp time.
- add_flag_common --extra-cflags=-mfloat-abi=hard
- elif [ "$TARGET_ARCH" = "arm-neon" ]; then
-- # This if-statement is for chroot arm-generic.
-- add_flag_common --enable-cross-compile
-- add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
-- add_flag_common --target-os=linux
-- add_flag_common --arch=arm
-+ if [ "$HOST_ARCH" != "arm" ]; then
-+ # This if-statement is for chroot arm-generic.
-+ add_flag_common --enable-cross-compile
-+ add_flag_common --cross-prefix=/usr/bin/armv7a-cros-linux-gnueabi-
-+ add_flag_common --target-os=linux
-+ add_flag_common --arch=arm
-+ fi
- add_flag_common --enable-armv6
- add_flag_common --enable-armv6t2
- add_flag_common --enable-vfp
+ AVStream* audio_stream = NULL;
+ AudioDecoderConfig audio_config;