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

Unified Diff: content/renderer/media/mock_media_stream_video_source.cc

Issue 1829193003: Request frame for new sinks from MediaStreamVideoTrack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: miu@ nit. Created 4 years, 9 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/mock_media_stream_video_source.h ('k') | media/base/video_capturer_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/mock_media_stream_video_source.cc
diff --git a/content/renderer/media/mock_media_stream_video_source.cc b/content/renderer/media/mock_media_stream_video_source.cc
index f80e2c53277d7ff0ff100c23e1b26bbc07f7940a..3cfa3c0b91432ee63bdf935deacc63bcd298bbc8 100644
--- a/content/renderer/media/mock_media_stream_video_source.cc
+++ b/content/renderer/media/mock_media_stream_video_source.cc
@@ -12,7 +12,13 @@ namespace content {
MockMediaStreamVideoSource::MockMediaStreamVideoSource(
bool manual_get_supported_formats)
+ : MockMediaStreamVideoSource(manual_get_supported_formats, false) {}
+
+MockMediaStreamVideoSource::MockMediaStreamVideoSource(
+ bool manual_get_supported_formats,
+ bool respond_to_request_refresh_frame)
: manual_get_supported_formats_(manual_get_supported_formats),
+ respond_to_request_refresh_frame_(respond_to_request_refresh_frame),
max_requested_height_(0),
max_requested_width_(0),
max_requested_frame_rate_(0.0),
@@ -20,8 +26,7 @@ MockMediaStreamVideoSource::MockMediaStreamVideoSource(
supported_formats_.push_back(media::VideoCaptureFormat(
gfx::Size(MediaStreamVideoSource::kDefaultWidth,
MediaStreamVideoSource::kDefaultHeight),
- MediaStreamVideoSource::kDefaultFrameRate,
- media::PIXEL_FORMAT_I420));
+ MediaStreamVideoSource::kDefaultFrameRate, media::PIXEL_FORMAT_I420));
}
MockMediaStreamVideoSource::~MockMediaStreamVideoSource() {}
@@ -43,6 +48,17 @@ void MockMediaStreamVideoSource::CompleteGetSupportedFormats() {
base::ResetAndReturn(&formats_callback_).Run(supported_formats_);
}
+void MockMediaStreamVideoSource::RequestRefreshFrame() {
+ DCHECK(!frame_callback_.is_null());
+ if (respond_to_request_refresh_frame_) {
+ const scoped_refptr<media::VideoFrame> frame =
+ media::VideoFrame::CreateColorFrame(format_.frame_size, 0, 0, 0,
+ base::TimeDelta());
+ io_task_runner()->PostTask(
+ FROM_HERE, base::Bind(frame_callback_, frame, base::TimeTicks()));
+ }
+}
+
void MockMediaStreamVideoSource::GetCurrentSupportedFormats(
int max_requested_height,
int max_requested_width,
« no previous file with comments | « content/renderer/media/mock_media_stream_video_source.h ('k') | media/base/video_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698