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

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

Issue 1902463002: Introduce components/display_compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bot changes. Will do in a separate CL 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 "content/browser/compositor/gl_helper.h" 20 #include "components/display_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(GLHelper* gl_helper) : gl_helper_(gl_helper) {} 50 explicit SyncTokenClientImpl(display_compositor::GLHelper* gl_helper)
51 : gl_helper_(gl_helper) {}
51 ~SyncTokenClientImpl() override {} 52 ~SyncTokenClientImpl() override {}
52 void GenerateSyncToken(gpu::SyncToken* sync_token) override { 53 void GenerateSyncToken(gpu::SyncToken* sync_token) override {
53 gl_helper_->GenerateSyncToken(sync_token); 54 gl_helper_->GenerateSyncToken(sync_token);
54 } 55 }
55 void WaitSyncToken(const gpu::SyncToken& sync_token) override { 56 void WaitSyncToken(const gpu::SyncToken& sync_token) override {
56 gl_helper_->WaitSyncToken(sync_token); 57 gl_helper_->WaitSyncToken(sync_token);
57 } 58 }
58 59
59 private: 60 private:
60 GLHelper* gl_helper_; 61 display_compositor::GLHelper* gl_helper_;
61 }; 62 };
62 63
63 void ReturnVideoFrame(const scoped_refptr<VideoFrame>& video_frame, 64 void ReturnVideoFrame(const scoped_refptr<VideoFrame>& video_frame,
64 const gpu::SyncToken& sync_token) { 65 const gpu::SyncToken& sync_token) {
65 DCHECK_CURRENTLY_ON(BrowserThread::UI); 66 DCHECK_CURRENTLY_ON(BrowserThread::UI);
66 #if defined(OS_ANDROID) 67 #if defined(OS_ANDROID)
67 NOTREACHED(); 68 NOTREACHED();
68 #else 69 #else
69 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); 70 display_compositor::GLHelper* gl_helper =
71 ImageTransportFactory::GetInstance()->GetGLHelper();
70 // UpdateReleaseSyncToken() creates a new sync_token using |gl_helper|, so 72 // UpdateReleaseSyncToken() creates a new sync_token using |gl_helper|, so
71 // wait the given |sync_token| using |gl_helper|. 73 // wait the given |sync_token| using |gl_helper|.
72 if (gl_helper) { 74 if (gl_helper) {
73 gl_helper->WaitSyncToken(sync_token); 75 gl_helper->WaitSyncToken(sync_token);
74 SyncTokenClientImpl client(gl_helper); 76 SyncTokenClientImpl client(gl_helper);
75 video_frame->UpdateReleaseSyncToken(&client); 77 video_frame->UpdateReleaseSyncToken(&client);
76 } 78 }
77 #endif 79 #endif
78 } 80 }
79 81
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 int session_id, 510 int session_id,
509 const ControllerClients& clients) { 511 const ControllerClients& clients) {
510 for (auto client : clients) { 512 for (auto client : clients) {
511 if (client->session_id == session_id) 513 if (client->session_id == session_id)
512 return client; 514 return client;
513 } 515 }
514 return NULL; 516 return NULL;
515 } 517 }
516 518
517 } // namespace content 519 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698