| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 59   bool CaptureFrame() { | 59   bool CaptureFrame() { | 
| 60     if (!GetCaptureFormat()) { | 60     if (!GetCaptureFormat()) { | 
| 61       return false; | 61       return false; | 
| 62     } | 62     } | 
| 63     return CaptureCustomFrame(GetCaptureFormat()->width, | 63     return CaptureCustomFrame(GetCaptureFormat()->width, | 
| 64                               GetCaptureFormat()->height, | 64                               GetCaptureFormat()->height, | 
| 65                               GetCaptureFormat()->interval, | 65                               GetCaptureFormat()->interval, | 
| 66                               GetCaptureFormat()->fourcc); | 66                               GetCaptureFormat()->fourcc); | 
| 67   } | 67   } | 
| 68   bool CaptureCustomFrame(int width, int height, uint32_t fourcc) { | 68   bool CaptureCustomFrame(int width, int height, uint32_t fourcc) { | 
| 69     // default to 30fps | 69     // Default to 30fps. | 
| 70     return CaptureCustomFrame(width, height, 33333333, fourcc); | 70     return CaptureCustomFrame(width, height, rtc::kNumNanosecsPerSec / 30, | 
|  | 71                               fourcc); | 
| 71   } | 72   } | 
| 72   bool CaptureCustomFrame(int width, | 73   bool CaptureCustomFrame(int width, | 
| 73                           int height, | 74                           int height, | 
| 74                           int64_t timestamp_interval, | 75                           int64_t timestamp_interval, | 
| 75                           uint32_t fourcc) { | 76                           uint32_t fourcc) { | 
| 76     if (!running_) { | 77     if (!running_) { | 
| 77       return false; | 78       return false; | 
| 78     } | 79     } | 
| 79     RTC_CHECK(fourcc == FOURCC_I420); | 80     RTC_CHECK(fourcc == FOURCC_I420); | 
| 80     RTC_CHECK(width > 0); | 81     RTC_CHECK(width > 0); | 
| 81     RTC_CHECK(height > 0); | 82     RTC_CHECK(height > 0); | 
| 82 | 83 | 
| 83     int adapted_width; | 84     int adapted_width; | 
| 84     int adapted_height; | 85     int adapted_height; | 
| 85     int crop_width; | 86     int crop_width; | 
| 86     int crop_height; | 87     int crop_height; | 
| 87     int crop_x; | 88     int crop_x; | 
| 88     int crop_y; | 89     int crop_y; | 
| 89 | 90 | 
| 90     // TODO(nisse): It's a bit silly to have this logic in a fake | 91     // TODO(nisse): It's a bit silly to have this logic in a fake | 
| 91     // class. Child classes of VideoCapturer are expected to call | 92     // class. Child classes of VideoCapturer are expected to call | 
| 92     // AdaptFrame, and the test case | 93     // AdaptFrame, and the test case | 
| 93     // VideoCapturerTest.SinkWantsMaxPixelAndMaxPixelCountStepUp | 94     // VideoCapturerTest.SinkWantsMaxPixelAndMaxPixelCountStepUp | 
| 94     // depends on this. | 95     // depends on this. | 
| 95     if (AdaptFrame(width, height, 0, 0, &adapted_width, &adapted_height, | 96     if (AdaptFrame(width, height, | 
| 96                    &crop_width, &crop_height, &crop_x, &crop_y, nullptr)) { | 97                    next_timestamp_ / rtc::kNumNanosecsPerMicrosec, | 
|  | 98                    next_timestamp_ / rtc::kNumNanosecsPerMicrosec, | 
|  | 99                    &adapted_width, &adapted_height, &crop_width, &crop_height, | 
|  | 100                    &crop_x, &crop_y, nullptr)) { | 
| 97       rtc::scoped_refptr<webrtc::I420Buffer> buffer( | 101       rtc::scoped_refptr<webrtc::I420Buffer> buffer( | 
| 98           webrtc::I420Buffer::Create(adapted_width, adapted_height)); | 102           webrtc::I420Buffer::Create(adapted_width, adapted_height)); | 
| 99       buffer->InitializeData(); | 103       buffer->InitializeData(); | 
| 100 | 104 | 
| 101       OnFrame(webrtc::VideoFrame( | 105       OnFrame(webrtc::VideoFrame( | 
| 102                   buffer, rotation_, | 106                   buffer, rotation_, | 
| 103                   next_timestamp_ / rtc::kNumNanosecsPerMicrosec), | 107                   next_timestamp_ / rtc::kNumNanosecsPerMicrosec), | 
| 104               width, height); | 108               width, height); | 
| 105     } | 109     } | 
| 106     next_timestamp_ += timestamp_interval; | 110     next_timestamp_ += timestamp_interval; | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 139   bool running_; | 143   bool running_; | 
| 140   int64_t initial_timestamp_; | 144   int64_t initial_timestamp_; | 
| 141   int64_t next_timestamp_; | 145   int64_t next_timestamp_; | 
| 142   const bool is_screencast_; | 146   const bool is_screencast_; | 
| 143   webrtc::VideoRotation rotation_; | 147   webrtc::VideoRotation rotation_; | 
| 144 }; | 148 }; | 
| 145 | 149 | 
| 146 }  // namespace cricket | 150 }  // namespace cricket | 
| 147 | 151 | 
| 148 #endif  // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 152 #endif  // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 
| OLD | NEW | 
|---|