blob: a52919cde30b102b61aa6d00735bb11e0bfdc6b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright 2015 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/base/android/media_task_runner.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "base/threading/thread.h"
#include "media/base/media_switches.h"
namespace media {
class MediaThread : public base::Thread {
public:
MediaThread() : base::Thread("BrowserMediaThread") {
Start();
}
};
// Create media thread
base::LazyInstance<MediaThread>::Leaky g_media_thread =
LAZY_INSTANCE_INITIALIZER;
scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner() {
return g_media_thread.Pointer()->task_runner();
}
bool UseMediaThreadForMediaPlayback() {
const std::string group_name =
base::FieldTrialList::FindFullName("EnableMediaThreadForMediaPlayback");
if (base::CommandLine::ForCurrentProcess()->
HasSwitch(switches::kEnableMediaThreadForMediaPlayback)) {
return true;
}
return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
}
} // namespace media
|