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

Side by Side Diff: content/renderer/media/media_stream_video_track.cc

Issue 2742893003: Let getSettings() return the constrained track resolution, not source. (Closed)
Patch Set: Added bug # for non-working test Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/media/media_stream_video_track.h" 5 #include "content/renderer/media/media_stream_video_track.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 295 DCHECK(main_render_thread_checker_.CalledOnValidThread());
296 if (source_) { 296 if (source_) {
297 source_->RemoveTrack(this); 297 source_->RemoveTrack(this);
298 source_ = NULL; 298 source_ = NULL;
299 } 299 }
300 OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded); 300 OnReadyStateChanged(blink::WebMediaStreamSource::ReadyStateEnded);
301 } 301 }
302 302
303 void MediaStreamVideoTrack::getSettings( 303 void MediaStreamVideoTrack::getSettings(
304 blink::WebMediaStreamTrack::Settings& settings) { 304 blink::WebMediaStreamTrack::Settings& settings) {
305 // TODO(hta): Extract the real value.
306 settings.deviceId = blink::WebString("video device ID");
307 if (!source_)
308 return;
309
310 const media::VideoCaptureFormat* format = source_->GetCurrentFormat(); 305 const media::VideoCaptureFormat* format = source_->GetCurrentFormat();
311 if (format) { 306 if (format) {
312 settings.frameRate = format->frame_rate; 307 settings.frameRate = format->frame_rate;
313 settings.width = format->frame_size.width();
314 settings.height = format->frame_size.height();
315 settings.videoKind = GetVideoKindForFormat(*format); 308 settings.videoKind = GetVideoKindForFormat(*format);
316 } 309 }
310 if (width_ && height_) {
311 settings.width = width_;
312 settings.height = height_;
313 }
317 switch (source_->device_info().device.video_facing) { 314 switch (source_->device_info().device.video_facing) {
318 case media::MEDIA_VIDEO_FACING_NONE: 315 case media::MEDIA_VIDEO_FACING_NONE:
319 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None; 316 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::None;
320 break; 317 break;
321 case media::MEDIA_VIDEO_FACING_USER: 318 case media::MEDIA_VIDEO_FACING_USER:
322 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User; 319 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::User;
323 break; 320 break;
324 case media::MEDIA_VIDEO_FACING_ENVIRONMENT: 321 case media::MEDIA_VIDEO_FACING_ENVIRONMENT:
325 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment; 322 settings.facingMode = blink::WebMediaStreamTrack::FacingMode::Environment;
326 break; 323 break;
(...skipping 12 matching lines...) Expand all
339 } 336 }
340 337
341 void MediaStreamVideoTrack::OnReadyStateChanged( 338 void MediaStreamVideoTrack::OnReadyStateChanged(
342 blink::WebMediaStreamSource::ReadyState state) { 339 blink::WebMediaStreamSource::ReadyState state) {
343 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 340 DCHECK(main_render_thread_checker_.CalledOnValidThread());
344 for (auto* sink : sinks_) 341 for (auto* sink : sinks_)
345 sink->OnReadyStateChanged(state); 342 sink->OnReadyStateChanged(state);
346 } 343 }
347 344
348 } // namespace content 345 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_track.h ('k') | content/renderer/media/video_track_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698