| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 int32_t AddRef() const override { return 0; } | 87 int32_t AddRef() const override { return 0; } |
| 88 int32_t Release() const override { | 88 int32_t Release() const override { |
| 89 delete this; | 89 delete this; |
| 90 return 0; | 90 return 0; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void SendFrame(int w, int h) { | 93 bool SendFrame(int w, int h) { |
| 94 if (!running_) return; | 94 if (!running_) return false; |
| 95 webrtc::VideoFrame sample; | 95 webrtc::VideoFrame sample; |
| 96 // Setting stride based on width. | 96 // Setting stride based on width. |
| 97 sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2); | 97 if (sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2) < 0) { |
| 98 return false; |
| 99 } |
| 98 if (callback_) { | 100 if (callback_) { |
| 99 callback_->OnIncomingCapturedFrame(id_, sample); | 101 callback_->OnIncomingCapturedFrame(id_, sample); |
| 100 } | 102 } |
| 103 return true; |
| 101 } | 104 } |
| 102 | 105 |
| 103 const webrtc::VideoCaptureCapability& cap() const { | 106 const webrtc::VideoCaptureCapability& cap() const { |
| 104 return cap_; | 107 return cap_; |
| 105 } | 108 } |
| 106 | 109 |
| 107 private: | 110 private: |
| 108 // Ref-counted, use Release() instead. | 111 // Ref-counted, use Release() instead. |
| 109 ~FakeWebRtcVideoCaptureModule(); | 112 ~FakeWebRtcVideoCaptureModule(); |
| 110 | 113 |
| 111 FakeWebRtcVcmFactory* factory_; | 114 FakeWebRtcVcmFactory* factory_; |
| 112 int id_; | 115 int id_; |
| 113 webrtc::VideoCaptureDataCallback* callback_; | 116 webrtc::VideoCaptureDataCallback* callback_; |
| 114 bool running_; | 117 bool running_; |
| 115 webrtc::VideoCaptureCapability cap_; | 118 webrtc::VideoCaptureCapability cap_; |
| 116 int delay_; | 119 int delay_; |
| 117 }; | 120 }; |
| 118 | 121 |
| 119 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 122 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
| OLD | NEW |