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) |
110 const int kMaxWidth = 4096; | 113 const int kMaxWidth = 4096; |
111 const int kMaxHeight = 3072; | 114 const int kMaxHeight = 3072; |
112 int new_frame_width = frame_width; | 115 int new_frame_width = frame_width; |
113 int new_frame_height = frame_height; | 116 int new_frame_height = frame_height; |
114 | 117 |
115 // Limit width. | 118 // Limit width. |
116 if (new_frame_width > kMaxWidth) { | 119 if (new_frame_width > kMaxWidth) { |
117 new_frame_height = new_frame_height * kMaxWidth / new_frame_width; | 120 new_frame_height = new_frame_height * kMaxWidth / new_frame_width; |
118 new_frame_width = kMaxWidth; | 121 new_frame_width = kMaxWidth; |
119 } | 122 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 238 } |
236 } | 239 } |
237 | 240 |
238 std::ostringstream ss; | 241 std::ostringstream ss; |
239 ss << fourcc_name << width << "x" << height << "x" | 242 ss << fourcc_name << width << "x" << height << "x" |
240 << IntervalToFpsFloat(interval); | 243 << IntervalToFpsFloat(interval); |
241 return ss.str(); | 244 return ss.str(); |
242 } | 245 } |
243 | 246 |
244 } // namespace cricket | 247 } // namespace cricket |
OLD | NEW |