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

Issue 1849003002: Add video frame refresh to MediaStream and VideoCapture stacks. (Closed)

Created:
4 years, 8 months ago by miu
Modified:
4 years, 8 months ago
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, jam, imcheng+watch_chromium.org, posciak+watch_chromium.org, jasonroberts+watch_google.com, avayvod+watch_chromium.org, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, mkwst+moarreviews-renderer_chromium.org, xjz+watch_chromium.org, isheriff+watch_chromium.org, miu+watch_chromium.org, Irfan
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add video frame refresh to MediaStream and VideoCapture stacks. This is a follow-up on previous CLs to allow consumers of video frames in the render process to request "refresh frames" from capturers that live in the browser process. This solves a number of long-standing problems caused by capturers that halt video frame delivery (e.g., a screen capturer stops sending frames because the screen is not being updated). First, it will ensure that remote clients that join a session receive a first video frame in a timely manner. Second, it will allow a streaming implementation's bandwidth estimation logic to remain current with external/environmental condiditons. Third, it allows lossy encoders to clean up artifacts in static content. This change also includes some necessary prerequisite clean-up of the public MediaStreamVideoSink interface, which contained public static methods being passed a "self" pointer (weird!). Instead, the methods were turned into instance methods, and then made protected so that only subclasses (i.e., implementations of the interface), are allowed to call them. BUG=486274 Committed: https://crrev.com/d9425d67c7e7fdd53e181f566ddc78f27dc8281c Cr-Commit-Position: refs/heads/master@{#385582}

Patch Set 1 #

Total comments: 12

Patch Set 2 : Account for frameRate constraints when setting refresh rate in MediaStreamVideoWebRtcSink. #

Total comments: 10

Patch Set 3 : Addressed last round of comments from xjz and emircan. #

Total comments: 18

Patch Set 4 : Addressed nick's PS3 comments (moving non-observer impl out of MSVideoSink interface). #

Unified diffs Side-by-side diffs Delta from patch set Stats (+509 lines, -184 lines) Patch
M chrome/renderer/media/cast_rtp_stream.cc View 1 2 3 4 chunks +135 lines, -52 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host.h View 1 chunk +4 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_host.cc View 2 chunks +18 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M content/browser/renderer_host/media/video_capture_manager.cc View 1 chunk +18 lines, -0 lines 0 comments Download
M content/common/media/video_capture_messages.h View 1 chunk +5 lines, -0 lines 0 comments Download
M content/public/renderer/media_stream_utils.h View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M content/public/renderer/media_stream_utils.cc View 1 2 3 1 chunk +12 lines, -2 lines 0 comments Download
M content/public/renderer/media_stream_video_sink.h View 1 2 3 1 chunk +28 lines, -19 lines 0 comments Download
M content/public/renderer/media_stream_video_sink.cc View 1 2 3 1 chunk +20 lines, -15 lines 0 comments Download
M content/renderer/media/media_stream_constraints_util.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M content/renderer/media/media_stream_constraints_util.cc View 1 1 chunk +8 lines, -1 line 0 comments Download
M content/renderer/media/media_stream_video_capturer_source.cc View 2 chunks +10 lines, -0 lines 0 comments Download
M content/renderer/media/media_stream_video_capturer_source_unittest.cc View 2 chunks +13 lines, -5 lines 0 comments Download
M content/renderer/media/media_stream_video_renderer_sink.h View 1 chunk +3 lines, -3 lines 0 comments Download
M content/renderer/media/media_stream_video_renderer_sink.cc View 2 chunks +3 lines, -5 lines 0 comments Download
M content/renderer/media/media_stream_video_source.cc View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/media/media_stream_video_source_unittest.cc View 9 chunks +12 lines, -17 lines 0 comments Download
M content/renderer/media/media_stream_video_track.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/media/media_stream_video_track.cc View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/media/media_stream_video_track_unittest.cc View 8 chunks +18 lines, -21 lines 0 comments Download
M content/renderer/media/mock_media_stream_video_sink.h View 1 chunk +13 lines, -0 lines 0 comments Download
M content/renderer/media/video_capture_impl.h View 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/media/video_capture_impl.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M content/renderer/media/video_capture_impl_manager.h View 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/media/video_capture_impl_manager.cc View 1 chunk +13 lines, -0 lines 0 comments Download
M content/renderer/media/video_track_recorder.cc View 1 chunk +4 lines, -5 lines 0 comments Download
M content/renderer/media/video_track_to_pepper_adapter.cc View 1 chunk +6 lines, -6 lines 0 comments Download
M content/renderer/media/webrtc/media_stream_video_webrtc_sink.h View 1 2 3 2 chunks +10 lines, -1 line 0 comments Download
M content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc View 1 2 3 11 chunks +110 lines, -11 lines 0 comments Download
M content/renderer/pepper/pepper_media_stream_video_track_host.h View 1 chunk +0 lines, -3 lines 0 comments Download
M content/renderer/pepper/pepper_media_stream_video_track_host.cc View 1 2 3 4 chunks +10 lines, -17 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 28 (9 generated)
miu
emircan: PTAL at content/browser/renderer_host/media/* and content/renderer/media/*. pthatcher: PTAL at content/renderer/media/webrtc/media_stream_video_webrtc_sink.*. I talked to amp@, and ...
4 years, 8 months ago (2016-03-31 21:41:01 UTC) #3
emircan
https://codereview.chromium.org/1849003002/diff/1/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc File content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc (right): https://codereview.chromium.org/1849003002/diff/1/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc#newcode111 content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc:111: base::Bind(&MediaStreamVideoWebRtcSink::RequestRefreshFrame, sink)); This logic doesn't fit to the spec ...
4 years, 8 months ago (2016-04-01 00:06:47 UTC) #4
xjz
lgtm. some nits: https://codereview.chromium.org/1849003002/diff/1/chrome/renderer/media/cast_rtp_stream.cc File chrome/renderer/media/cast_rtp_stream.cc (right): https://codereview.chromium.org/1849003002/diff/1/chrome/renderer/media/cast_rtp_stream.cc#newcode452 chrome/renderer/media/cast_rtp_stream.cc:452: // Counter for the number of ...
4 years, 8 months ago (2016-04-01 19:10:04 UTC) #5
miu
emircan and xjz: Addressed your comments. PTAL at patch set 2. https://codereview.chromium.org/1849003002/diff/1/chrome/renderer/media/cast_rtp_stream.cc File chrome/renderer/media/cast_rtp_stream.cc (right): ...
4 years, 8 months ago (2016-04-01 23:24:27 UTC) #6
xjz
https://codereview.chromium.org/1849003002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/1849003002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc#newcode679 content/browser/renderer_host/media/video_capture_manager.cc:679: base::Bind(&media::VideoCaptureDevice::RequestRefreshFrame, VideoCaptureDevice::RequestRefreshFrame() currently is a virtual function with default ...
4 years, 8 months ago (2016-04-05 00:04:44 UTC) #7
emircan
lgtm % nits. https://codereview.chromium.org/1849003002/diff/20001/content/browser/renderer_host/media/video_capture_manager.h File content/browser/renderer_host/media/video_capture_manager.h (right): https://codereview.chromium.org/1849003002/diff/20001/content/browser/renderer_host/media/video_capture_manager.h#newcode115 content/browser/renderer_host/media/video_capture_manager.h:115: // Called by VideoCaptureHost to request ...
4 years, 8 months ago (2016-04-05 19:30:39 UTC) #8
miu
Thanks xjz and emircan. Addressed your comments: https://codereview.chromium.org/1849003002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc File content/browser/renderer_host/media/video_capture_manager.cc (right): https://codereview.chromium.org/1849003002/diff/20001/content/browser/renderer_host/media/video_capture_manager.cc#newcode679 content/browser/renderer_host/media/video_capture_manager.cc:679: base::Bind(&media::VideoCaptureDevice::RequestRefreshFrame, On ...
4 years, 8 months ago (2016-04-05 20:25:01 UTC) #9
miu
mcasas: Need OWNERS stamp for content/*/media/* (video capture stack changes. nasko: Need OWNERS stamp for ...
4 years, 8 months ago (2016-04-05 20:28:06 UTC) #11
mcasas
RS LGTM my parts with some micronits. Pity all this communications infra is not migrated ...
4 years, 8 months ago (2016-04-05 23:12:52 UTC) #12
miu
https://codereview.chromium.org/1849003002/diff/40001/content/renderer/media/media_stream_video_track.cc File content/renderer/media/media_stream_video_track.cc (right): https://codereview.chromium.org/1849003002/diff/40001/content/renderer/media/media_stream_video_track.cc#newcode246 content/renderer/media/media_stream_video_track.cc:246: // RemoveSink(). On 2016/04/05 23:12:52, mcasas wrote: > This ...
4 years, 8 months ago (2016-04-06 00:03:18 UTC) #14
miu
ncarter: Need OWNERS stamp for content/common/media/video_capture_messages.h and content/public/* changes. (Note: Removed nasko@ for this, as ...
4 years, 8 months ago (2016-04-06 00:04:12 UTC) #15
ncarter (slow)
https://codereview.chromium.org/1849003002/diff/40001/content/common/media/video_capture_messages.h File content/common/media/video_capture_messages.h (right): https://codereview.chromium.org/1849003002/diff/40001/content/common/media/video_capture_messages.h#newcode114 content/common/media/video_capture_messages.h:114: int /* device_id */); You'll need an IPC security ...
4 years, 8 months ago (2016-04-06 17:18:26 UTC) #16
ncarter (slow)
+kenrb for IPC messages.h
4 years, 8 months ago (2016-04-06 17:18:50 UTC) #18
kenrb
ipc lgtm
4 years, 8 months ago (2016-04-06 20:32:59 UTC) #19
ncarter (slow)
lgtm
4 years, 8 months ago (2016-04-06 21:06:33 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1849003002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1849003002/60001
4 years, 8 months ago (2016-04-06 21:07:44 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 8 months ago (2016-04-06 23:49:35 UTC) #25
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/d9425d67c7e7fdd53e181f566ddc78f27dc8281c Cr-Commit-Position: refs/heads/master@{#385582}
4 years, 8 months ago (2016-04-06 23:51:28 UTC) #27
miu
4 years, 8 months ago (2016-04-07 20:07:43 UTC) #28
Message was sent while issue was closed.
FYI.  Responded to nick's latest round of comments before his last lgtm, but
forgot to publish my responses.  For the record:

https://codereview.chromium.org/1849003002/diff/40001/content/common/media/vi...
File content/common/media/video_capture_messages.h (right):

https://codereview.chromium.org/1849003002/diff/40001/content/common/media/vi...
content/common/media/video_capture_messages.h:114: int /* device_id */);
On 2016/04/06 17:18:26, ncarter wrote:
> You'll need an IPC security rubber stamp for this new message. I've added
kenrb.

Acknowledged.  Thanks for adding him for me.

https://codereview.chromium.org/1849003002/diff/40001/content/public/renderer...
File content/public/renderer/media_stream_video_sink.h (right):

https://codereview.chromium.org/1849003002/diff/40001/content/public/renderer...
content/public/renderer/media_stream_video_sink.h:25: // All methods calls will
be done from the main render thread.
On 2016/04/06 17:18:26, ncarter wrote:
> Can you add a comment here saying that this class is designed to be extended
by
> content embedders?

Done.

https://codereview.chromium.org/1849003002/diff/40001/content/public/renderer...
content/public/renderer/media_stream_video_sink.h:45: void
DisconnectFromTrack();
On 2016/04/06 17:18:26, ncarter wrote:
> Though I understand what you're trying to do here, concrete methods and data
> members in a content/public class are pretty unusual. (
> https://www.chromium.org/developers/content-module/content-api )

Ah, yes.  I reviewed the sites page, and I realized I was starting to put too
much implementation in the public class here, mostly for convenience.  I've
fixed the things mentioned in your other comments.

https://codereview.chromium.org/1849003002/diff/40001/content/public/renderer...
content/public/renderer/media_stream_video_sink.h:49: bool is_connected() const
{ return !!connected_track_; }
On 2016/04/06 17:18:26, ncarter wrote:
> Could we expose this as connected_track(), returning a const
> WebMediaStreamTrack&. The caller can then look at isNull() to determine the
> connected status?

Done.

https://codereview.chromium.org/1849003002/diff/40001/content/public/renderer...
content/public/renderer/media_stream_video_sink.h:53: void
RequestRefreshFrame();
On 2016/04/06 17:18:26, ncarter wrote:
> This is an operation on the track/source, not on the sink, so I don't think it
> belongs in this class.
> 
> Our options for this would be:
>  - Add it to WebMediaStreamTrack (not sure if that makes sense or not,
> blink/content layering wise, but it feels tempting).
>  - Add a content/public interface and Impl class for MediaStreamVideoTrack
> (feels like overkill)
>  - Move this to a static method in
content/public/renderer/media_stream_utils.h
> (feels like cheating, but it matches the precedent for
> GetCurrentVideoTrackFormat())

Done.  Went with the 3rd option.

https://codereview.chromium.org/1849003002/diff/40001/content/public/renderer...
content/public/renderer/media_stream_video_sink.h:60: MediaStreamVideoTrack*
connected_track_;
On 2016/04/06 17:18:26, ncarter wrote:
> Could this be a WebMediaStreamTrack? It is preferred to avoid using
> content-private types in content/public, even as forward declarations, since
the
> #include to pick up the full declaration would actually be illegal from this
> header file.

Done.

Powered by Google App Engine
This is Rietveld 408576698