[go: nahoru, domu]

Fix hung streams if a track change never reaches have_enough.

During a track change it's possible that a renderer will never
reach the have_enough state again. I.e., with MSE a client may
want to seek to a later location. The current code means the
renderer will get stuck forever waiting for data that never
comes.

Instead Flush() calls from the Pipeline should always take
precedence and cancel any track changes in progress. Upstream
of the renderer the demuxer has already had the track enabled,
so just letting the normal Flush() process occur is sufficient
to restart the track.

BUG=781010
TEST=updated unittest

Change-Id: I5c005e728d9c1babf2a95c2e603a75f7976ec16d
Reviewed-on: https://chromium-review.googlesource.com/752048
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Sergey Volk <servolk@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#514324}
diff --git a/media/renderers/renderer_impl.h b/media/renderers/renderer_impl.h
index 89521c6..cd73bf26 100644
--- a/media/renderers/renderer_impl.h
+++ b/media/renderers/renderer_impl.h
@@ -249,6 +249,11 @@
   // completed.
   std::list<base::Closure> pending_actions_;
 
+  // Pending flush indicates that a track change is in the middle of a Flush and
+  // that another one can't be scheduled at this time. Instead it should be
+  // added to |pending_actions_|.
+  bool pending_flush_for_stream_change_ = false;
+
   base::WeakPtr<RendererImpl> weak_this_;
   base::WeakPtrFactory<RendererImpl> weak_factory_;