| OLD | NEW |
| 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 <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 blink::WebMediaStreamSource web_media_stream_source; | 36 blink::WebMediaStreamSource web_media_stream_source; |
| 37 MediaStreamVideoSource* const media_stream_source = | 37 MediaStreamVideoSource* const media_stream_source = |
| 38 new MediaStreamVideoCapturerSource( | 38 new MediaStreamVideoCapturerSource( |
| 39 MediaStreamSource::SourceStoppedCallback(), std::move(video_source)); | 39 MediaStreamSource::SourceStoppedCallback(), std::move(video_source)); |
| 40 const blink::WebString track_id = | 40 const blink::WebString track_id = |
| 41 blink::WebString::fromUTF8(base::GenerateGUID()); | 41 blink::WebString::fromUTF8(base::GenerateGUID()); |
| 42 web_media_stream_source.initialize( | 42 web_media_stream_source.initialize( |
| 43 track_id, blink::WebMediaStreamSource::TypeVideo, track_id, is_remote); | 43 track_id, blink::WebMediaStreamSource::TypeVideo, track_id, is_remote); |
| 44 // Takes ownership of |media_stream_source|. | 44 // Takes ownership of |media_stream_source|. |
| 45 web_media_stream_source.setExtraData(media_stream_source); | 45 web_media_stream_source.setExtraData(media_stream_source); |
| 46 | |
| 47 blink::WebMediaConstraints constraints; | |
| 48 constraints.initialize(); | |
| 49 web_media_stream->addTrack(MediaStreamVideoTrack::CreateVideoTrack( | 46 web_media_stream->addTrack(MediaStreamVideoTrack::CreateVideoTrack( |
| 50 media_stream_source, constraints, | 47 media_stream_source, MediaStreamVideoSource::ConstraintsCallback(), |
| 51 MediaStreamVideoSource::ConstraintsCallback(), true)); | 48 true)); |
| 52 return true; | 49 return true; |
| 53 } | 50 } |
| 54 | 51 |
| 55 bool AddAudioTrackToMediaStream( | 52 bool AddAudioTrackToMediaStream( |
| 56 scoped_refptr<media::AudioCapturerSource> audio_source, | 53 scoped_refptr<media::AudioCapturerSource> audio_source, |
| 57 int sample_rate, | 54 int sample_rate, |
| 58 media::ChannelLayout channel_layout, | 55 media::ChannelLayout channel_layout, |
| 59 int frames_per_buffer, | 56 int frames_per_buffer, |
| 60 bool is_remote, | 57 bool is_remote, |
| 61 blink::WebMediaStream* web_media_stream) { | 58 blink::WebMediaStream* web_media_stream) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const blink::WebMediaStreamTrack& video_track) { | 107 const blink::WebMediaStreamTrack& video_track) { |
| 111 if (video_track.isNull()) | 108 if (video_track.isNull()) |
| 112 return; | 109 return; |
| 113 MediaStreamVideoSource* const source = | 110 MediaStreamVideoSource* const source = |
| 114 MediaStreamVideoSource::GetVideoSource(video_track.source()); | 111 MediaStreamVideoSource::GetVideoSource(video_track.source()); |
| 115 if (source) | 112 if (source) |
| 116 source->RequestRefreshFrame(); | 113 source->RequestRefreshFrame(); |
| 117 } | 114 } |
| 118 | 115 |
| 119 } // namespace content | 116 } // namespace content |
| OLD | NEW |