| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool GetApplyRotation() override { | 80 bool GetApplyRotation() override { |
| 81 return true; // Rotation compensation is turned on. | 81 return true; // Rotation compensation is turned on. |
| 82 } | 82 } |
| 83 VideoCaptureEncodeInterface* GetEncodeInterface( | 83 VideoCaptureEncodeInterface* GetEncodeInterface( |
| 84 const webrtc::VideoCodec& codec) override { | 84 const webrtc::VideoCodec& codec) override { |
| 85 return NULL; // not implemented | 85 return NULL; // not implemented |
| 86 } | 86 } |
| 87 | 87 |
| 88 void SendFrame(int w, int h) { | 88 void SendFrame(int w, int h) { |
| 89 if (!running_) return; | 89 if (!running_) return; |
| 90 webrtc::VideoFrame sample; | 90 |
| 91 // Setting stride based on width. | 91 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
| 92 sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2); | 92 new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); |
| 93 // Initialize memory to satisfy DrMemory tests. See |
| 94 // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 |
| 95 buffer->InitializeData(); |
| 93 if (callback_) { | 96 if (callback_) { |
| 94 callback_->OnIncomingCapturedFrame(id_, sample); | 97 callback_->OnIncomingCapturedFrame( |
| 98 id_, |
| 99 webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); |
| 95 } | 100 } |
| 96 } | 101 } |
| 97 | 102 |
| 98 const webrtc::VideoCaptureCapability& cap() const { | 103 const webrtc::VideoCaptureCapability& cap() const { |
| 99 return cap_; | 104 return cap_; |
| 100 } | 105 } |
| 101 | 106 |
| 102 private: | 107 private: |
| 103 FakeWebRtcVcmFactory* factory_; | 108 FakeWebRtcVcmFactory* factory_; |
| 104 int id_; | 109 int id_; |
| 105 webrtc::VideoCaptureDataCallback* callback_; | 110 webrtc::VideoCaptureDataCallback* callback_; |
| 106 bool running_; | 111 bool running_; |
| 107 webrtc::VideoCaptureCapability cap_; | 112 webrtc::VideoCaptureCapability cap_; |
| 108 int delay_; | 113 int delay_; |
| 109 }; | 114 }; |
| 110 | 115 |
| 111 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 116 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
| OLD | NEW |