OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 14 matching lines...) Expand all Loading... |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "talk/app/webrtc/videosource.h" | 28 #include "talk/app/webrtc/videosource.h" |
29 | 29 |
30 #include <vector> | 30 #include <vector> |
31 #include <cstdlib> | 31 #include <cstdlib> |
32 | 32 |
33 #include "talk/app/webrtc/mediaconstraintsinterface.h" | 33 #include "talk/app/webrtc/mediaconstraintsinterface.h" |
34 #include "talk/session/media/channelmanager.h" | 34 #include "talk/session/media/channelmanager.h" |
| 35 #include "webrtc/base/arraysize.h" |
35 | 36 |
36 using cricket::CaptureState; | 37 using cricket::CaptureState; |
37 using webrtc::MediaConstraintsInterface; | 38 using webrtc::MediaConstraintsInterface; |
38 using webrtc::MediaSourceInterface; | 39 using webrtc::MediaSourceInterface; |
39 | 40 |
40 namespace { | 41 namespace { |
41 | 42 |
42 const double kRoundingTruncation = 0.0005; | 43 const double kRoundingTruncation = 0.0005; |
43 | 44 |
44 enum { | 45 enum { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (formats.empty()) { | 363 if (formats.empty()) { |
363 if (video_capturer_->IsScreencast()) { | 364 if (video_capturer_->IsScreencast()) { |
364 // The screen capturer can accept any resolution and we will derive the | 365 // The screen capturer can accept any resolution and we will derive the |
365 // format from the constraints if any. | 366 // format from the constraints if any. |
366 // Note that this only affects tab capturing, not desktop capturing, | 367 // Note that this only affects tab capturing, not desktop capturing, |
367 // since the desktop capturer does not respect the VideoFormat passed in. | 368 // since the desktop capturer does not respect the VideoFormat passed in. |
368 formats.push_back(cricket::VideoFormat(kDefaultFormat)); | 369 formats.push_back(cricket::VideoFormat(kDefaultFormat)); |
369 } else { | 370 } else { |
370 // The VideoCapturer implementation doesn't support capability | 371 // The VideoCapturer implementation doesn't support capability |
371 // enumeration. We need to guess what the camera supports. | 372 // enumeration. We need to guess what the camera supports. |
372 for (int i = 0; i < ARRAY_SIZE(kVideoFormats); ++i) { | 373 for (int i = 0; i < arraysize(kVideoFormats); ++i) { |
373 formats.push_back(cricket::VideoFormat(kVideoFormats[i])); | 374 formats.push_back(cricket::VideoFormat(kVideoFormats[i])); |
374 } | 375 } |
375 } | 376 } |
376 } | 377 } |
377 | 378 |
378 if (constraints) { | 379 if (constraints) { |
379 MediaConstraintsInterface::Constraints mandatory_constraints = | 380 MediaConstraintsInterface::Constraints mandatory_constraints = |
380 constraints->GetMandatory(); | 381 constraints->GetMandatory(); |
381 MediaConstraintsInterface::Constraints optional_constraints; | 382 MediaConstraintsInterface::Constraints optional_constraints; |
382 optional_constraints = constraints->GetOptional(); | 383 optional_constraints = constraints->GetOptional(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 462 } |
462 | 463 |
463 void VideoSource::SetState(SourceState new_state) { | 464 void VideoSource::SetState(SourceState new_state) { |
464 if (VERIFY(state_ != new_state)) { | 465 if (VERIFY(state_ != new_state)) { |
465 state_ = new_state; | 466 state_ = new_state; |
466 FireOnChanged(); | 467 FireOnChanged(); |
467 } | 468 } |
468 } | 469 } |
469 | 470 |
470 } // namespace webrtc | 471 } // namespace webrtc |
OLD | NEW |