| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // A hack for avoiding deep frame copies in | 37 // A hack for avoiding deep frame copies in |
| 38 // cricket::VideoCapturer.SignalFrameCaptured() using a custom FrameFactory. | 38 // cricket::VideoCapturer.SignalFrameCaptured() using a custom FrameFactory. |
| 39 // A frame is injected using UpdateCapturedFrame(), and converted into a | 39 // A frame is injected using UpdateCapturedFrame(), and converted into a |
| 40 // cricket::VideoFrame with CreateAliasedFrame(). UpdateCapturedFrame() should | 40 // cricket::VideoFrame with CreateAliasedFrame(). UpdateCapturedFrame() should |
| 41 // be called before CreateAliasedFrame() for every frame. | 41 // be called before CreateAliasedFrame() for every frame. |
| 42 // TODO(magjed): Add an interface cricket::VideoCapturer::OnFrameCaptured() | 42 // TODO(magjed): Add an interface cricket::VideoCapturer::OnFrameCaptured() |
| 43 // for ref counted I420 frames instead of this hack. | 43 // for ref counted I420 frames instead of this hack. |
| 44 class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { | 44 class AndroidVideoCapturer::FrameFactory : public cricket::VideoFrameFactory { |
| 45 public: | 45 public: |
| 46 FrameFactory(const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate) | 46 explicit FrameFactory( |
| 47 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate) |
| 47 : delegate_(delegate) { | 48 : delegate_(delegate) { |
| 48 // Create a CapturedFrame that only contains header information, not the | 49 // Create a CapturedFrame that only contains header information, not the |
| 49 // actual pixel data. | 50 // actual pixel data. |
| 50 captured_frame_.pixel_height = 1; | 51 captured_frame_.pixel_height = 1; |
| 51 captured_frame_.pixel_width = 1; | 52 captured_frame_.pixel_width = 1; |
| 52 captured_frame_.data = nullptr; | 53 captured_frame_.data = nullptr; |
| 53 captured_frame_.data_size = cricket::CapturedFrame::kUnknownDataSize; | 54 captured_frame_.data_size = cricket::CapturedFrame::kUnknownDataSize; |
| 54 captured_frame_.fourcc = static_cast<uint32_t>(cricket::FOURCC_ANY); | 55 captured_frame_.fourcc = static_cast<uint32_t>(cricket::FOURCC_ANY); |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 !json_value["height"].isNull() && | 151 !json_value["height"].isNull() && |
| 151 !json_value["framerate"].isNull()); | 152 !json_value["framerate"].isNull()); |
| 152 cricket::VideoFormat format( | 153 cricket::VideoFormat format( |
| 153 json_value["width"].asInt(), | 154 json_value["width"].asInt(), |
| 154 json_value["height"].asInt(), | 155 json_value["height"].asInt(), |
| 155 cricket::VideoFormat::FpsToInterval(json_value["framerate"].asInt()), | 156 cricket::VideoFormat::FpsToInterval(json_value["framerate"].asInt()), |
| 156 cricket::FOURCC_YV12); | 157 cricket::FOURCC_YV12); |
| 157 formats.push_back(format); | 158 formats.push_back(format); |
| 158 } | 159 } |
| 159 SetSupportedFormats(formats); | 160 SetSupportedFormats(formats); |
| 160 // Do not apply frame rotation by default. | |
| 161 SetApplyRotation(false); | |
| 162 } | 161 } |
| 163 | 162 |
| 164 AndroidVideoCapturer::~AndroidVideoCapturer() { | 163 AndroidVideoCapturer::~AndroidVideoCapturer() { |
| 165 RTC_CHECK(!running_); | 164 RTC_CHECK(!running_); |
| 166 } | 165 } |
| 167 | 166 |
| 168 cricket::CaptureState AndroidVideoCapturer::Start( | 167 cricket::CaptureState AndroidVideoCapturer::Start( |
| 169 const cricket::VideoFormat& capture_format) { | 168 const cricket::VideoFormat& capture_format) { |
| 170 RTC_CHECK(thread_checker_.CalledOnValidThread()); | 169 RTC_CHECK(thread_checker_.CalledOnValidThread()); |
| 171 RTC_CHECK(!running_); | 170 RTC_CHECK(!running_); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 240 |
| 242 bool AndroidVideoCapturer::GetBestCaptureFormat( | 241 bool AndroidVideoCapturer::GetBestCaptureFormat( |
| 243 const cricket::VideoFormat& desired, | 242 const cricket::VideoFormat& desired, |
| 244 cricket::VideoFormat* best_format) { | 243 cricket::VideoFormat* best_format) { |
| 245 // Delegate this choice to VideoCapturerAndroid.startCapture(). | 244 // Delegate this choice to VideoCapturerAndroid.startCapture(). |
| 246 *best_format = desired; | 245 *best_format = desired; |
| 247 return true; | 246 return true; |
| 248 } | 247 } |
| 249 | 248 |
| 250 } // namespace webrtc | 249 } // namespace webrtc |
| OLD | NEW |