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

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

Issue 617093003: Add MediaStreamSource frame rate calculation to the tracker. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding type name. Fixing IPC type problem. Created 6 years, 3 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 | « content/renderer/media/peer_connection_tracker.cc ('k') | content/renderer/media/video_track_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1a616126985bd16831e69b161f6d919fa0d6b983..e71d3d6cf110331c478a2d383dbf10d97487eae4 100644
--- a/content/renderer/media/video_track_adapter.h
+++ b/content/renderer/media/video_track_adapter.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_ADAPTER_H_
#include <vector>
+#include <queue>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -27,7 +28,7 @@ namespace content {
class VideoTrackAdapter
: public base::RefCountedThreadSafe<VideoTrackAdapter> {
public:
- typedef base::Callback<void(bool mute_state)> OnMutedCallback;
+ typedef base::Callback<void(float framerate, int dropped_frames)> OnFrameRateCallback;
explicit VideoTrackAdapter(
const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
@@ -62,13 +63,16 @@ class VideoTrackAdapter
// |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);
+ const OnFrameRateCallback& on_muted_callback);
void StopFrameMonitoring();
private:
virtual ~VideoTrackAdapter();
friend class base::RefCountedThreadSafe<VideoTrackAdapter>;
+ typedef base::Callback<void(float framerate, int dropped_frames)>
+ FrameRateCallback;
+
void AddTrackOnIO(
const MediaStreamVideoTrack* track,
VideoCaptureDeliverFrameCB frame_callback,
@@ -79,14 +83,18 @@ class VideoTrackAdapter
void RemoveTrackOnIO(const MediaStreamVideoTrack* track);
void StartFrameMonitoringOnIO(
- const OnMutedCallback& on_muted_state_callback,
+ const OnFrameRateCallback& 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|.
- void CheckFramesReceivedOnIO(const OnMutedCallback& set_muted_state_callback,
- uint64 old_frame_counter_snapshot);
+ void CheckFramesReceivedOnIO(const OnFrameRateCallback& set_muted_state_callback,
+ uint64 old_frame_counter_snapshot,
+ int old_dropped_frame_counter_snapshot);
+
+ void UpdateFrameRateOnIO(base::TimeDelta timestamp);
+ float GetFrameRateOnIO();
// |thread_checker_| is bound to the main render thread.
base::ThreadChecker thread_checker_;
@@ -119,6 +127,9 @@ class VideoTrackAdapter
// Frame rate configured on the video source, accessed on the IO-thread.
float source_frame_rate_;
+ int dropped_frames_counter_;
+ std::queue<base::TimeDelta> frame_timestamps_;
+
DISALLOW_COPY_AND_ASSIGN(VideoTrackAdapter);
};
« no previous file with comments | « content/renderer/media/peer_connection_tracker.cc ('k') | content/renderer/media/video_track_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698