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

Unified Diff: content/renderer/media/video_track_adapter.h

Issue 509873002: Refactor MediaStreamTrack video onmute event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
Index: content/renderer/media/video_track_adapter.h
diff --git a/content/renderer/media/video_track_adapter.h b/content/renderer/media/video_track_adapter.h
index c26ca142981f7335469c4af6d2240d3279495208..1a616126985bd16831e69b161f6d919fa0d6b983 100644
--- a/content/renderer/media/video_track_adapter.h
+++ b/content/renderer/media/video_track_adapter.h
@@ -43,9 +43,7 @@ class VideoTrackAdapter
int max_width, int max_height,
double min_aspect_ratio,
double max_aspect_ratio,
- double max_frame_rate,
- double source_frame_rate,
- const OnMutedCallback& on_muted_state_callback);
+ double max_frame_rate);
void RemoveTrack(const MediaStreamVideoTrack* track);
// Delivers |frame| to all tracks that have registered a callback.
@@ -60,6 +58,13 @@ class VideoTrackAdapter
return io_message_loop_;
}
+ // Start monitor that frames are delivered to this object. I.E, that
+ // |DeliverFrameOnIO| is called with a frame rate of |source_frame_rate|.
+ // |on_muted_callback| is triggered on the main render thread.
+ void StartFrameMonitoring(double source_frame_rate,
+ const OnMutedCallback& on_muted_callback);
+ void StopFrameMonitoring();
+
private:
virtual ~VideoTrackAdapter();
friend class base::RefCountedThreadSafe<VideoTrackAdapter>;
@@ -73,9 +78,10 @@ class VideoTrackAdapter
double max_frame_rate);
void RemoveTrackOnIO(const MediaStreamVideoTrack* track);
- void StartTrackMonitoringOnIO(
+ void StartFrameMonitoringOnIO(
const OnMutedCallback& on_muted_state_callback,
double source_frame_rate);
+ void StopFrameMonitoringOnIO();
// Compare |frame_counter_snapshot| with the current |frame_counter_|, and
// inform of the situation (muted, not muted) via |set_muted_state_callback|.
@@ -99,6 +105,14 @@ class VideoTrackAdapter
FrameAdapters;
FrameAdapters adapters_;
+ // Set to true if frame monitoring has been started. It is only accessed on
+ // the IO-thread.
+ bool monitoring_frame_rate_;
+
+ // Keeps track of it frames have been received. It is only accessed on the
+ // IO-thread.
+ bool muted_state_;
+
// Running frame counter, accessed on the IO-thread.
uint64 frame_counter_;

Powered by Google App Engine
This is Rietveld 408576698