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

Side by Side Diff: content/public/renderer/media_stream_api.cc

Issue 1505013002: Create CanvasCaptureMediaStreamTrack in a regular MediaStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "content/public/renderer/media_stream_api.h" 5 #include "content/public/renderer/media_stream_api.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "content/renderer/media/media_stream_audio_source.h" 11 #include "content/renderer/media/media_stream_audio_source.h"
12 #include "content/renderer/media/media_stream_video_capturer_source.h" 12 #include "content/renderer/media/media_stream_video_capturer_source.h"
13 #include "content/renderer/media/media_stream_video_track.h" 13 #include "content/renderer/media/media_stream_video_track.h"
14 #include "content/renderer/render_thread_impl.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "third_party/WebKit/public/platform/WebMediaStream.h" 15 #include "third_party/WebKit/public/platform/WebMediaStream.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 16 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
17 #include "third_party/WebKit/public/platform/WebURL.h" 18 #include "third_party/WebKit/public/platform/WebURL.h"
18 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 19 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 namespace content { 22 namespace content {
22 23
23 namespace { 24 namespace {
24 25
25 blink::WebString MakeTrackId() { 26 blink::WebString MakeTrackId() {
26 std::string track_id; 27 std::string track_id;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 123
123 blink::WebMediaStreamTrack web_media_audio_track; 124 blink::WebMediaStreamTrack web_media_audio_track;
124 web_media_audio_track.initialize(webkit_source); 125 web_media_audio_track.initialize(webkit_source);
125 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()-> 126 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()->
126 CreateLocalAudioTrack(web_media_audio_track); 127 CreateLocalAudioTrack(web_media_audio_track);
127 128
128 web_stream->addTrack(web_media_audio_track); 129 web_stream->addTrack(web_media_audio_track);
129 return true; 130 return true;
130 } 131 }
131 132
133 bool AddVideoCapturerSourceToVideoTrack(
perkj_chrome 2015/12/08 09:05:06 This feel like a special case where we create a so
emircan 2015/12/08 19:28:01 Done.
134 scoped_ptr<media::VideoCapturerSource> source,
135 bool is_remote,
136 bool is_readonly,
137 blink::WebMediaStreamTrack* web_track) {
138 const blink::WebString track_id = MakeTrackId();
139 blink::WebMediaStreamSource webkit_source;
perkj_chrome 2015/12/08 09:05:06 please don't call anything webkit. Maybe just web_
emircan 2015/12/08 19:28:01 Done. I was following the naming used in Add*Track
140 scoped_ptr<MediaStreamVideoSource> media_stream_source(
141 new MediaStreamVideoCapturerSource(
142 MediaStreamSource::SourceStoppedCallback(), source.Pass()));
143 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo,
144 track_id, is_remote, is_readonly);
145 webkit_source.setExtraData(media_stream_source.get());
146
147 web_track->initialize(webkit_source);
148 blink::WebMediaConstraints constraints;
149 constraints.initialize();
150 web_track->setExtraData(new MediaStreamVideoTrack(
151 media_stream_source.release(), constraints,
152 MediaStreamVideoSource::ConstraintsCallback(), true));
153 return true;
154 }
155
132 } // namespace content 156 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/media_stream_api.h ('k') | content/renderer/media/canvas_capture_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698