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

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 1904773004: Revert of Introduce components/display_compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/video_capture_controller.h" 5 #include "content/browser/renderer_host/media/video_capture_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/metrics/sparse_histogram.h" 17 #include "base/metrics/sparse_histogram.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "components/display_compositor/gl_helper.h" 20 #include "content/browser/compositor/gl_helper.h"
21 #include "content/browser/renderer_host/media/media_stream_manager.h" 21 #include "content/browser/renderer_host/media/media_stream_manager.h"
22 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" 22 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h"
23 #include "content/browser/renderer_host/media/video_capture_device_client.h" 23 #include "content/browser/renderer_host/media/video_capture_device_client.h"
24 #include "content/browser/renderer_host/media/video_capture_manager.h" 24 #include "content/browser/renderer_host/media/video_capture_manager.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
27 #include "media/base/video_frame.h" 27 #include "media/base/video_frame.h"
28 28
29 #if !defined(OS_ANDROID) 29 #if !defined(OS_ANDROID)
30 #include "content/browser/compositor/image_transport_factory.h" 30 #include "content/browser/compositor/image_transport_factory.h"
31 #endif 31 #endif
32 32
33 using media::VideoCaptureFormat; 33 using media::VideoCaptureFormat;
34 using media::VideoFrame; 34 using media::VideoFrame;
35 using media::VideoFrameMetadata; 35 using media::VideoFrameMetadata;
36 36
37 namespace content { 37 namespace content {
38 38
39 namespace { 39 namespace {
40 40
41 static const int kInfiniteRatio = 99999; 41 static const int kInfiniteRatio = 99999;
42 42
43 #define UMA_HISTOGRAM_ASPECT_RATIO(name, width, height) \ 43 #define UMA_HISTOGRAM_ASPECT_RATIO(name, width, height) \
44 UMA_HISTOGRAM_SPARSE_SLOWLY( \ 44 UMA_HISTOGRAM_SPARSE_SLOWLY( \
45 name, \ 45 name, \
46 (height) ? ((width) * 100) / (height) : kInfiniteRatio); 46 (height) ? ((width) * 100) / (height) : kInfiniteRatio);
47 47
48 class SyncTokenClientImpl : public VideoFrame::SyncTokenClient { 48 class SyncTokenClientImpl : public VideoFrame::SyncTokenClient {
49 public: 49 public:
50 explicit SyncTokenClientImpl(display_compositor::GLHelper* gl_helper) 50 explicit SyncTokenClientImpl(GLHelper* gl_helper) : gl_helper_(gl_helper) {}
51 : gl_helper_(gl_helper) {}
52 ~SyncTokenClientImpl() override {} 51 ~SyncTokenClientImpl() override {}
53 void GenerateSyncToken(gpu::SyncToken* sync_token) override { 52 void GenerateSyncToken(gpu::SyncToken* sync_token) override {
54 gl_helper_->GenerateSyncToken(sync_token); 53 gl_helper_->GenerateSyncToken(sync_token);
55 } 54 }
56 void WaitSyncToken(const gpu::SyncToken& sync_token) override { 55 void WaitSyncToken(const gpu::SyncToken& sync_token) override {
57 gl_helper_->WaitSyncToken(sync_token); 56 gl_helper_->WaitSyncToken(sync_token);
58 } 57 }
59 58
60 private: 59 private:
61 display_compositor::GLHelper* gl_helper_; 60 GLHelper* gl_helper_;
62 }; 61 };
63 62
64 void ReturnVideoFrame(const scoped_refptr<VideoFrame>& video_frame, 63 void ReturnVideoFrame(const scoped_refptr<VideoFrame>& video_frame,
65 const gpu::SyncToken& sync_token) { 64 const gpu::SyncToken& sync_token) {
66 DCHECK_CURRENTLY_ON(BrowserThread::UI); 65 DCHECK_CURRENTLY_ON(BrowserThread::UI);
67 #if defined(OS_ANDROID) 66 #if defined(OS_ANDROID)
68 NOTREACHED(); 67 NOTREACHED();
69 #else 68 #else
70 display_compositor::GLHelper* gl_helper = 69 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
71 ImageTransportFactory::GetInstance()->GetGLHelper();
72 // UpdateReleaseSyncToken() creates a new sync_token using |gl_helper|, so 70 // UpdateReleaseSyncToken() creates a new sync_token using |gl_helper|, so
73 // wait the given |sync_token| using |gl_helper|. 71 // wait the given |sync_token| using |gl_helper|.
74 if (gl_helper) { 72 if (gl_helper) {
75 gl_helper->WaitSyncToken(sync_token); 73 gl_helper->WaitSyncToken(sync_token);
76 SyncTokenClientImpl client(gl_helper); 74 SyncTokenClientImpl client(gl_helper);
77 video_frame->UpdateReleaseSyncToken(&client); 75 video_frame->UpdateReleaseSyncToken(&client);
78 } 76 }
79 #endif 77 #endif
80 } 78 }
81 79
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 int session_id, 508 int session_id,
511 const ControllerClients& clients) { 509 const ControllerClients& clients) {
512 for (auto client : clients) { 510 for (auto client : clients) {
513 if (client->session_id == session_id) 511 if (client->session_id == session_id)
514 return client; 512 return client;
515 } 513 }
516 return NULL; 514 return NULL;
517 } 515 }
518 516
519 } // namespace content 517 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698