| 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 |
| 11 #ifndef WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ |
| 12 #define WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 12 #define WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ |
| 13 | 13 |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 | 15 |
| 16 #include <memory> |
| 16 #include <vector> | 17 #include <vector> |
| 17 | 18 |
| 18 #include "webrtc/base/timeutils.h" | 19 #include "webrtc/base/timeutils.h" |
| 19 #include "webrtc/media/base/videocapturer.h" | 20 #include "webrtc/media/base/videocapturer.h" |
| 20 #include "webrtc/media/base/videocommon.h" | 21 #include "webrtc/media/base/videocommon.h" |
| 21 #include "webrtc/media/base/videoframe.h" | 22 #include "webrtc/media/base/videoframe.h" |
| 22 #ifdef HAVE_WEBRTC_VIDEO | 23 #ifdef HAVE_WEBRTC_VIDEO |
| 23 #include "webrtc/media/engine/webrtcvideoframefactory.h" | 24 #include "webrtc/media/engine/webrtcvideoframefactory.h" |
| 24 #endif | 25 #endif |
| 25 | 26 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 93 } |
| 93 | 94 |
| 94 cricket::CapturedFrame frame; | 95 cricket::CapturedFrame frame; |
| 95 frame.width = width; | 96 frame.width = width; |
| 96 frame.height = height; | 97 frame.height = height; |
| 97 frame.fourcc = fourcc; | 98 frame.fourcc = fourcc; |
| 98 frame.data_size = size; | 99 frame.data_size = size; |
| 99 frame.time_stamp = initial_unix_timestamp_ + next_timestamp_; | 100 frame.time_stamp = initial_unix_timestamp_ + next_timestamp_; |
| 100 next_timestamp_ += timestamp_interval; | 101 next_timestamp_ += timestamp_interval; |
| 101 | 102 |
| 102 rtc::scoped_ptr<char[]> data(new char[size]); | 103 std::unique_ptr<char[]> data(new char[size]); |
| 103 frame.data = data.get(); | 104 frame.data = data.get(); |
| 104 // Copy something non-zero into the buffer so Validate wont complain that | 105 // Copy something non-zero into the buffer so Validate wont complain that |
| 105 // the frame is all duplicate. | 106 // the frame is all duplicate. |
| 106 memset(frame.data, 1, size / 2); | 107 memset(frame.data, 1, size / 2); |
| 107 memset(reinterpret_cast<uint8_t*>(frame.data) + (size / 2), 2, | 108 memset(reinterpret_cast<uint8_t*>(frame.data) + (size / 2), 2, |
| 108 size - (size / 2)); | 109 size - (size / 2)); |
| 109 memcpy(frame.data, reinterpret_cast<const uint8_t*>(&fourcc), 4); | 110 memcpy(frame.data, reinterpret_cast<const uint8_t*>(&fourcc), 4); |
| 110 frame.rotation = rotation_; | 111 frame.rotation = rotation_; |
| 111 // TODO(zhurunz): SignalFrameCaptured carry returned value to be able to | 112 // TODO(zhurunz): SignalFrameCaptured carry returned value to be able to |
| 112 // capture results from downstream. | 113 // capture results from downstream. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 bool running_; | 156 bool running_; |
| 156 int64_t initial_unix_timestamp_; | 157 int64_t initial_unix_timestamp_; |
| 157 int64_t next_timestamp_; | 158 int64_t next_timestamp_; |
| 158 bool is_screencast_; | 159 bool is_screencast_; |
| 159 webrtc::VideoRotation rotation_; | 160 webrtc::VideoRotation rotation_; |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // namespace cricket | 163 } // namespace cricket |
| 163 | 164 |
| 164 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 165 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ |
| OLD | NEW |