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

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

Issue 2428263004: 16 bpp video stream capture, render and createImageBitmap(video) using (CPU) shared memory buffers (Closed)
Patch Set: review #30 fix. Thanks danakj@. Created 4 years, 1 month 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_manager.h" 5 #include "content/browser/renderer_host/media/video_capture_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 if (formats->empty()) 82 if (formats->empty())
83 return; 83 return;
84 std::sort(formats->begin(), formats->end(), IsCaptureFormatSmaller); 84 std::sort(formats->begin(), formats->end(), IsCaptureFormatSmaller);
85 // Due to the ordering imposed, the largest frame_rate is kept while removing 85 // Due to the ordering imposed, the largest frame_rate is kept while removing
86 // duplicated resolutions. 86 // duplicated resolutions.
87 media::VideoCaptureFormats::iterator last = 87 media::VideoCaptureFormats::iterator last =
88 std::unique(formats->begin(), formats->end(), IsCaptureFormatSizeEqual); 88 std::unique(formats->begin(), formats->end(), IsCaptureFormatSizeEqual);
89 formats->erase(last, formats->end()); 89 formats->erase(last, formats->end());
90 // Mark all formats as I420, since this is what the renderer side will get 90 // Mark all formats as I420, since this is what the renderer side will get
91 // anyhow: the actual pixel format is decided at the device level. 91 // anyhow: the actual pixel format is decided at the device level.
92 // Don't do this for Y16 format as it is handled separatelly.
92 for (media::VideoCaptureFormats::iterator it = formats->begin(); 93 for (media::VideoCaptureFormats::iterator it = formats->begin();
93 it != formats->end(); ++it) { 94 it != formats->end(); ++it) {
94 it->pixel_format = media::PIXEL_FORMAT_I420; 95 if (it->pixel_format != media::PIXEL_FORMAT_Y16)
96 it->pixel_format = media::PIXEL_FORMAT_I420;
95 } 97 }
mcasas 2016/10/25 22:44:43 Ugh, old code! Suggestion: for (const auto form
aleksandar.stojiljkovic 2016/10/26 14:02:18 Thanks. Done.
96 } 98 }
97 99
98 // The maximum number of buffers in the capture pipeline. See 100 // The maximum number of buffers in the capture pipeline. See
99 // VideoCaptureController ctor comments for more details. 101 // VideoCaptureController ctor comments for more details.
100 const int kMaxNumberOfBuffers = 3; 102 const int kMaxNumberOfBuffers = 3;
101 // TODO(miu): The value for tab capture should be determined programmatically. 103 // TODO(miu): The value for tab capture should be determined programmatically.
102 // http://crbug.com/460318 104 // http://crbug.com/460318
103 const int kMaxNumberOfBuffersForTabCapture = 10; 105 const int kMaxNumberOfBuffersForTabCapture = 10;
104 106
105 // Used for logging capture events. 107 // Used for logging capture events.
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 if (!device_in_queue) { 1287 if (!device_in_queue) {
1286 // Session ID is only valid for Screen capture. So we can fake it to 1288 // Session ID is only valid for Screen capture. So we can fake it to
1287 // resume video capture devices here. 1289 // resume video capture devices here.
1288 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1290 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1289 } 1291 }
1290 } 1292 }
1291 } 1293 }
1292 #endif // defined(OS_ANDROID) 1294 #endif // defined(OS_ANDROID)
1293 1295
1294 } // namespace content 1296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698