| 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. | |
| 33 CONTENT_EXPORT bool AddVideoTrackToMediaStream( | 30 CONTENT_EXPORT bool AddVideoTrackToMediaStream( |
| 34 std::unique_ptr<media::VideoCapturerSource> video_source, | 31 std::unique_ptr<media::VideoCapturerSource> video_source, |
| 35 bool is_remote, | |
| 36 bool is_readonly, | |
| 37 blink::WebMediaStream* web_media_stream); | 32 blink::WebMediaStream* web_media_stream); |
| 38 | 33 |
| 39 // |sample_rate|, |channel_layout|, and |frames_per_buffer| specify the audio | 34 // |sample_rate|, |channel_layout|, and |frames_per_buffer| specify the audio |
| 40 // parameters of the track. Generally, these should match the |audio_source| so | 35 // parameters of the track. Generally, these should match the |audio_source| so |
| 41 // that it does not have to perform unnecessary sample rate conversion or | 36 // that it does not have to perform unnecessary sample rate conversion or |
| 42 // channel mixing. | 37 // channel mixing. |
| 43 CONTENT_EXPORT bool AddAudioTrackToMediaStream( | 38 CONTENT_EXPORT bool AddAudioTrackToMediaStream( |
| 44 scoped_refptr<media::AudioCapturerSource> audio_source, | 39 scoped_refptr<media::AudioCapturerSource> audio_source, |
| 45 int sample_rate, | 40 int sample_rate, |
| 46 media::ChannelLayout channel_layout, | 41 media::ChannelLayout channel_layout, |
| 47 int frames_per_buffer, | 42 int frames_per_buffer, |
| 48 bool is_remote, | |
| 49 bool is_readonly, | |
| 50 blink::WebMediaStream* web_media_stream); | 43 blink::WebMediaStream* web_media_stream); |
| 51 | 44 |
| 52 // On success returns pointer to the current format of the given video track; | 45 // On success returns pointer to the current format of the given video track; |
| 53 // returns nullptr on failure (if the argument is invalid or if the format | 46 // returns nullptr on failure (if the argument is invalid or if the format |
| 54 // cannot be retrieved at the moment). | 47 // cannot be retrieved at the moment). |
| 55 CONTENT_EXPORT const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( | 48 CONTENT_EXPORT const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( |
| 56 const blink::WebMediaStreamTrack& video_track); | 49 const blink::WebMediaStreamTrack& video_track); |
| 57 | 50 |
| 58 // Requests that a refresh frame be sent "soon" (e.g., to resolve picture loss | 51 // Requests that a refresh frame be sent "soon" (e.g., to resolve picture loss |
| 59 // or quality issues). | 52 // or quality issues). |
| 60 CONTENT_EXPORT void RequestRefreshFrameFromVideoTrack( | 53 CONTENT_EXPORT void RequestRefreshFrameFromVideoTrack( |
| 61 const blink::WebMediaStreamTrack& video_track); | 54 const blink::WebMediaStreamTrack& video_track); |
| 62 | 55 |
| 63 } // namespace content | 56 } // namespace content |
| 64 | 57 |
| 65 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ | 58 #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_ |
| OLD | NEW |