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

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

Issue 2790823002: Spec compliant video constraints for getUserMedia behind flag. (Closed)
Patch Set: fix tests Created 3 years, 8 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
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 <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 26 matching lines...) Expand all
37 blink::WebMediaStreamSource web_media_stream_source; 37 blink::WebMediaStreamSource web_media_stream_source;
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( 43 web_media_stream_source.initialize(
44 track_id, blink::WebMediaStreamSource::TypeVideo, track_id, is_remote); 44 track_id, blink::WebMediaStreamSource::TypeVideo, track_id, is_remote);
45 // Takes ownership of |media_stream_source|. 45 // Takes ownership of |media_stream_source|.
46 web_media_stream_source.setExtraData(media_stream_source); 46 web_media_stream_source.setExtraData(media_stream_source);
47
48 blink::WebMediaConstraints constraints;
49 constraints.initialize();
50 web_media_stream->addTrack(MediaStreamVideoTrack::CreateVideoTrack( 47 web_media_stream->addTrack(MediaStreamVideoTrack::CreateVideoTrack(
51 media_stream_source, constraints, 48 media_stream_source, MediaStreamVideoSource::ConstraintsCallback(),
52 MediaStreamVideoSource::ConstraintsCallback(), true)); 49 true));
53 return true; 50 return true;
54 } 51 }
55 52
56 bool AddAudioTrackToMediaStream( 53 bool AddAudioTrackToMediaStream(
57 scoped_refptr<media::AudioCapturerSource> audio_source, 54 scoped_refptr<media::AudioCapturerSource> audio_source,
58 int sample_rate, 55 int sample_rate,
59 media::ChannelLayout channel_layout, 56 media::ChannelLayout channel_layout,
60 int frames_per_buffer, 57 int frames_per_buffer,
61 bool is_remote, 58 bool is_remote,
62 bool is_readonly, 59 bool is_readonly,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const blink::WebMediaStreamTrack& video_track) { 96 const blink::WebMediaStreamTrack& video_track) {
100 if (video_track.isNull()) 97 if (video_track.isNull())
101 return; 98 return;
102 MediaStreamVideoSource* const source = 99 MediaStreamVideoSource* const source =
103 MediaStreamVideoSource::GetVideoSource(video_track.source()); 100 MediaStreamVideoSource::GetVideoSource(video_track.source());
104 if (source) 101 if (source)
105 source->RequestRefreshFrame(); 102 source->RequestRefreshFrame();
106 } 103 }
107 104
108 } // namespace content 105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698