Seek video track only when it is re-enabled

PipelineController
   (closure)   <----- calling this closure allows the rest of the track switch
       |              and seek queue to continue to happen.          ^
       |                                                             |
       v                                                             |
FFmpegDemuxer::OnSelectedVideoTrackChanged                           |
    (closure)  <----- closure is passed down, but this function      |
       |              toggles some stream bits and then passes       |
       |              the closure down to the seek.                  |
       |                                                             |
       v                                                             |
FFmpegDemuxer::SeekAnyEnabledVideoFrame                              |
    (closure)  <----- If there are no tracks to enable, we're        |
       |                done, and can call the closure    -----------|
       |                                                             |
       v                                                             |
FFmpegDemuxer::SeekInternal                                          |
    (closure)  <----- Otherwise, we keep state that we're enabling   |
       |              a track and seeking it. This state lets us     |
       |              know later that we should drop some audio      |
       |              frames.                                        |
       v                                                             |
  FFMPEG MAGIC                                                       |
   (closure)   <----- Push the callback into an ffmpeg callback      |
       |                                                             |
       |                                                             |
       v                                                             |
FFmpegDemuxer::FFmpegAfterSeekCallback                               |
    (closure)  <----- FFmpeg has moved it's file cursor back to      |
                      wherever the seek point was, and is now        |
                      reading the interleaved data from all          |
                      streams. The state set in                      |
                      SeekAnyEnabledVideoFrame lets us keep track    |
                      of which of these frames are actually          |
                      worth re-rendering; we drop the audio, play    |
                      the video, and since in-band text isn't        |
                      displayed, we just ignore it and let it        |
                      go out of sync.                                |
                      At this point, the closure is also called      |
                      and the pipeline is free do whatever. ---------|

Bug: 663999
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I30897e3f7daddd2a818af47475e20f049665236d
Reviewed-on: https://chromium-review.googlesource.com/1132678
Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585553}
3 files changed