OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 return kScaleFactors[best_index]; | 101 return kScaleFactors[best_index]; |
102 } | 102 } |
103 | 103 |
104 // Computes a scale less to fit in max_pixels while maintaining aspect ratio. | 104 // Computes a scale less to fit in max_pixels while maintaining aspect ratio. |
105 void ComputeScaleMaxPixels(int frame_width, int frame_height, int max_pixels, | 105 void ComputeScaleMaxPixels(int frame_width, int frame_height, int max_pixels, |
106 int* scaled_width, int* scaled_height) { | 106 int* scaled_width, int* scaled_height) { |
107 ASSERT(scaled_width != NULL); | 107 ASSERT(scaled_width != NULL); |
108 ASSERT(scaled_height != NULL); | 108 ASSERT(scaled_height != NULL); |
109 ASSERT(max_pixels > 0); | 109 ASSERT(max_pixels > 0); |
110 // For VP8 the values for max width and height can be found here | |
111 // webrtc/src/video_engine/vie_defines.h (kViEMaxCodecWidth and | |
112 // kViEMaxCodecHeight) | |
113 const int kMaxWidth = 4096; | 110 const int kMaxWidth = 4096; |
114 const int kMaxHeight = 3072; | 111 const int kMaxHeight = 3072; |
115 int new_frame_width = frame_width; | 112 int new_frame_width = frame_width; |
116 int new_frame_height = frame_height; | 113 int new_frame_height = frame_height; |
117 | 114 |
118 // Limit width. | 115 // Limit width. |
119 if (new_frame_width > kMaxWidth) { | 116 if (new_frame_width > kMaxWidth) { |
120 new_frame_height = new_frame_height * kMaxWidth / new_frame_width; | 117 new_frame_height = new_frame_height * kMaxWidth / new_frame_width; |
121 new_frame_width = kMaxWidth; | 118 new_frame_width = kMaxWidth; |
122 } | 119 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 235 } |
239 } | 236 } |
240 | 237 |
241 std::ostringstream ss; | 238 std::ostringstream ss; |
242 ss << fourcc_name << width << "x" << height << "x" | 239 ss << fourcc_name << width << "x" << height << "x" |
243 << IntervalToFpsFloat(interval); | 240 << IntervalToFpsFloat(interval); |
244 return ss.str(); | 241 return ss.str(); |
245 } | 242 } |
246 | 243 |
247 } // namespace cricket | 244 } // namespace cricket |
OLD | NEW |