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

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

Issue 1544293002: Convert Pass()→std::move() in //content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « content/public/common/service_registry.h ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility>
8
7 #include "base/base64.h" 9 #include "base/base64.h"
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/rand_util.h" 11 #include "base/rand_util.h"
10 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
11 #include "content/renderer/media/media_stream_audio_source.h" 13 #include "content/renderer/media/media_stream_audio_source.h"
12 #include "content/renderer/media/media_stream_video_capturer_source.h" 14 #include "content/renderer/media/media_stream_video_capturer_source.h"
13 #include "content/renderer/media/media_stream_video_track.h" 15 #include "content/renderer/media/media_stream_video_track.h"
14 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
15 #include "third_party/WebKit/public/platform/WebMediaStream.h" 17 #include "third_party/WebKit/public/platform/WebMediaStream.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 18 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
(...skipping 13 matching lines...) Expand all
30 32
31 } // namespace 33 } // namespace
32 34
33 bool AddVideoTrackToMediaStream(scoped_ptr<media::VideoCapturerSource> source, 35 bool AddVideoTrackToMediaStream(scoped_ptr<media::VideoCapturerSource> source,
34 bool is_remote, 36 bool is_remote,
35 bool is_readonly, 37 bool is_readonly,
36 const std::string& media_stream_url) { 38 const std::string& media_stream_url) {
37 blink::WebMediaStream web_stream = 39 blink::WebMediaStream web_stream =
38 blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor( 40 blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(
39 GURL(media_stream_url)); 41 GURL(media_stream_url));
40 return AddVideoTrackToMediaStream(source.Pass(), is_remote, is_readonly, 42 return AddVideoTrackToMediaStream(std::move(source), is_remote, is_readonly,
41 &web_stream); 43 &web_stream);
42 } 44 }
43 45
44 bool AddVideoTrackToMediaStream(scoped_ptr<media::VideoCapturerSource> source, 46 bool AddVideoTrackToMediaStream(scoped_ptr<media::VideoCapturerSource> source,
45 bool is_remote, 47 bool is_remote,
46 bool is_readonly, 48 bool is_readonly,
47 blink::WebMediaStream* web_stream) { 49 blink::WebMediaStream* web_stream) {
48 if (web_stream->isNull()) { 50 if (web_stream->isNull()) {
49 DLOG(ERROR) << "Stream not found"; 51 DLOG(ERROR) << "Stream not found";
50 return false; 52 return false;
51 } 53 }
52 const blink::WebString track_id = MakeTrackId(); 54 const blink::WebString track_id = MakeTrackId();
53 blink::WebMediaStreamSource webkit_source; 55 blink::WebMediaStreamSource webkit_source;
54 scoped_ptr<MediaStreamVideoSource> media_stream_source( 56 scoped_ptr<MediaStreamVideoSource> media_stream_source(
55 new MediaStreamVideoCapturerSource( 57 new MediaStreamVideoCapturerSource(
56 MediaStreamSource::SourceStoppedCallback(), source.Pass())); 58 MediaStreamSource::SourceStoppedCallback(), std::move(source)));
57 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo, 59 webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo,
58 track_id, is_remote, is_readonly); 60 track_id, is_remote, is_readonly);
59 webkit_source.setExtraData(media_stream_source.get()); 61 webkit_source.setExtraData(media_stream_source.get());
60 62
61 blink::WebMediaConstraints constraints; 63 blink::WebMediaConstraints constraints;
62 constraints.initialize(); 64 constraints.initialize();
63 web_stream->addTrack(MediaStreamVideoTrack::CreateVideoTrack( 65 web_stream->addTrack(MediaStreamVideoTrack::CreateVideoTrack(
64 media_stream_source.release(), constraints, 66 media_stream_source.release(), constraints,
65 MediaStreamVideoSource::ConstraintsCallback(), true)); 67 MediaStreamVideoSource::ConstraintsCallback(), true));
66 return true; 68 return true;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 blink::WebMediaStreamTrack web_media_audio_track; 125 blink::WebMediaStreamTrack web_media_audio_track;
124 web_media_audio_track.initialize(webkit_source); 126 web_media_audio_track.initialize(webkit_source);
125 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()-> 127 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()->
126 CreateLocalAudioTrack(web_media_audio_track); 128 CreateLocalAudioTrack(web_media_audio_track);
127 129
128 web_stream->addTrack(web_media_audio_track); 130 web_stream->addTrack(web_media_audio_track);
129 return true; 131 return true;
130 } 132 }
131 133
132 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/service_registry.h ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698