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

Unified Diff: webrtc/media/base/capturemanager.cc

Issue 1655793003: Make cricket::VideoCapturer implement VideoSourceInterface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added dummy capturerenderadapter.cc Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/base/capturemanager.h ('k') | webrtc/media/base/capturerenderadapter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/capturemanager.cc
diff --git a/webrtc/media/base/capturemanager.cc b/webrtc/media/base/capturemanager.cc
index 689b6d762024155c45bff736134b4608de50b620..3628fb306d8663a0f18f5b30224a9bc4751777df 100644
--- a/webrtc/media/base/capturemanager.cc
+++ b/webrtc/media/base/capturemanager.cc
@@ -23,7 +23,7 @@ class VideoCapturerState {
public:
static const VideoFormatPod kDefaultCaptureFormat;
- static VideoCapturerState* Create(VideoCapturer* video_capturer);
+ explicit VideoCapturerState(VideoCapturer* capturer);
~VideoCapturerState() {}
void AddCaptureResolution(const VideoFormat& desired_format);
@@ -32,13 +32,9 @@ class VideoCapturerState {
int IncCaptureStartRef();
int DecCaptureStartRef();
- CaptureRenderAdapter* adapter() {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- return adapter_.get();
- }
VideoCapturer* GetVideoCapturer() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- return adapter()->video_capturer();
+ return video_capturer_;
}
int start_count() const {
@@ -53,11 +49,9 @@ class VideoCapturerState {
};
typedef std::vector<CaptureResolutionInfo> CaptureFormats;
- explicit VideoCapturerState(CaptureRenderAdapter* adapter);
-
rtc::ThreadChecker thread_checker_;
- rtc::scoped_ptr<CaptureRenderAdapter> adapter_;
+ VideoCapturer* video_capturer_;
int start_count_;
CaptureFormats capture_formats_;
};
@@ -66,17 +60,8 @@ const VideoFormatPod VideoCapturerState::kDefaultCaptureFormat = {
640, 360, FPS_TO_INTERVAL(30), FOURCC_ANY
};
-VideoCapturerState::VideoCapturerState(CaptureRenderAdapter* adapter)
- : adapter_(adapter), start_count_(1) {}
-
-// static
-VideoCapturerState* VideoCapturerState::Create(VideoCapturer* video_capturer) {
- CaptureRenderAdapter* adapter = CaptureRenderAdapter::Create(video_capturer);
- if (!adapter) {
- return NULL;
- }
- return new VideoCapturerState(adapter);
-}
+VideoCapturerState::VideoCapturerState(VideoCapturer* capturer)
+ : video_capturer_(capturer), start_count_(1) {}
void VideoCapturerState::AddCaptureResolution(
const VideoFormat& desired_format) {
@@ -276,11 +261,10 @@ void CaptureManager::AddVideoSink(VideoCapturer* video_capturer,
if (!video_capturer || !sink) {
return;
}
- CaptureRenderAdapter* adapter = GetAdapter(video_capturer);
- if (!adapter) {
- return;
- }
- adapter->AddSink(sink);
+ rtc::VideoSinkWants wants;
+ // Renderers must be able to apply rotation.
+ wants.rotation_applied = false;
+ video_capturer->AddOrUpdateSink(sink, wants);
}
void CaptureManager::RemoveVideoSink(
@@ -290,11 +274,7 @@ void CaptureManager::RemoveVideoSink(
if (!video_capturer || !sink) {
return;
}
- CaptureRenderAdapter* adapter = GetAdapter(video_capturer);
- if (!adapter) {
- return;
- }
- adapter->RemoveSink(sink);
+ video_capturer->RemoveSink(sink);
}
bool CaptureManager::IsCapturerRegistered(VideoCapturer* video_capturer) const {
@@ -304,11 +284,7 @@ bool CaptureManager::IsCapturerRegistered(VideoCapturer* video_capturer) const {
bool CaptureManager::RegisterVideoCapturer(VideoCapturer* video_capturer) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- VideoCapturerState* capture_state =
- VideoCapturerState::Create(video_capturer);
- if (!capture_state) {
- return false;
- }
+ VideoCapturerState* capture_state = new VideoCapturerState(video_capturer);
capture_states_[video_capturer] = capture_state;
SignalCapturerStateChange.repeat(video_capturer->SignalStateChange);
return true;
@@ -376,14 +352,4 @@ VideoCapturerState* CaptureManager::GetCaptureState(
return iter->second;
}
-CaptureRenderAdapter* CaptureManager::GetAdapter(
- VideoCapturer* video_capturer) const {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- VideoCapturerState* capture_state = GetCaptureState(video_capturer);
- if (!capture_state) {
- return NULL;
- }
- return capture_state->adapter();
-}
-
} // namespace cricket
« no previous file with comments | « webrtc/media/base/capturemanager.h ('k') | webrtc/media/base/capturerenderadapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698