forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get the name of external cameras from vendor tags.
If the information is available in the vendor tags, we will 1. set the display name to the webcam model name instead "External Camera". 2. set the model id to USB "vendor_id:product_id". Bug: b:131142270, chromium:939996, b:117816888, b:80502887 Test: With CL:1583571 and CL:1583572, 1. check the model name is shown on https://webrtc.github.io/samples/src/content/devices/input-output/ 2. check IPEVO Presenter works with the IPEVO document camera. Without that two CLs, check the name is falled back to "External Camera" as expected. Passes capture_unittests. Change-Id: I469327b1b224689ebb698278505aee68a2fb88a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1594388 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Ricky Liang <jcliang@chromium.org> Reviewed-by: Dan Sanders <sandersd@chromium.org> Commit-Queue: Shik Chen <shik@chromium.org> Auto-Submit: Shik Chen <shik@chromium.org> Cr-Commit-Position: refs/heads/master@{#659423}
- Loading branch information
Shik Chen
authored and
Commit Bot
committed
May 14, 2019
1 parent
ec406c2
commit 78ec89e
Showing
13 changed files
with
491 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "media/capture/video/chromeos/mock_vendor_tag_ops.h" | ||
|
||
#include "base/bind.h" | ||
#include "base/logging.h" | ||
#include "base/synchronization/waitable_event.h" | ||
|
||
namespace media { | ||
namespace unittest_internal { | ||
|
||
MockVendorTagOps::MockVendorTagOps() | ||
: mock_vendor_tag_ops_thread_("MockVendorTagOpsThread"), binding_(this) { | ||
CHECK(mock_vendor_tag_ops_thread_.Start()); | ||
} | ||
|
||
MockVendorTagOps::~MockVendorTagOps() { | ||
mock_vendor_tag_ops_thread_.task_runner()->PostTask( | ||
FROM_HERE, base::BindOnce(&MockVendorTagOps::CloseBindingOnThread, | ||
base::Unretained(this))); | ||
mock_vendor_tag_ops_thread_.Stop(); | ||
} | ||
|
||
void MockVendorTagOps::Bind(cros::mojom::VendorTagOpsRequest request) { | ||
base::WaitableEvent done(base::WaitableEvent::ResetPolicy::MANUAL, | ||
base::WaitableEvent::InitialState::NOT_SIGNALED); | ||
cros::mojom::CameraModulePtrInfo ptr_info; | ||
mock_vendor_tag_ops_thread_.task_runner()->PostTask( | ||
FROM_HERE, | ||
base::BindOnce(&MockVendorTagOps::BindOnThread, base::Unretained(this), | ||
base::Unretained(&done), std::move(request))); | ||
done.Wait(); | ||
} | ||
|
||
void MockVendorTagOps::GetTagCount(GetTagCountCallback callback) { | ||
std::move(callback).Run(DoGetTagCount()); | ||
} | ||
|
||
void MockVendorTagOps::GetAllTags(GetAllTagsCallback callback) { | ||
std::move(callback).Run(DoGetAllTags()); | ||
} | ||
|
||
void MockVendorTagOps::GetSectionName(uint32_t tag, | ||
GetSectionNameCallback callback) { | ||
std::move(callback).Run(DoGetSectionName(tag)); | ||
} | ||
|
||
void MockVendorTagOps::GetTagName(uint32_t tag, GetTagNameCallback callback) { | ||
std::move(callback).Run(DoGetTagName(tag)); | ||
} | ||
|
||
void MockVendorTagOps::CloseBindingOnThread() { | ||
if (binding_.is_bound()) { | ||
binding_.Close(); | ||
} | ||
} | ||
|
||
void MockVendorTagOps::BindOnThread(base::WaitableEvent* done, | ||
cros::mojom::VendorTagOpsRequest request) { | ||
binding_.Bind(std::move(request)); | ||
done->Signal(); | ||
} | ||
|
||
} // namespace unittest_internal | ||
} // namespace media |
Oops, something went wrong.