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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 captured_frame_.fourcc = cricket::FOURCC_I420; | 44 captured_frame_.fourcc = cricket::FOURCC_I420; |
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_.time_stamp = 5678; | 47 captured_frame_.time_stamp = 5678; |
48 captured_frame_.rotation = frame_rotation; | 48 captured_frame_.rotation = frame_rotation; |
49 captured_frame_.width = frame_width; | 49 captured_frame_.width = frame_width; |
50 captured_frame_.height = frame_height; | 50 captured_frame_.height = frame_height; |
51 captured_frame_.data_size = | 51 captured_frame_.data_size = |
52 (frame_width * frame_height) + | 52 (frame_width * frame_height) + |
53 ((frame_width + 1) / 2) * ((frame_height + 1) / 2) * 2; | 53 ((frame_width + 1) / 2) * ((frame_height + 1) / 2) * 2; |
54 captured_frame_buffer_.reset(new uint8[captured_frame_.data_size]); | 54 captured_frame_buffer_.reset(new uint8_t[captured_frame_.data_size]); |
55 // Initialize memory to satisfy DrMemory tests. | 55 // Initialize memory to satisfy DrMemory tests. |
56 memset(captured_frame_buffer_.get(), 0, captured_frame_.data_size); | 56 memset(captured_frame_buffer_.get(), 0, captured_frame_.data_size); |
57 captured_frame_.data = captured_frame_buffer_.get(); | 57 captured_frame_.data = captured_frame_buffer_.get(); |
58 } | 58 } |
59 | 59 |
60 void VerifyFrame(cricket::VideoFrame* dest_frame, | 60 void VerifyFrame(cricket::VideoFrame* dest_frame, |
61 webrtc::VideoRotation src_rotation, | 61 webrtc::VideoRotation src_rotation, |
62 int src_width, | 62 int src_width, |
63 int src_height, | 63 int src_height, |
64 bool apply_rotation) { | 64 bool apply_rotation) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 frame.reset(factory.CreateAliasedFrame( | 104 frame.reset(factory.CreateAliasedFrame( |
105 &captured_frame, new_width, new_height, new_width / 2, new_height / 2)); | 105 &captured_frame, new_width, new_height, new_width / 2, new_height / 2)); |
106 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2, | 106 VerifyFrame(frame.get(), webrtc::kVideoRotation_270, new_width / 2, |
107 new_height / 2, apply_rotation); | 107 new_height / 2, apply_rotation); |
108 } | 108 } |
109 | 109 |
110 const cricket::CapturedFrame& get_captured_frame() { return captured_frame_; } | 110 const cricket::CapturedFrame& get_captured_frame() { return captured_frame_; } |
111 | 111 |
112 private: | 112 private: |
113 cricket::CapturedFrame captured_frame_; | 113 cricket::CapturedFrame captured_frame_; |
114 rtc::scoped_ptr<uint8[]> captured_frame_buffer_; | 114 rtc::scoped_ptr<uint8_t[]> captured_frame_buffer_; |
115 cricket::WebRtcVideoFrameFactory factory_; | 115 cricket::WebRtcVideoFrameFactory factory_; |
116 }; | 116 }; |
117 | 117 |
118 TEST_F(WebRtcVideoFrameFactoryTest, NoApplyRotation) { | 118 TEST_F(WebRtcVideoFrameFactoryTest, NoApplyRotation) { |
119 TestCreateAliasedFrame(false); | 119 TestCreateAliasedFrame(false); |
120 } | 120 } |
121 | 121 |
122 TEST_F(WebRtcVideoFrameFactoryTest, ApplyRotation) { | 122 TEST_F(WebRtcVideoFrameFactoryTest, ApplyRotation) { |
123 TestCreateAliasedFrame(true); | 123 TestCreateAliasedFrame(true); |
124 } | 124 } |
OLD | NEW |