| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 #include "webrtc/api/remotevideocapturer.h" | 11 #include "webrtc/api/remotevideocapturer.h" |
| 12 | 12 |
| 13 #include "webrtc/base/logging.h" | 13 // TODO(perkj): Remove this file once Chrome gyp file doesn't depend on it. |
| 14 #include "webrtc/media/base/videoframe.h" | |
| 15 | |
| 16 namespace webrtc { | |
| 17 | |
| 18 RemoteVideoCapturer::RemoteVideoCapturer() {} | |
| 19 | |
| 20 RemoteVideoCapturer::~RemoteVideoCapturer() {} | |
| 21 | |
| 22 cricket::CaptureState RemoteVideoCapturer::Start( | |
| 23 const cricket::VideoFormat& capture_format) { | |
| 24 if (capture_state() == cricket::CS_RUNNING) { | |
| 25 LOG(LS_WARNING) | |
| 26 << "RemoteVideoCapturer::Start called when it's already started."; | |
| 27 return capture_state(); | |
| 28 } | |
| 29 | |
| 30 LOG(LS_INFO) << "RemoteVideoCapturer::Start"; | |
| 31 SetCaptureFormat(&capture_format); | |
| 32 return cricket::CS_RUNNING; | |
| 33 } | |
| 34 | |
| 35 void RemoteVideoCapturer::Stop() { | |
| 36 if (capture_state() == cricket::CS_STOPPED) { | |
| 37 LOG(LS_WARNING) | |
| 38 << "RemoteVideoCapturer::Stop called when it's already stopped."; | |
| 39 return; | |
| 40 } | |
| 41 | |
| 42 LOG(LS_INFO) << "RemoteVideoCapturer::Stop"; | |
| 43 SetCaptureFormat(NULL); | |
| 44 SetCaptureState(cricket::CS_STOPPED); | |
| 45 } | |
| 46 | |
| 47 bool RemoteVideoCapturer::IsRunning() { | |
| 48 return capture_state() == cricket::CS_RUNNING; | |
| 49 } | |
| 50 | |
| 51 bool RemoteVideoCapturer::GetPreferredFourccs(std::vector<uint32_t>* fourccs) { | |
| 52 if (!fourccs) | |
| 53 return false; | |
| 54 fourccs->push_back(cricket::FOURCC_I420); | |
| 55 return true; | |
| 56 } | |
| 57 | |
| 58 bool RemoteVideoCapturer::GetBestCaptureFormat( | |
| 59 const cricket::VideoFormat& desired, cricket::VideoFormat* best_format) { | |
| 60 if (!best_format) { | |
| 61 return false; | |
| 62 } | |
| 63 | |
| 64 // RemoteVideoCapturer does not support capability enumeration. | |
| 65 // Use the desired format as the best format. | |
| 66 best_format->width = desired.width; | |
| 67 best_format->height = desired.height; | |
| 68 best_format->fourcc = cricket::FOURCC_I420; | |
| 69 best_format->interval = desired.interval; | |
| 70 return true; | |
| 71 } | |
| 72 | |
| 73 bool RemoteVideoCapturer::IsScreencast() const { | |
| 74 // TODO(ronghuawu): what about remote screencast stream. | |
| 75 return false; | |
| 76 } | |
| 77 | |
| 78 } // namespace webrtc | |
| OLD | NEW |