diff options
author | mikhail.pozdnyakov <mikhail.pozdnyakov@intel.com> | 2016-03-14 07:29:34 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-14 14:31:02 +0000 |
commit | d17b1c983f3eb6feb99dab564b21cecc6e699f80 (patch) | |
tree | 688ce3ca33e79f9205e389cad4ec135135ccb694 /content/public/renderer | |
parent | 3e7a9545bff26c2aa07ccf651f7dd9f353c9bdc9 (diff) | |
download | chromium_src-d17b1c983f3eb6feb99dab564b21cecc6e699f80.zip chromium_src-d17b1c983f3eb6feb99dab564b21cecc6e699f80.tar.gz chromium_src-d17b1c983f3eb6feb99dab564b21cecc6e699f80.tar.bz2 |
MediaStreamVideoSource exports current video format
This patch adds a getter to the MediaStreamVideoSource class which
returns the current video format.
The video format details are necessary during establishing of WiFi
Display session (for the capabilities negotiation with the sink).
BUG=242107
Review URL: https://codereview.chromium.org/1672713002
Cr-Commit-Position: refs/heads/master@{#380969}
Diffstat (limited to 'content/public/renderer')
-rw-r--r-- | content/public/renderer/media_stream_api.cc | 14 | ||||
-rw-r--r-- | content/public/renderer/media_stream_api.h | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/content/public/renderer/media_stream_api.cc b/content/public/renderer/media_stream_api.cc index 5baaa54..a1cc697 100644 --- a/content/public/renderer/media_stream_api.cc +++ b/content/public/renderer/media_stream_api.cc @@ -13,6 +13,7 @@ #include "base/strings/utf_string_conversions.h" #include "content/renderer/media/media_stream_audio_source.h" #include "content/renderer/media/media_stream_video_capturer_source.h" +#include "content/renderer/media/media_stream_video_source.h" #include "content/renderer/media/media_stream_video_track.h" #include "content/renderer/render_thread_impl.h" #include "third_party/WebKit/public/platform/WebMediaStream.h" @@ -112,4 +113,17 @@ bool AddAudioTrackToMediaStream( return true; } +const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( + const blink::WebMediaStreamTrack& video_track) { + if (video_track.isNull()) + return nullptr; + + content::MediaStreamVideoSource* source = + content::MediaStreamVideoSource::GetVideoSource(video_track.source()); + if (!source) + return nullptr; + + return source->GetCurrentFormat(); +} + } // namespace content diff --git a/content/public/renderer/media_stream_api.h b/content/public/renderer/media_stream_api.h index b87c93d..907415c 100644 --- a/content/public/renderer/media_stream_api.h +++ b/content/public/renderer/media_stream_api.h @@ -8,10 +8,12 @@ #include "content/common/content_export.h" #include "media/base/audio_capturer_source.h" #include "media/base/channel_layout.h" +#include "media/base/video_capture_types.h" #include "media/base/video_capturer_source.h" namespace blink { class WebMediaStream; +class WebMediaStreamTrack; } namespace content { @@ -41,6 +43,12 @@ CONTENT_EXPORT bool AddAudioTrackToMediaStream( bool is_readonly, blink::WebMediaStream* web_media_stream); +// On success returns pointer to the current format of the given video track; +// returns nullptr on failure (if the argument is invalid or if the format +// cannot be retrieved at the moment). +CONTENT_EXPORT const media::VideoCaptureFormat* GetCurrentVideoTrackFormat( + const blink::WebMediaStreamTrack& video_track); + } // namespace content #endif // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_API_H_ |