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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 : frame.release(); | 95 : frame.release(); |
96 } | 96 } |
97 | 97 |
98 cricket::VideoFrame* CreateAliasedFrame( | 98 cricket::VideoFrame* CreateAliasedFrame( |
99 const cricket::CapturedFrame* input_frame, | 99 const cricket::CapturedFrame* input_frame, |
100 int cropped_input_width, | 100 int cropped_input_width, |
101 int cropped_input_height, | 101 int cropped_input_height, |
102 int output_width, | 102 int output_width, |
103 int output_height) const override { | 103 int output_height) const override { |
104 if (buffer_->native_handle() != nullptr) { | 104 if (buffer_->native_handle() != nullptr) { |
| 105 // TODO(perkj) Implement cropping. |
| 106 RTC_CHECK_EQ(cropped_input_width, buffer_->width()); |
| 107 RTC_CHECK_EQ(cropped_input_height, buffer_->height()); |
105 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( | 108 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( |
106 static_cast<webrtc_jni::AndroidTextureBuffer*>(buffer_.get()) | 109 static_cast<webrtc_jni::AndroidTextureBuffer*>(buffer_.get()) |
107 ->CropAndScale(cropped_input_width, cropped_input_height, | 110 ->ScaleAndRotate(output_width, output_height, |
108 output_width, output_height)); | 111 apply_rotation_ ? input_frame->rotation : |
| 112 webrtc::kVideoRotation_0)); |
109 return new cricket::WebRtcVideoFrame( | 113 return new cricket::WebRtcVideoFrame( |
110 scaled_buffer, input_frame->time_stamp, input_frame->rotation); | 114 scaled_buffer, input_frame->time_stamp, |
| 115 apply_rotation_ ? webrtc::kVideoRotation_0 : input_frame->rotation); |
111 } | 116 } |
112 return VideoFrameFactory::CreateAliasedFrame(input_frame, | 117 return VideoFrameFactory::CreateAliasedFrame(input_frame, |
113 cropped_input_width, | 118 cropped_input_width, |
114 cropped_input_height, | 119 cropped_input_height, |
115 output_width, | 120 output_width, |
116 output_height); | 121 output_height); |
117 } | 122 } |
118 | 123 |
119 private: | 124 private: |
120 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer_; | 125 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer_; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 241 |
237 bool AndroidVideoCapturer::GetBestCaptureFormat( | 242 bool AndroidVideoCapturer::GetBestCaptureFormat( |
238 const cricket::VideoFormat& desired, | 243 const cricket::VideoFormat& desired, |
239 cricket::VideoFormat* best_format) { | 244 cricket::VideoFormat* best_format) { |
240 // Delegate this choice to VideoCapturerAndroid.startCapture(). | 245 // Delegate this choice to VideoCapturerAndroid.startCapture(). |
241 *best_format = desired; | 246 *best_format = desired; |
242 return true; | 247 return true; |
243 } | 248 } |
244 | 249 |
245 } // namespace webrtc | 250 } // namespace webrtc |
OLD | NEW |