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

Side by Side Diff: media/capture/video/video_capture_device_client.cc

Issue 2824883005: [Mojo Video Capture] Stop service when last client disconnects. (Closed)
Patch Set: Incorporate suggestions from PatchSet #4 Created 3 years, 7 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 | « no previous file | media/capture/video/video_capture_system.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/capture/video/video_capture_device_client.h" 5 #include "media/capture/video/video_capture_device_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 if (last_captured_pixel_format_ != format.pixel_format) { 145 if (last_captured_pixel_format_ != format.pixel_format) {
146 OnLog("Pixel format: " + 146 OnLog("Pixel format: " +
147 media::VideoPixelFormatToString(format.pixel_format)); 147 media::VideoPixelFormatToString(format.pixel_format));
148 last_captured_pixel_format_ = format.pixel_format; 148 last_captured_pixel_format_ = format.pixel_format;
149 149
150 if (format.pixel_format == media::PIXEL_FORMAT_MJPEG && 150 if (format.pixel_format == media::PIXEL_FORMAT_MJPEG &&
151 !external_jpeg_decoder_initialized_) { 151 !external_jpeg_decoder_initialized_) {
152 external_jpeg_decoder_initialized_ = true; 152 external_jpeg_decoder_initialized_ = true;
153 external_jpeg_decoder_ = jpeg_decoder_factory_callback_.Run(); 153 external_jpeg_decoder_ = jpeg_decoder_factory_callback_.Run();
154 external_jpeg_decoder_->Initialize(); 154 if (external_jpeg_decoder_)
155 external_jpeg_decoder_->Initialize();
155 } 156 }
156 } 157 }
157 158
158 if (!format.IsValid()) 159 if (!format.IsValid())
159 return; 160 return;
160 161
161 if (format.pixel_format == media::PIXEL_FORMAT_Y16) { 162 if (format.pixel_format == media::PIXEL_FORMAT_Y16) {
162 return OnIncomingCapturedY16Data(data, length, format, reference_time, 163 return OnIncomingCapturedY16Data(data, length, format, reference_time,
163 timestamp, frame_feedback_id); 164 timestamp, frame_feedback_id);
164 } 165 }
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 auto buffer_access = buffer.handle_provider->GetHandleForInProcessAccess(); 477 auto buffer_access = buffer.handle_provider->GetHandleForInProcessAccess();
477 memcpy(buffer_access->data(), data, length); 478 memcpy(buffer_access->data(), data, length);
478 const VideoCaptureFormat output_format = 479 const VideoCaptureFormat output_format =
479 VideoCaptureFormat(format.frame_size, format.frame_rate, 480 VideoCaptureFormat(format.frame_size, format.frame_rate,
480 media::PIXEL_FORMAT_Y16, media::PIXEL_STORAGE_CPU); 481 media::PIXEL_FORMAT_Y16, media::PIXEL_STORAGE_CPU);
481 OnIncomingCapturedBuffer(std::move(buffer), output_format, reference_time, 482 OnIncomingCapturedBuffer(std::move(buffer), output_format, reference_time,
482 timestamp); 483 timestamp);
483 } 484 }
484 485
485 } // namespace media 486 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/capture/video/video_capture_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698