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

Unified Diff: media/filters/stream_parser_factory.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/stream_parser_factory.h ('k') | media/filters/video_decoder_selector_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/stream_parser_factory.cc
diff --git a/media/filters/stream_parser_factory.cc b/media/filters/stream_parser_factory.cc
index 26325f3d822b1ac198b414e3010de517d082c787..772d1e57cc44a1fd2043639dc0dd28f5975ad7c4 100644
--- a/media/filters/stream_parser_factory.cc
+++ b/media/filters/stream_parser_factory.cc
@@ -35,9 +35,8 @@
namespace media {
-typedef bool (*CodecIDValidatorFunction)(
- const std::string& codecs_id,
- const scoped_refptr<MediaLog>& media_log);
+typedef bool (*CodecIDValidatorFunction)(const std::string& codecs_id,
+ MediaLog* media_log);
struct CodecInfo {
enum Type {
@@ -73,7 +72,7 @@ struct CodecInfo {
typedef StreamParser* (*ParserFactoryFunction)(
const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log);
+ MediaLog* media_log);
struct SupportedTypeInfo {
const char* type;
@@ -103,13 +102,13 @@ static const CodecInfo* kAudioWebMCodecs[] = {
};
static StreamParser* BuildWebMParser(const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
return new WebMStreamParser();
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
bool CheckIfMp4Vp9DemuxingEnabled(const std::string& codec_id,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableVp9InMp4);
}
@@ -120,7 +119,7 @@ static const int kAACSBRObjectType = 5;
static const int kAACPSObjectType = 29;
static int GetMP4AudioObjectType(const std::string& codec_id,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
// From RFC 6381 section 3.3 (ISO Base Media File Format Name Space):
// When the first element of a ['codecs' parameter value] is 'mp4a' ...,
// the second element is a hexadecimal representation of the MP4 Registration
@@ -143,8 +142,7 @@ static int GetMP4AudioObjectType(const std::string& codec_id,
return -1;
}
-bool ValidateMP4ACodecID(const std::string& codec_id,
- const scoped_refptr<MediaLog>& media_log) {
+bool ValidateMP4ACodecID(const std::string& codec_id, MediaLog* media_log) {
int audio_object_type = GetMP4AudioObjectType(codec_id, media_log);
if (audio_object_type == kAACLCObjectType ||
audio_object_type == kAACSBRObjectType ||
@@ -237,7 +235,7 @@ static const CodecInfo* kAudioMP4Codecs[] = {&kMPEG4AACCodecInfo,
NULL};
static StreamParser* BuildMP4Parser(const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
std::set<int> audio_object_types;
bool has_sbr = false;
@@ -281,7 +279,7 @@ static const CodecInfo* kAudioMP3Codecs[] = {
};
static StreamParser* BuildMP3Parser(const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
return new MPEG1AudioStreamParser();
}
@@ -293,7 +291,7 @@ static const CodecInfo* kAudioADTSCodecs[] = {
};
static StreamParser* BuildADTSParser(const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
return new ADTSStreamParser();
}
@@ -317,7 +315,7 @@ static const CodecInfo* kVideoMP2TCodecs[] = {&kH264AVC1CodecInfo,
NULL};
static StreamParser* BuildMP2TParser(const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
bool has_sbr = false;
for (size_t i = 0; i < codecs.size(); ++i) {
std::string codec_id = codecs[i];
@@ -404,7 +402,7 @@ static bool VerifyCodec(
static bool CheckTypeAndCodecs(
const std::string& type,
const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log,
+ MediaLog* media_log,
ParserFactoryFunction* factory_function,
std::vector<CodecInfo::HistogramTag>* audio_codecs,
std::vector<CodecInfo::HistogramTag>* video_codecs) {
@@ -464,14 +462,17 @@ static bool CheckTypeAndCodecs(
}
bool StreamParserFactory::IsTypeSupported(
- const std::string& type, const std::vector<std::string>& codecs) {
- return CheckTypeAndCodecs(type, codecs, new MediaLog(), NULL, NULL, NULL);
+ const std::string& type,
+ const std::vector<std::string>& codecs) {
+ // TODO(wolenetz): Questionable MediaLog usage, http://crbug.com/712310
+ MediaLog media_log;
+ return CheckTypeAndCodecs(type, codecs, &media_log, NULL, NULL, NULL);
}
std::unique_ptr<StreamParser> StreamParserFactory::Create(
const std::string& type,
const std::vector<std::string>& codecs,
- const scoped_refptr<MediaLog>& media_log) {
+ MediaLog* media_log) {
std::unique_ptr<StreamParser> stream_parser;
ParserFactoryFunction factory_function;
std::vector<CodecInfo::HistogramTag> audio_codecs;
« no previous file with comments | « media/filters/stream_parser_factory.h ('k') | media/filters/video_decoder_selector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698