OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 captured_frame_.pixel_width = 1; | 45 captured_frame_.pixel_width = 1; |
46 captured_frame_.pixel_height = 1; | 46 captured_frame_.pixel_height = 1; |
47 captured_frame_.elapsed_time = 1234; | 47 captured_frame_.elapsed_time = 1234; |
48 captured_frame_.time_stamp = 5678; | 48 captured_frame_.time_stamp = 5678; |
49 captured_frame_.rotation = frame_rotation; | 49 captured_frame_.rotation = frame_rotation; |
50 captured_frame_.width = frame_width; | 50 captured_frame_.width = frame_width; |
51 captured_frame_.height = frame_height; | 51 captured_frame_.height = frame_height; |
52 captured_frame_.data_size = | 52 captured_frame_.data_size = |
53 (frame_width * frame_height) + | 53 (frame_width * frame_height) + |
54 ((frame_width + 1) / 2) * ((frame_height + 1) / 2) * 2; | 54 ((frame_width + 1) / 2) * ((frame_height + 1) / 2) * 2; |
55 captured_frame_buffer_.reset(new uint8[captured_frame_.data_size]); | 55 captured_frame_buffer_.reset(new uint8_t[captured_frame_.data_size]); |
56 // Initialize memory to satisfy DrMemory tests. | 56 // Initialize memory to satisfy DrMemory tests. |
57 memset(captured_frame_buffer_.get(), 0, captured_frame_.data_size); | 57 memset(captured_frame_buffer_.get(), 0, captured_frame_.data_size); |
58 captured_frame_.data = captured_frame_buffer_.get(); | 58 captured_frame_.data = captured_frame_buffer_.get(); |
59 } | 59 } |
60 | 60 |
61 void VerifyFrame(cricket::VideoFrame* dest_frame, | 61 void VerifyFrame(cricket::VideoFrame* dest_frame, |
62 webrtc::VideoRotation src_rotation, | 62 webrtc::VideoRotation src_rotation, |
63 int src_width, | 63 int src_width, |
64 int src_height, | 64 int src_height, |
65 bool apply_rotation) { | 65 bool apply_rotation) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 frame.reset(factory.CreateAliasedFrame( | 105 frame.reset(factory.CreateAliasedFrame( |
106 &captured_frame, new_width, new_height, new_width / 2, new_height / 2)); | 106 &captured_frame, new_width, new_height, new_width / 2, new_height / 2)); |
107 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2, | 107 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2, |
108 new_height / 2, apply_rotation); | 108 new_height / 2, apply_rotation); |
109 } | 109 } |
110 | 110 |
111 const cricket::CapturedFrame& get_captured_frame() { return captured_frame_; } | 111 const cricket::CapturedFrame& get_captured_frame() { return captured_frame_; } |
112 | 112 |
113 private: | 113 private: |
114 cricket::CapturedFrame captured_frame_; | 114 cricket::CapturedFrame captured_frame_; |
115 rtc::scoped_ptr<uint8[]> captured_frame_buffer_; | 115 rtc::scoped_ptr<uint8_t[]> captured_frame_buffer_; |
116 cricket::WebRtcVideoFrameFactory factory_; | 116 cricket::WebRtcVideoFrameFactory factory_; |
117 }; | 117 }; |
118 | 118 |
119 TEST_F(WebRtcVideoFrameFactoryTest, NoApplyRotation) { | 119 TEST_F(WebRtcVideoFrameFactoryTest, NoApplyRotation) { |
120 TestCreateAliasedFrame(false); | 120 TestCreateAliasedFrame(false); |
121 } | 121 } |
122 | 122 |
123 TEST_F(WebRtcVideoFrameFactoryTest, ApplyRotation) { | 123 TEST_F(WebRtcVideoFrameFactoryTest, ApplyRotation) { |
124 TestCreateAliasedFrame(true); | 124 TestCreateAliasedFrame(true); |
125 } | 125 } |
OLD | NEW |