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