Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: media/renderers/video_renderer_impl.h

Issue 1247973002: Fix race condition when accessing time_progressing_. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/renderers/video_renderer_impl.cc » ('j') | media/renderers/video_renderer_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/video_renderer_impl.h
diff --git a/media/renderers/video_renderer_impl.h b/media/renderers/video_renderer_impl.h
index 7af8bb724f686a3191bfb0fa6a6048e62ad1a8da..6f0884b2d24bab279b2d026deda27e3e1b3e0d11 100644
--- a/media/renderers/video_renderer_impl.h
+++ b/media/renderers/video_renderer_impl.h
@@ -147,8 +147,15 @@ class MEDIA_EXPORT VideoRendererImpl
// Fires |ended_cb_| if there are no remaining usable frames and
// |received_end_of_stream_| is true. Sets |rendered_end_of_stream_| if it
- // does so. Returns algorithm_->EffectiveFramesQueued().
- size_t MaybeFireEndedCallback();
+ // does so.
+ //
+ // When called from the media thread, |time_progressing| should reflect the
+ // value of |time_progressing_|. When called from Render() on the sink
+ // callback thread, the inverse of |render_first_frame_and_stop_| should be
+ // used as a proxy for |time_progressing_|.
+ //
+ // Returns algorithm_->EffectiveFramesQueued().
+ size_t MaybeFireEndedCallback_Locked(bool time_progressing);
// Helper method for converting a single media timestamp to wall clock time.
base::TimeTicks ConvertMediaTimestamp(base::TimeDelta media_timestamp);
@@ -163,7 +170,8 @@ class MEDIA_EXPORT VideoRendererImpl
// Sink which calls into VideoRendererImpl via Render() for video frames. Do
// not call any methods on the sink while |lock_| is held or the two threads
// might deadlock. Do not call Start() or Stop() on the sink directly, use
- // StartSink() and StopSink() to ensure background rendering is started.
+ // StartSink() and StopSink() to ensure background rendering is started. Only
+ // access these values on |task_runner_|.
VideoRendererSink* const sink_;
bool sink_started_;
@@ -271,7 +279,8 @@ class MEDIA_EXPORT VideoRendererImpl
// counted. Must be accessed under |lock_| once |sink_| is started.
bool was_background_rendering_;
- // Indicates whether or not media time is currently progressing or not.
+ // Indicates whether or not media time is currently progressing or not. Must
+ // only be accessed from |task_runner_|.
bool time_progressing_;
// Indicates that Render() should only render the first frame and then request
« no previous file with comments | « no previous file | media/renderers/video_renderer_impl.cc » ('j') | media/renderers/video_renderer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698