diff options
author | perkj@chromium.org <perkj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 12:10:45 +0000 |
---|---|---|
committer | perkj@chromium.org <perkj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 12:10:45 +0000 |
commit | f83821b30d54ac9566e4178b4efe62582ff1702e (patch) | |
tree | 9bf62fd2af0859b436a8a862fa9e538468f36144 /content/renderer/media/media_stream_video_source.cc | |
parent | ee46bbacd745d533fbd027a721e146e6ee357890 (diff) | |
download | chromium_src-f83821b30d54ac9566e4178b4efe62582ff1702e.zip chromium_src-f83821b30d54ac9566e4178b4efe62582ff1702e.tar.gz chromium_src-f83821b30d54ac9566e4178b4efe62582ff1702e.tar.bz2 |
Refactor VideoDestinationHandler to implement MediaStreamVideoSource.
VideoDestinationHandler is moved to media/webrtc since it needs to use libyuv. It also make sence since its a private API only used for WebRtc.
This cl also remove the WebRtcVideoCaptureAdapter::SetCurrrentFormat and make sure video resolution constraints are not passed to libJingle. Libjingle do not need to know the capture resolution or the used resolution constraints and that is infact how
VideoDestionationHandler can work today.
This is needed to simplify the adapter and the use of MediaStreamVideoSource since its currently not possible to call WebRtcVideoCaptureAdapter::SetCurrrentFormat before the MediaStreamVideoSource::OnSupportedFormat has been called.
BUG=334243
// TBR Jam for gyp changes, yzshen for the header file path change in Pepper.
R=joi@chromium.org, ronghuawu@chromium.org
TBR=jam, yzshen1
Review URL: https://codereview.chromium.org/212973002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media/media_stream_video_source.cc')
-rw-r--r-- | content/renderer/media/media_stream_video_source.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc index 243d361..6091726 100644 --- a/content/renderer/media/media_stream_video_source.cc +++ b/content/renderer/media/media_stream_video_source.cc @@ -26,6 +26,17 @@ const char MediaStreamVideoSource::kMinHeight[] = "minHeight"; const char MediaStreamVideoSource::kMaxFrameRate[] = "maxFrameRate"; const char MediaStreamVideoSource::kMinFrameRate[] = "minFrameRate"; +const char* kSupportedConstraints[] = { + MediaStreamVideoSource::kMaxAspectRatio, + MediaStreamVideoSource::kMinAspectRatio, + MediaStreamVideoSource::kMaxWidth, + MediaStreamVideoSource::kMinWidth, + MediaStreamVideoSource::kMaxHeight, + MediaStreamVideoSource::kMinHeight, + MediaStreamVideoSource::kMaxFrameRate, + MediaStreamVideoSource::kMinFrameRate, +}; + const int MediaStreamVideoSource::kDefaultWidth = 640; const int MediaStreamVideoSource::kDefaultHeight = 480; const int MediaStreamVideoSource::kDefaultFrameRate = 30; @@ -283,6 +294,15 @@ MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource( return static_cast<MediaStreamVideoSource*>(source.extraData()); } +//static +bool MediaStreamVideoSource::IsConstraintSupported(const std::string& name) { + for (size_t i = 0; i < arraysize(kSupportedConstraints); ++i) { + if (kSupportedConstraints[i] == name) + return true; + } + return false; +} + MediaStreamVideoSource::MediaStreamVideoSource( MediaStreamDependencyFactory* factory) : state_(NEW), @@ -354,7 +374,6 @@ void MediaStreamVideoSource::InitAdapter() { device_info().device.type == MEDIA_TAB_VIDEO_CAPTURE || device_info().device.type == MEDIA_DESKTOP_VIDEO_CAPTURE; capture_adapter_ = factory_->CreateVideoCapturer(is_screencast); - capture_adapter_->SetRequestedFormat(current_format_); adapter_ = factory_->CreateVideoSource(capture_adapter_, current_constraints_); } |