| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ |
| 12 #define WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ | 12 #define WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ |
| 13 | 13 |
| 14 #include "webrtc/base/constructormagic.h" | 14 #include "webrtc/base/constructormagic.h" |
| 15 #include "webrtc/base/criticalsection.h" | 15 #include "webrtc/base/criticalsection.h" |
| 16 #include "webrtc/base/optional.h" | 16 #include "webrtc/base/optional.h" |
| 17 #include "webrtc/media/base/videocommon.h" | 17 #include "webrtc/media/base/videocommon.h" |
| 18 | 18 |
| 19 namespace cricket { | 19 namespace cricket { |
| 20 | 20 |
| 21 // VideoAdapter adapts an input video frame to an output frame based on the | 21 // VideoAdapter adapts an input video frame to an output frame based on the |
| 22 // specified input and output formats. The adaptation includes dropping frames | 22 // specified input and output formats. The adaptation includes dropping frames |
| 23 // to reduce frame rate and scaling frames. | 23 // to reduce frame rate and scaling frames. |
| 24 // VideoAdapter is thread safe. | 24 // VideoAdapter is thread safe. |
| 25 class VideoAdapter { | 25 class VideoAdapter { |
| 26 public: | 26 public: |
| 27 VideoAdapter(); | 27 VideoAdapter(); |
| 28 virtual ~VideoAdapter(); | 28 virtual ~VideoAdapter(); |
| 29 | 29 |
| 30 // Return the adapted resolution given the input resolution. The input | 30 // Return the adapted resolution and cropping parameters given the |
| 31 // resolution should first be cropped to the specified resolution, and then | 31 // input resolution. The input frame should first be cropped, then |
| 32 // scaled to the final output resolution. The output resolution will be 0x0 if | 32 // scaled to the final output resolution. Returns true if the frame |
| 33 // the frame should be dropped. | 33 // should be adapted, and false if it should be dropped. |
| 34 void AdaptFrameResolution(int in_width, | 34 bool AdaptFrameResolution(int in_width, |
| 35 int in_height, | 35 int in_height, |
| 36 int64_t in_timestamp_ns, | 36 int64_t in_timestamp_ns, |
| 37 int* cropped_width, | 37 int* cropped_width, |
| 38 int* cropped_height, | 38 int* cropped_height, |
| 39 int* out_width, | 39 int* out_width, |
| 40 int* out_height); | 40 int* out_height); |
| 41 | 41 |
| 42 // Requests the output frame size and frame interval from | 42 // Requests the output frame size and frame interval from |
| 43 // |AdaptFrameResolution| to not be larger than |format|. Also, the input | 43 // |AdaptFrameResolution| to not be larger than |format|. Also, the input |
| 44 // frame size will be cropped to match the requested aspect ratio. The | 44 // frame size will be cropped to match the requested aspect ratio. The |
| (...skipping 30 matching lines...) Expand all Loading... |
| 75 | 75 |
| 76 // The critical section to protect the above variables. | 76 // The critical section to protect the above variables. |
| 77 rtc::CriticalSection critical_section_; | 77 rtc::CriticalSection critical_section_; |
| 78 | 78 |
| 79 RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter); | 79 RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace cricket | 82 } // namespace cricket |
| 83 | 83 |
| 84 #endif // WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ | 84 #endif // WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ |
| OLD | NEW |