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

Unified Diff: media/formats/mp2t/es_parser_test_base.h

Issue 399433003: Mpeg2 TS - Fail when no valid timestamp in the ADTS parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix rebase: do not set dts in adts parser. Created 6 years, 4 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/formats/mp2t/es_parser_h264_unittest.cc ('k') | media/formats/mp2t/es_parser_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp2t/es_parser_test_base.h
diff --git a/media/formats/mp2t/es_parser_test_base.h b/media/formats/mp2t/es_parser_test_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b18efac6f95a8cfb83b0a9b38e6c0d6379f82c1
--- /dev/null
+++ b/media/formats/mp2t/es_parser_test_base.h
@@ -0,0 +1,85 @@
+// Copyright 2014 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.
+
+#ifndef MEDIA_FORMATS_MP2T_ES_PARSER_TEST_BASE_H_
+#define MEDIA_FORMATS_MP2T_ES_PARSER_TEST_BASE_H_
+
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
+
+namespace media {
+class AudioDecoderConfig;
+class StreamParserBuffer;
+class VideoDecoderConfig;
+
+namespace mp2t {
+class EsParser;
+
+class EsParserTestBase {
+ public:
+ struct Packet {
+ Packet();
+
+ // Offset in the stream.
+ size_t offset;
+
+ // Size of the packet.
+ size_t size;
+
+ // Timestamp of the packet.
+ base::TimeDelta pts;
+ };
+
+ EsParserTestBase();
+ virtual ~EsParserTestBase();
+
+ protected:
+ void LoadStream(const char* filename);
+
+ // ES parser callbacks.
+ void NewAudioConfig(const AudioDecoderConfig& config);
+ void NewVideoConfig(const VideoDecoderConfig& config);
+ void EmitBuffer(scoped_refptr<StreamParserBuffer> buffer);
+
+ // Process the PES packets using the given ES parser.
+ // When |force_timing| is true, even the invalid negative timestamps will be
+ // given to the ES parser.
+ // Return true if successful, false otherwise.
+ bool ProcessPesPackets(EsParser* es_parser,
+ const std::vector<Packet>& pes_packets,
+ bool force_timing);
+
+ // Assume the offsets are known, compute the size of each packet.
+ // The last packet is assumed to cover the end of the stream.
+ // Packets are assumed to be in stream order.
+ void ComputePacketSize(std::vector<Packet>* packets);
+
+ // ES stream.
+ std::vector<uint8> stream_;
+
+ // Number of decoder configs received from the ES parser.
+ size_t config_count_;
+
+ // Number of buffers generated while parsing the ES stream.
+ size_t buffer_count_;
+
+ // Timestamps of buffers generated while parsing the ES stream.
+ std::string buffer_timestamps_;
+
+ private:
+ // Timestamps of buffers generated while parsing the ES stream.
+ std::stringstream buffer_timestamps_stream_;
+
+ DISALLOW_COPY_AND_ASSIGN(EsParserTestBase);
+};
+
+} // namespace mp2t
+} // namespace media
+
+#endif // MEDIA_FORMATS_MP2T_ES_PARSER_TEST_BASE_H_
« no previous file with comments | « media/formats/mp2t/es_parser_h264_unittest.cc ('k') | media/formats/mp2t/es_parser_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698