Submitted By:            DJ Lucas <dj_AT_linuxfromscratch_DOT_org>
Date:                    2017-06-25
Initial Package Version: 57.0.2987.110
Upstream Status:         Not submitted
Origin:                  Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/files/chromium-system-ffmpeg-r4.patch
Description:             Allows building with system provided ffmpeg. Rediffed
                         for chromium-59.0.3071.109.

diff -Naurp chromium-59.0.3071.109-orig/media/ffmpeg/ffmpeg_common.h chromium-59.0.3071.109/media/ffmpeg/ffmpeg_common.h
--- chromium-59.0.3071.109-orig/media/ffmpeg/ffmpeg_common.h	2017-06-20 17:03:19.000000000 -0500
+++ chromium-59.0.3071.109/media/ffmpeg/ffmpeg_common.h	2017-06-23 00:21:10.551912699 -0500
@@ -23,10 +23,6 @@
 
 // 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 FFmpeg's
-// BUILD.gn 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,
@@ -40,7 +36,6 @@ extern "C" {
 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 -Naurp chromium-59.0.3071.109-orig/media/filters/ffmpeg_demuxer.cc chromium-59.0.3071.109/media/filters/ffmpeg_demuxer.cc
--- chromium-59.0.3071.109-orig/media/filters/ffmpeg_demuxer.cc	2017-06-20 17:03:19.000000000 -0500
+++ chromium-59.0.3071.109/media/filters/ffmpeg_demuxer.cc	2017-06-23 00:22:56.289311692 -0500
@@ -1223,29 +1223,6 @@ void FFmpegDemuxer::OnFindStreamInfoDone
   // 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_t>(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_t>(AV_NOPTS_VALUE)) {
-        const base::TimeDelta packet_pts =
-            ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
-        // We ignore kNoTimestamp here since -int64_t::min() is possible; see
-        // https://crbug.com/700501. Technically this is a valid value, but in
-        // practice shouldn't occur, so just ignore it when estimating.
-        if (packet_pts != kNoTimestamp && packet_pts != kInfiniteDuration &&
-            packet_pts < start_time_estimates[stream->index]) {
-          start_time_estimates[stream->index] = packet_pts;
-        }
-      }
-      packet_buffer = packet_buffer->next;
-    }
-  }
 
   std::unique_ptr<MediaTracks> media_tracks(new MediaTracks());
 
