OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 return nullptr; | 44 return nullptr; |
45 | 45 |
46 if (cropped_input_width == output_width && | 46 if (cropped_input_width == output_width && |
47 cropped_input_height == output_height) { | 47 cropped_input_height == output_height) { |
48 // No scaling needed. | 48 // No scaling needed. |
49 return cropped_input_frame.release(); | 49 return cropped_input_frame.release(); |
50 } | 50 } |
51 | 51 |
52 // If the frame is rotated, we need to switch the width and height. | 52 // If the frame is rotated, we need to switch the width and height. |
53 if (apply_rotation_ && | 53 if (apply_rotation_ && |
54 (input_frame->GetRotation() == webrtc::kVideoRotation_90 || | 54 (input_frame->rotation == webrtc::kVideoRotation_90 || |
55 input_frame->GetRotation() == webrtc::kVideoRotation_270)) { | 55 input_frame->rotation == webrtc::kVideoRotation_270)) { |
56 std::swap(output_width, output_height); | 56 std::swap(output_width, output_height); |
57 } | 57 } |
58 | 58 |
59 // Create and stretch the output frame if it has not been created yet, is | 59 // Create and stretch the output frame if it has not been created yet, is |
60 // still in use by others, or its size is not same as the expected. | 60 // still in use by others, or its size is not same as the expected. |
61 if (!output_frame_ || !output_frame_->IsExclusive() || | 61 if (!output_frame_ || !output_frame_->IsExclusive() || |
62 output_frame_->GetWidth() != static_cast<size_t>(output_width) || | 62 output_frame_->GetWidth() != static_cast<size_t>(output_width) || |
63 output_frame_->GetHeight() != static_cast<size_t>(output_height)) { | 63 output_frame_->GetHeight() != static_cast<size_t>(output_height)) { |
64 output_frame_.reset( | 64 output_frame_.reset( |
65 cropped_input_frame->Stretch(output_width, output_height, true, true)); | 65 cropped_input_frame->Stretch(output_width, output_height, true, true)); |
66 if (!output_frame_) { | 66 if (!output_frame_) { |
67 LOG(LS_WARNING) << "Failed to stretch frame to " << output_width << "x" | 67 LOG(LS_WARNING) << "Failed to stretch frame to " << output_width << "x" |
68 << output_height; | 68 << output_height; |
69 return NULL; | 69 return NULL; |
70 } | 70 } |
71 } else { | 71 } else { |
72 cropped_input_frame->StretchToFrame(output_frame_.get(), true, true); | 72 cropped_input_frame->StretchToFrame(output_frame_.get(), true, true); |
73 output_frame_->SetTimeStamp(cropped_input_frame->GetTimeStamp()); | 73 output_frame_->SetTimeStamp(cropped_input_frame->GetTimeStamp()); |
74 } | 74 } |
75 return output_frame_->Copy(); | 75 return output_frame_->Copy(); |
76 } | 76 } |
77 | 77 |
78 } // namespace cricket | 78 } // namespace cricket |
OLD | NEW |