Chromium Code Reviews

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

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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_utils.h" 5 #include "content/public/renderer/media_stream_utils.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/callback.h" 10 #include "base/callback.h"
10 #include "base/guid.h" 11 #include "base/guid.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "content/renderer/media/media_stream_audio_source.h" 14 #include "content/renderer/media/media_stream_audio_source.h"
15 #include "content/renderer/media/media_stream_video_capturer_source.h" 15 #include "content/renderer/media/media_stream_video_capturer_source.h"
16 #include "content/renderer/media/media_stream_video_source.h" 16 #include "content/renderer/media/media_stream_video_source.h"
17 #include "content/renderer/media/media_stream_video_track.h" 17 #include "content/renderer/media/media_stream_video_track.h"
18 #include "content/renderer/render_thread_impl.h" 18 #include "content/renderer/render_thread_impl.h"
19 #include "media/base/audio_capturer_source.h" 19 #include "media/base/audio_capturer_source.h"
20 #include "media/base/video_capturer_source.h" 20 #include "media/base/video_capturer_source.h"
21 #include "third_party/WebKit/public/platform/WebMediaStream.h" 21 #include "third_party/WebKit/public/platform/WebMediaStream.h"
22 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 22 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
23 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" 23 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
24 24
25 namespace content { 25 namespace content {
26 26
27 bool AddVideoTrackToMediaStream( 27 bool AddVideoTrackToMediaStream(
28 scoped_ptr<media::VideoCapturerSource> video_source, 28 std::unique_ptr<media::VideoCapturerSource> video_source,
29 bool is_remote, 29 bool is_remote,
30 bool is_readonly, 30 bool is_readonly,
31 blink::WebMediaStream* web_media_stream) { 31 blink::WebMediaStream* web_media_stream) {
32 DCHECK(video_source.get()); 32 DCHECK(video_source.get());
33 if (!web_media_stream || web_media_stream->isNull()) { 33 if (!web_media_stream || web_media_stream->isNull()) {
34 DLOG(ERROR) << "WebMediaStream is null"; 34 DLOG(ERROR) << "WebMediaStream is null";
35 return false; 35 return false;
36 } 36 }
37 37
38 blink::WebMediaStreamSource web_media_stream_source; 38 blink::WebMediaStreamSource web_media_stream_source;
(...skipping 48 matching lines...)
87 MediaStreamAudioSource* media_stream_source(new MediaStreamAudioSource( 87 MediaStreamAudioSource* media_stream_source(new MediaStreamAudioSource(
88 -1, StreamDeviceInfo(), MediaStreamSource::SourceStoppedCallback(), 88 -1, StreamDeviceInfo(), MediaStreamSource::SourceStoppedCallback(),
89 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory())); 89 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory()));
90 90
91 blink::WebMediaConstraints constraints; 91 blink::WebMediaConstraints constraints;
92 constraints.initialize(); 92 constraints.initialize();
93 { 93 {
94 // TODO(miu): In an upcoming change, a source purposed for passing audio 94 // TODO(miu): In an upcoming change, a source purposed for passing audio
95 // directly (i.e., without modification) will replace this "hacky" use of 95 // directly (i.e., without modification) will replace this "hacky" use of
96 // WebRtcAudioCapturer. http://crbug.com/577881 96 // WebRtcAudioCapturer. http://crbug.com/577881
97 scoped_ptr<WebRtcAudioCapturer> capturer( 97 std::unique_ptr<WebRtcAudioCapturer> capturer(
98 WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), constraints, 98 WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), constraints,
99 nullptr, media_stream_source)); 99 nullptr, media_stream_source));
100 capturer->SetCapturerSource(std::move(audio_source), params); 100 capturer->SetCapturerSource(std::move(audio_source), params);
101 media_stream_source->SetAudioCapturer(std::move(capturer)); 101 media_stream_source->SetAudioCapturer(std::move(capturer));
102 } 102 }
103 web_media_stream_source.setExtraData( 103 web_media_stream_source.setExtraData(
104 media_stream_source); // Takes ownership. 104 media_stream_source); // Takes ownership.
105 105
106 blink::WebMediaStreamTrack web_media_stream_track; 106 blink::WebMediaStreamTrack web_media_stream_track;
107 web_media_stream_track.initialize(web_media_stream_source); 107 web_media_stream_track.initialize(web_media_stream_source);
(...skipping 22 matching lines...)
130 const blink::WebMediaStreamTrack& video_track) { 130 const blink::WebMediaStreamTrack& video_track) {
131 if (video_track.isNull()) 131 if (video_track.isNull())
132 return; 132 return;
133 MediaStreamVideoSource* const source = 133 MediaStreamVideoSource* const source =
134 MediaStreamVideoSource::GetVideoSource(video_track.source()); 134 MediaStreamVideoSource::GetVideoSource(video_track.source());
135 if (source) 135 if (source)
136 source->RequestRefreshFrame(); 136 source->RequestRefreshFrame();
137 } 137 }
138 138
139 } // namespace content 139 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/media_stream_utils.h ('k') | content/public/renderer/plugin_instance_throttler.h » ('j') | no next file with comments »

Powered by Google App Engine