Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: webrtc/api/androidvideocapturer.cc

Issue 2104813003: AndroidVideoCapturer: Remove unused member variable (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/androidvideocapturer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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/androidvideocapturer.h" 11 #include "webrtc/api/androidvideocapturer.h"
12 12
13 #include <memory> 13 #include <memory>
14 14
15 #include "webrtc/api/java/jni/native_handle_impl.h" 15 #include "webrtc/api/java/jni/native_handle_impl.h"
16 #include "webrtc/base/common.h" 16 #include "webrtc/base/common.h"
17 #include "webrtc/base/timeutils.h" 17 #include "webrtc/base/timeutils.h"
18 #include "webrtc/media/engine/webrtcvideoframe.h" 18 #include "webrtc/media/engine/webrtcvideoframe.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 AndroidVideoCapturer::AndroidVideoCapturer( 22 AndroidVideoCapturer::AndroidVideoCapturer(
23 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate) 23 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate)
24 : running_(false), 24 : running_(false),
25 delegate_(delegate), 25 delegate_(delegate) {
26 current_state_(cricket::CS_STOPPED) {
27 thread_checker_.DetachFromThread(); 26 thread_checker_.DetachFromThread();
28 SetSupportedFormats(delegate_->GetSupportedFormats()); 27 SetSupportedFormats(delegate_->GetSupportedFormats());
29 } 28 }
30 29
31 AndroidVideoCapturer::~AndroidVideoCapturer() { 30 AndroidVideoCapturer::~AndroidVideoCapturer() {
32 RTC_CHECK(!running_); 31 RTC_CHECK(!running_);
33 } 32 }
34 33
35 cricket::CaptureState AndroidVideoCapturer::Start( 34 cricket::CaptureState AndroidVideoCapturer::Start(
36 const cricket::VideoFormat& capture_format) { 35 const cricket::VideoFormat& capture_format) {
37 RTC_CHECK(thread_checker_.CalledOnValidThread()); 36 RTC_CHECK(thread_checker_.CalledOnValidThread());
38 RTC_CHECK(!running_); 37 RTC_CHECK(!running_);
39 const int fps = cricket::VideoFormat::IntervalToFps(capture_format.interval); 38 const int fps = cricket::VideoFormat::IntervalToFps(capture_format.interval);
40 LOG(LS_INFO) << " AndroidVideoCapturer::Start " << capture_format.width << "x" 39 LOG(LS_INFO) << " AndroidVideoCapturer::Start " << capture_format.width << "x"
41 << capture_format.height << "@" << fps; 40 << capture_format.height << "@" << fps;
42 41
43 running_ = true; 42 running_ = true;
44 delegate_->Start(capture_format.width, capture_format.height, fps, this); 43 delegate_->Start(capture_format.width, capture_format.height, fps, this);
45 SetCaptureFormat(&capture_format); 44 SetCaptureFormat(&capture_format);
46 current_state_ = cricket::CS_STARTING; 45 return cricket::CS_STARTING;
47 return current_state_;
48 } 46 }
49 47
50 void AndroidVideoCapturer::Stop() { 48 void AndroidVideoCapturer::Stop() {
51 LOG(LS_INFO) << " AndroidVideoCapturer::Stop "; 49 LOG(LS_INFO) << " AndroidVideoCapturer::Stop ";
52 RTC_CHECK(thread_checker_.CalledOnValidThread()); 50 RTC_CHECK(thread_checker_.CalledOnValidThread());
53 RTC_CHECK(running_); 51 RTC_CHECK(running_);
54 running_ = false; 52 running_ = false;
55 SetCaptureFormat(NULL); 53 SetCaptureFormat(NULL);
56 54
57 delegate_->Stop(); 55 delegate_->Stop();
58 current_state_ = cricket::CS_STOPPED; 56 SetCaptureState(cricket::CS_STOPPED);
59 SetCaptureState(current_state_);
60 } 57 }
61 58
62 bool AndroidVideoCapturer::IsRunning() { 59 bool AndroidVideoCapturer::IsRunning() {
63 RTC_CHECK(thread_checker_.CalledOnValidThread()); 60 RTC_CHECK(thread_checker_.CalledOnValidThread());
64 return running_; 61 return running_;
65 } 62 }
66 63
67 bool AndroidVideoCapturer::GetPreferredFourccs(std::vector<uint32_t>* fourccs) { 64 bool AndroidVideoCapturer::GetPreferredFourccs(std::vector<uint32_t>* fourccs) {
68 RTC_CHECK(thread_checker_.CalledOnValidThread()); 65 RTC_CHECK(thread_checker_.CalledOnValidThread());
69 fourccs->push_back(cricket::FOURCC_YV12); 66 fourccs->push_back(cricket::FOURCC_YV12);
70 return true; 67 return true;
71 } 68 }
72 69
73 void AndroidVideoCapturer::OnCapturerStarted(bool success) { 70 void AndroidVideoCapturer::OnCapturerStarted(bool success) {
74 RTC_CHECK(thread_checker_.CalledOnValidThread()); 71 RTC_CHECK(thread_checker_.CalledOnValidThread());
75 cricket::CaptureState new_state = 72 const cricket::CaptureState new_state =
76 success ? cricket::CS_RUNNING : cricket::CS_FAILED; 73 success ? cricket::CS_RUNNING : cricket::CS_FAILED;
77 if (new_state == current_state_)
78 return;
79 current_state_ = new_state;
80 SetCaptureState(new_state); 74 SetCaptureState(new_state);
81 } 75 }
82 76
83 void AndroidVideoCapturer::OnOutputFormatRequest( 77 void AndroidVideoCapturer::OnOutputFormatRequest(
84 int width, int height, int fps) { 78 int width, int height, int fps) {
85 RTC_CHECK(thread_checker_.CalledOnValidThread()); 79 RTC_CHECK(thread_checker_.CalledOnValidThread());
86 cricket::VideoFormat format(width, height, 80 cricket::VideoFormat format(width, height,
87 cricket::VideoFormat::FpsToInterval(fps), 0); 81 cricket::VideoFormat::FpsToInterval(fps), 0);
88 video_adapter()->OnOutputFormatRequest(format); 82 video_adapter()->OnOutputFormatRequest(format);
89 } 83 }
90 84
91 bool AndroidVideoCapturer::GetBestCaptureFormat( 85 bool AndroidVideoCapturer::GetBestCaptureFormat(
92 const cricket::VideoFormat& desired, 86 const cricket::VideoFormat& desired,
93 cricket::VideoFormat* best_format) { 87 cricket::VideoFormat* best_format) {
94 // Delegate this choice to VideoCapturer.startCapture(). 88 // Delegate this choice to VideoCapturer.startCapture().
95 *best_format = desired; 89 *best_format = desired;
96 return true; 90 return true;
97 } 91 }
98 92
99 } // namespace webrtc 93 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/androidvideocapturer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698