| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #include "webrtc/video/video_capture_input.h" | 10 #include "webrtc/video/video_capture_input.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class TestBuffer : public webrtc::I420Buffer { | 88 class TestBuffer : public webrtc::I420Buffer { |
| 89 public: | 89 public: |
| 90 explicit TestBuffer(rtc::Event* event) : I420Buffer(5, 5), event_(event) {} | 90 explicit TestBuffer(rtc::Event* event) : I420Buffer(5, 5), event_(event) {} |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 friend class rtc::RefCountedObject<TestBuffer>; | 93 friend class rtc::RefCountedObject<TestBuffer>; |
| 94 ~TestBuffer() override { event_->Set(); } | 94 ~TestBuffer() override { event_->Set(); } |
| 95 rtc::Event* const event_; | 95 rtc::Event* const event_; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 VideoFrame frame( | 98 { |
| 99 new rtc::RefCountedObject<TestBuffer>(&frame_destroyed_event), 1, 1, | 99 VideoFrame frame( |
| 100 kVideoRotation_0); | 100 new rtc::RefCountedObject<TestBuffer>(&frame_destroyed_event), 1, 1, |
| 101 kVideoRotation_0); |
| 101 | 102 |
| 102 AddInputFrame(&frame); | 103 AddInputFrame(&frame); |
| 103 WaitOutputFrame(); | 104 WaitOutputFrame(); |
| 104 | 105 |
| 105 EXPECT_EQ(output_frames_[0]->video_frame_buffer().get(), | 106 EXPECT_EQ(output_frames_[0]->video_frame_buffer().get(), |
| 106 frame.video_frame_buffer().get()); | 107 frame.video_frame_buffer().get()); |
| 107 output_frames_.clear(); | 108 output_frames_.clear(); |
| 108 frame.Reset(); | 109 } |
| 109 EXPECT_TRUE(frame_destroyed_event.Wait(FRAME_TIMEOUT_MS)); | 110 EXPECT_TRUE(frame_destroyed_event.Wait(FRAME_TIMEOUT_MS)); |
| 110 } | 111 } |
| 111 | 112 |
| 112 TEST_F(VideoCaptureInputTest, TestNtpTimeStampSetIfRenderTimeSet) { | 113 TEST_F(VideoCaptureInputTest, TestNtpTimeStampSetIfRenderTimeSet) { |
| 113 input_frames_.push_back(CreateVideoFrame(0)); | 114 input_frames_.push_back(CreateVideoFrame(0)); |
| 114 input_frames_[0]->set_render_time_ms(5); | 115 input_frames_[0]->set_render_time_ms(5); |
| 115 input_frames_[0]->set_ntp_time_ms(0); | 116 input_frames_[0]->set_ntp_time_ms(0); |
| 116 | 117 |
| 117 AddInputFrame(input_frames_[0].get()); | 118 AddInputFrame(input_frames_[0].get()); |
| 118 WaitOutputFrame(); | 119 WaitOutputFrame(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const int kSizeY = width * height * 2; | 271 const int kSizeY = width * height * 2; |
| 271 uint8_t buffer[kSizeY]; | 272 uint8_t buffer[kSizeY]; |
| 272 memset(buffer, data, kSizeY); | 273 memset(buffer, data, kSizeY); |
| 273 frame->CreateFrame(buffer, buffer, buffer, width, height, width, width / 2, | 274 frame->CreateFrame(buffer, buffer, buffer, width, height, width, width / 2, |
| 274 width / 2, kVideoRotation_0); | 275 width / 2, kVideoRotation_0); |
| 275 frame->set_render_time_ms(data); | 276 frame->set_render_time_ms(data); |
| 276 return frame; | 277 return frame; |
| 277 } | 278 } |
| 278 | 279 |
| 279 } // namespace webrtc | 280 } // namespace webrtc |
| OLD | NEW |