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 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ |
6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ | 6 #define CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "media/base/channel_layout.h" | 12 #include "media/base/channel_layout.h" |
13 #include "media/capture/video_capture_types.h" | 13 #include "media/capture/video_capture_types.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 class WebMediaStream; | 16 class WebMediaStream; |
17 class WebMediaStreamTrack; | 17 class WebMediaStreamTrack; |
18 } | 18 } |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 class AudioCapturerSource; | 21 class AudioCapturerSource; |
22 class VideoCapturerSource; | 22 class VideoCapturerSource; |
23 } | 23 } |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 // These methods create a WebMediaStreamSource + MediaStreamSource pair with the | 26 // These methods create a WebMediaStreamSource + MediaStreamSource pair with the |
27 // provided audio or video capturer source. A new WebMediaStreamTrack + | 27 // provided audio or video capturer source. A new WebMediaStreamTrack + |
28 // MediaStreamTrack pair is created, connected to the source and is plugged into | 28 // MediaStreamTrack pair is created, connected to the source and is plugged into |
29 // the WebMediaStream (|web_media_stream|). | 29 // the WebMediaStream (|web_media_stream|). |
| 30 // |is_remote| should be true if the source of the data is not a local device. |
| 31 // |is_readonly| should be true if the format of the data cannot be changed by |
| 32 // MediaTrackConstraints. |
30 CONTENT_EXPORT bool AddVideoTrackToMediaStream( | 33 CONTENT_EXPORT bool AddVideoTrackToMediaStream( |
31 std::unique_ptr<media::VideoCapturerSource> video_source, | 34 std::unique_ptr<media::VideoCapturerSource> video_source, |
| 35 bool is_remote, |
| 36 bool is_readonly, |
32 blink::WebMediaStream* web_media_stream); | 37 blink::WebMediaStream* web_media_stream); |
33 | 38 |
34 // |sample_rate|, |channel_layout|, and |frames_per_buffer| specify the audio | 39 // |sample_rate|, |channel_layout|, and |frames_per_buffer| specify the audio |
35 // parameters of the track. Generally, these should match the |audio_source| so | 40 // parameters of the track. Generally, these should match the |audio_source| so |
36 // that it does not have to perform unnecessary sample rate conversion or | 41 // that it does not have to perform unnecessary sample rate conversion or |
37 // channel mixing. | 42 // channel mixing. |
38 CONTENT_EXPORT bool AddAudioTrackToMediaStream( | 43 CONTENT_EXPORT bool AddAudioTrackToMediaStream( |
39 scoped_refptr<media::AudioCapturerSource> audio_source, | 44 scoped_refptr<media::AudioCapturerSource> audio_source, |
40 int sample_rate, | 45 int sample_rate, |
41 media::ChannelLayout channel_layout, | 46 media::ChannelLayout channel_layout, |
42 int frames_per_buffer, | 47 int frames_per_buffer, |
| 48 bool is_remote, |
| 49 bool is_readonly, |
43 blink::WebMediaStream* web_media_stream); | 50 blink::WebMediaStream* web_media_stream); |
44 | 51 |
45 // On success returns pointer to the current format of the given video track; | 52 // On success returns pointer to the current format of the given video track; |
46 // returns nullptr on failure (if the argument is invalid or if the format | 53 // returns nullptr on failure (if the argument is invalid or if the format |
47 // cannot be retrieved at the moment). | 54 // cannot be retrieved at the moment). |
48 CONTENT_EXPORT const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( | 55 CONTENT_EXPORT const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( |
49 const blink::WebMediaStreamTrack& video_track); | 56 const blink::WebMediaStreamTrack& video_track); |
50 | 57 |
51 // Requests that a refresh frame be sent "soon" (e.g., to resolve picture loss | 58 // Requests that a refresh frame be sent "soon" (e.g., to resolve picture loss |
52 // or quality issues). | 59 // or quality issues). |
53 CONTENT_EXPORT void RequestRefreshFrameFromVideoTrack( | 60 CONTENT_EXPORT void RequestRefreshFrameFromVideoTrack( |
54 const blink::WebMediaStreamTrack& video_track); | 61 const blink::WebMediaStreamTrack& video_track); |
55 | 62 |
56 } // namespace content | 63 } // namespace content |
57 | 64 |
58 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ | 65 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ |
OLD | NEW |