| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 SetSupportedFormats(formats); | 131 SetSupportedFormats(formats); |
| 132 } | 132 } |
| 133 | 133 |
| 134 AndroidVideoCapturer::~AndroidVideoCapturer() { | 134 AndroidVideoCapturer::~AndroidVideoCapturer() { |
| 135 CHECK(!running_); | 135 CHECK(!running_); |
| 136 } | 136 } |
| 137 | 137 |
| 138 cricket::CaptureState AndroidVideoCapturer::Start( | 138 cricket::CaptureState AndroidVideoCapturer::Start( |
| 139 const cricket::VideoFormat& capture_format) { | 139 const cricket::VideoFormat& capture_format) { |
| 140 LOG(LS_INFO) << " AndroidVideoCapturer::Start w = " << capture_format.width | |
| 141 << " h = " << capture_format.height; | |
| 142 CHECK(thread_checker_.CalledOnValidThread()); | 140 CHECK(thread_checker_.CalledOnValidThread()); |
| 143 CHECK(!running_); | 141 CHECK(!running_); |
| 142 const int fps = cricket::VideoFormat::IntervalToFps(capture_format.interval); |
| 143 LOG(LS_INFO) << " AndroidVideoCapturer::Start " << capture_format.width << "x" |
| 144 << capture_format.height << "@" << fps; |
| 144 | 145 |
| 145 frame_factory_ = new AndroidVideoCapturer::FrameFactory(delegate_.get()); | 146 frame_factory_ = new AndroidVideoCapturer::FrameFactory(delegate_.get()); |
| 146 set_frame_factory(frame_factory_); | 147 set_frame_factory(frame_factory_); |
| 147 | 148 |
| 148 running_ = true; | 149 running_ = true; |
| 149 delegate_->Start( | 150 delegate_->Start(capture_format.width, capture_format.height, fps, this); |
| 150 capture_format.width, capture_format.height, | |
| 151 cricket::VideoFormat::IntervalToFps(capture_format.interval), this); | |
| 152 SetCaptureFormat(&capture_format); | 151 SetCaptureFormat(&capture_format); |
| 153 current_state_ = cricket::CS_STARTING; | 152 current_state_ = cricket::CS_STARTING; |
| 154 return current_state_; | 153 return current_state_; |
| 155 } | 154 } |
| 156 | 155 |
| 157 void AndroidVideoCapturer::Stop() { | 156 void AndroidVideoCapturer::Stop() { |
| 158 LOG(LS_INFO) << " AndroidVideoCapturer::Stop "; | 157 LOG(LS_INFO) << " AndroidVideoCapturer::Stop "; |
| 159 CHECK(thread_checker_.CalledOnValidThread()); | 158 CHECK(thread_checker_.CalledOnValidThread()); |
| 160 CHECK(running_); | 159 CHECK(running_); |
| 161 running_ = false; | 160 running_ = false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 202 |
| 204 void AndroidVideoCapturer::OnOutputFormatRequest( | 203 void AndroidVideoCapturer::OnOutputFormatRequest( |
| 205 int width, int height, int fps) { | 204 int width, int height, int fps) { |
| 206 CHECK(thread_checker_.CalledOnValidThread()); | 205 CHECK(thread_checker_.CalledOnValidThread()); |
| 207 const cricket::VideoFormat& current = video_adapter()->output_format(); | 206 const cricket::VideoFormat& current = video_adapter()->output_format(); |
| 208 cricket::VideoFormat format( | 207 cricket::VideoFormat format( |
| 209 width, height, cricket::VideoFormat::FpsToInterval(fps), current.fourcc); | 208 width, height, cricket::VideoFormat::FpsToInterval(fps), current.fourcc); |
| 210 video_adapter()->OnOutputFormatRequest(format); | 209 video_adapter()->OnOutputFormatRequest(format); |
| 211 } | 210 } |
| 212 | 211 |
| 212 bool AndroidVideoCapturer::GetBestCaptureFormat( |
| 213 const cricket::VideoFormat& desired, |
| 214 cricket::VideoFormat* best_format) { |
| 215 // Delegate this choice to VideoCapturerAndroid.startCapture(). |
| 216 *best_format = desired; |
| 217 return true; |
| 218 } |
| 219 |
| 213 } // namespace webrtc | 220 } // namespace webrtc |
| OLD | NEW |