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

Unified Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 2735083002: [Mojo Video Capture] Add test coverage for accelerated jpeg decoding (Closed)
Patch Set: Rebase to March 15th, Remove #include jpeg_parser Created 3 years, 9 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
Index: content/browser/renderer_host/media/video_capture_controller.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc
index 267d85a40753dac7b501a7463a01ab26367e391c..557828cb9ce3ec0ffce046f9c106593f5a54b62b 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -46,6 +46,21 @@ static const int kInfiniteRatio = 99999;
UMA_HISTOGRAM_SPARSE_SLOWLY( \
name, (height) ? ((width)*100) / (height) : kInfiniteRatio);
+void CallOnError(VideoCaptureControllerEventHandler* client,
+ VideoCaptureControllerID id) {
+ client->OnError(id);
+}
+
+void CallOnStarted(VideoCaptureControllerEventHandler* client,
+ VideoCaptureControllerID id) {
+ client->OnStarted(id);
+}
+
+void CallOnStartedUsingGpuDecode(VideoCaptureControllerEventHandler* client,
+ VideoCaptureControllerID id) {
+ client->OnStartedUsingGpuDecode(id);
+}
+
} // anonymous namespace
struct VideoCaptureController::ControllerClient {
@@ -451,12 +466,7 @@ void VideoCaptureController::OnBufferRetired(int buffer_id) {
void VideoCaptureController::OnError() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
state_ = VIDEO_CAPTURE_STATE_ERROR;
-
- for (const auto& client : controller_clients_) {
- if (client->session_closed)
- continue;
- client->event_handler->OnError(client->controller_id);
- }
+ PerformForClientsWithOpenSession(base::Bind(&CallOnError));
}
void VideoCaptureController::OnLog(const std::string& message) {
@@ -467,12 +477,11 @@ void VideoCaptureController::OnLog(const std::string& message) {
void VideoCaptureController::OnStarted() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
state_ = VIDEO_CAPTURE_STATE_STARTED;
+ PerformForClientsWithOpenSession(base::Bind(&CallOnStarted));
+}
- for (const auto& client : controller_clients_) {
- if (client->session_closed)
- continue;
- client->event_handler->OnStarted(client->controller_id);
- }
+void VideoCaptureController::OnStartedUsingGpuDecode() {
+ PerformForClientsWithOpenSession(base::Bind(&CallOnStartedUsingGpuDecode));
}
VideoCaptureController::ControllerClient* VideoCaptureController::FindClient(
@@ -547,4 +556,14 @@ void VideoCaptureController::ReleaseBufferContext(
buffer_contexts_.erase(buffer_context_iter);
}
+void VideoCaptureController::PerformForClientsWithOpenSession(
+ EventHandlerAction action) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ for (const auto& client : controller_clients_) {
+ if (client->session_closed)
+ continue;
+ action.Run(client->event_handler, client->controller_id);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698