Fix super fast hash and blocking pool
This commit is contained in:
parent
7c8be94a6e
commit
37a321a601
1 changed files with 6 additions and 4 deletions
|
@ -14,6 +14,7 @@ using base::PlatformThreadRef;
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/task_scheduler/post_task.h"
|
||||||
#include "base/threading/sequenced_worker_pool.h"
|
#include "base/threading/sequenced_worker_pool.h"
|
||||||
#include "chrome/browser/media/desktop_media_list_observer.h"
|
#include "chrome/browser/media/desktop_media_list_observer.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
@ -28,6 +29,8 @@ using base::PlatformThreadRef;
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
using content::DesktopMediaID;
|
using content::DesktopMediaID;
|
||||||
|
|
||||||
|
extern "C" uint32_t SuperFastHash(const char* data, int len);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Update the list every second.
|
// Update the list every second.
|
||||||
|
@ -37,7 +40,7 @@ const int kDefaultUpdatePeriod = 1000;
|
||||||
// media source has changed.
|
// media source has changed.
|
||||||
uint32_t GetFrameHash(webrtc::DesktopFrame* frame) {
|
uint32_t GetFrameHash(webrtc::DesktopFrame* frame) {
|
||||||
int data_size = frame->stride() * frame->size().height();
|
int data_size = frame->stride() * frame->size().height();
|
||||||
return base::SuperFastHash(reinterpret_cast<char*>(frame->data()), data_size);
|
return SuperFastHash(reinterpret_cast<char*>(frame->data()), data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
|
gfx::ImageSkia ScaleDesktopFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
|
||||||
|
@ -235,9 +238,8 @@ NativeDesktopMediaList::NativeDesktopMediaList(
|
||||||
view_dialog_id_(-1),
|
view_dialog_id_(-1),
|
||||||
observer_(NULL),
|
observer_(NULL),
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool();
|
capture_task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
|
||||||
capture_task_runner_ = worker_pool->GetSequencedTaskRunner(
|
{base::MayBlock()});
|
||||||
worker_pool->GetSequenceToken());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeDesktopMediaList::~NativeDesktopMediaList() {
|
NativeDesktopMediaList::~NativeDesktopMediaList() {
|
||||||
|
|
Loading…
Reference in a new issue