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

Side by Side Diff: content/renderer/media/media_stream_video_source.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, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 static const int kDefaultFrameRate; 83 static const int kDefaultFrameRate;
84 static const int kUnknownFrameRate; 84 static const int kUnknownFrameRate;
85 85
86 protected: 86 protected:
87 virtual void DoStopSource() OVERRIDE; 87 virtual void DoStopSource() OVERRIDE;
88 88
89 // Sets ready state and notifies the ready state to all registered tracks. 89 // Sets ready state and notifies the ready state to all registered tracks.
90 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state); 90 virtual void SetReadyState(blink::WebMediaStreamSource::ReadyState state);
91 91
92 // Sets muted state and notifies it to all registered tracks. 92 // Sets muted state and notifies it to all registered tracks.
93 virtual void SetMutedState(bool state); 93 virtual void OnFrameRateCallback(float framerate, int dropped_frames);
94 94
95 // An implementation must fetch the formats that can currently be used by 95 // An implementation must fetch the formats that can currently be used by
96 // the source and call OnSupportedFormats when done. 96 // the source and call OnSupportedFormats when done.
97 // |max_requested_height| and |max_requested_width| is the max height and 97 // |max_requested_height| and |max_requested_width| is the max height and
98 // width set as a mandatory constraint if set when calling 98 // width set as a mandatory constraint if set when calling
99 // MediaStreamVideoSource::AddTrack. If max height and max width is not set 99 // MediaStreamVideoSource::AddTrack. If max height and max width is not set
100 // |max_requested_height| and |max_requested_width| are 0. 100 // |max_requested_height| and |max_requested_width| are 0.
101 virtual void GetCurrentSupportedFormats( 101 virtual void GetCurrentSupportedFormats(
102 int max_requested_width, 102 int max_requested_width,
103 int max_requested_height, 103 int max_requested_height,
104 double max_requested_frame_rate, 104 double max_requested_frame_rate,
105 const VideoCaptureDeviceFormatsCB& callback) = 0; 105 const VideoCaptureDeviceFormatsCB& callback) = 0;
106 106
107 // An implementation must start capture frames using the resolution in 107 // An implementation must start capture frames using the resolution in
108 // |params|. When the source has started or the source failed to start 108 // |params|. When the source has started or the source failed to start
109 // OnStartDone must be called. An implementation must call 109 // OnStartDone must be called. An implementation must call
110 // |frame_callback| on the IO thread with the captured frames. 110 // |frame_callback| on the IO thread with the captured frames.
111 virtual void StartSourceImpl( 111 virtual void StartSourceImpl(
112 const media::VideoCaptureFormat& format, 112 const media::VideoCaptureFormat& format,
113 const VideoCaptureDeliverFrameCB& frame_callback) = 0; 113 const VideoCaptureDeliverFrameCB& frame_callback) = 0;
114 void OnStartDone(MediaStreamRequestResult result); 114 void OnStartDone(MediaStreamRequestResult result);
115 115
116 // An implementation must immediately stop capture video frames and must not 116 // An implementation must immediately stop capture video frames and must not
117 // call OnSupportedFormats after this method has been called. After this 117 // call OnSupportedFormats after this method has been called. After this
118 // method has been called, MediaStreamVideoSource may be deleted. 118 // method has been called, MediaStreamVideoSource may be deleted.
119 virtual void StopSourceImpl() = 0; 119 virtual void StopSourceImpl() = 0;
120 120
121 virtual std::string TypeName() const;
122
121 enum State { 123 enum State {
122 NEW, 124 NEW,
123 RETRIEVING_CAPABILITIES, 125 RETRIEVING_CAPABILITIES,
124 STARTING, 126 STARTING,
125 STARTED, 127 STARTED,
126 ENDED 128 ENDED
127 }; 129 };
128 State state() const { return state_; } 130 State state() const { return state_; }
129 131
130 private: 132 private:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 176
175 // NOTE: Weak pointers must be invalidated before all other member variables. 177 // NOTE: Weak pointers must be invalidated before all other member variables.
176 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_; 178 base::WeakPtrFactory<MediaStreamVideoSource> weak_factory_;
177 179
178 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource); 180 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoSource);
179 }; 181 };
180 182
181 } // namespace content 183 } // namespace content
182 184
183 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_ 185 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW
« no previous file with comments | « content/common/media/peer_connection_tracker_messages.h ('k') | content/renderer/media/media_stream_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698