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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if (scale_) { | 577 if (scale_) { |
578 // Check framerate before spatial resolution change. | 578 // Check framerate before spatial resolution change. |
579 quality_scaler_.OnEncodeFrame(frame); | 579 quality_scaler_.OnEncodeFrame(frame); |
580 const webrtc::QualityScaler::Resolution scaled_resolution = | 580 const webrtc::QualityScaler::Resolution scaled_resolution = |
581 quality_scaler_.GetScaledResolution(); | 581 quality_scaler_.GetScaledResolution(); |
582 if (scaled_resolution.width != frame.width() || | 582 if (scaled_resolution.width != frame.width() || |
583 scaled_resolution.height != frame.height()) { | 583 scaled_resolution.height != frame.height()) { |
584 if (frame.native_handle() != nullptr) { | 584 if (frame.native_handle() != nullptr) { |
585 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( | 585 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( |
586 static_cast<AndroidTextureBuffer*>( | 586 static_cast<AndroidTextureBuffer*>( |
587 frame.video_frame_buffer().get())->CropAndScale( | 587 frame.video_frame_buffer().get())->ScaleAndRotate( |
588 frame.width(), | |
589 frame.height(), | |
590 scaled_resolution.width, | 588 scaled_resolution.width, |
591 scaled_resolution.height)); | 589 scaled_resolution.height, |
| 590 webrtc::kVideoRotation_0)); |
592 input_frame.set_video_frame_buffer(scaled_buffer); | 591 input_frame.set_video_frame_buffer(scaled_buffer); |
593 } else { | 592 } else { |
594 input_frame = quality_scaler_.GetScaledFrame(frame); | 593 input_frame = quality_scaler_.GetScaledFrame(frame); |
595 } | 594 } |
596 } | 595 } |
597 } | 596 } |
598 | 597 |
599 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { | 598 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { |
600 ALOGE << "Failed to reconfigure encoder."; | 599 ALOGE << "Failed to reconfigure encoder."; |
601 return WEBRTC_VIDEO_CODEC_ERROR; | 600 return WEBRTC_VIDEO_CODEC_ERROR; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 } | 1160 } |
1162 | 1161 |
1163 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1162 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
1164 webrtc::VideoEncoder* encoder) { | 1163 webrtc::VideoEncoder* encoder) { |
1165 ALOGD << "Destroy video encoder."; | 1164 ALOGD << "Destroy video encoder."; |
1166 delete encoder; | 1165 delete encoder; |
1167 } | 1166 } |
1168 | 1167 |
1169 } // namespace webrtc_jni | 1168 } // namespace webrtc_jni |
1170 | 1169 |
OLD | NEW |