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

Side by Side Diff: testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "media/formats/mp2t/es_parser_mpeg1audio.h" 11 #include "media/formats/mp2t/es_parser_mpeg1audio.h"
12 12
13 class NullMediaLog : public media::MediaLog { 13 class NullMediaLog : public media::MediaLog {
14 public: 14 public:
15 NullMediaLog() {} 15 NullMediaLog() {}
16 ~NullMediaLog() override {}
16 17
17 void DoAddEventLogString(const std::string& event) {}
18 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {} 18 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {}
19 19
20 protected:
21 virtual ~NullMediaLog() {}
22
23 private: 20 private:
24 DISALLOW_COPY_AND_ASSIGN(NullMediaLog); 21 DISALLOW_COPY_AND_ASSIGN(NullMediaLog);
25 }; 22 };
26 23
27 static void NewAudioConfig(const media::AudioDecoderConfig& config) {} 24 static void NewAudioConfig(const media::AudioDecoderConfig& config) {}
28 static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {} 25 static void EmitBuffer(scoped_refptr<media::StreamParserBuffer> buffer) {}
29 26
30 // Entry point for LibFuzzer. 27 // Entry point for LibFuzzer.
31 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
32 scoped_refptr<NullMediaLog> media_log(new NullMediaLog()); 29 NullMediaLog media_log;
33 media::mp2t::EsParserMpeg1Audio es_parser(base::Bind(&NewAudioConfig), 30 media::mp2t::EsParserMpeg1Audio es_parser(
34 base::Bind(&EmitBuffer), media_log); 31 base::Bind(&NewAudioConfig), base::Bind(&EmitBuffer), &media_log);
35 if (!es_parser.Parse(data, size, media::kNoTimestamp, 32 if (es_parser.Parse(data, size, media::kNoTimestamp,
36 media::kNoDecodeTimestamp())) { 33 media::kNoDecodeTimestamp())) {
37 return 0; 34 es_parser.Flush();
38 } 35 }
39 es_parser.Flush();
40 return 0; 36 return 0;
41 } 37 }
OLDNEW
« no previous file with comments | « media/test/pipeline_integration_test_base.cc ('k') | testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698