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

Side by Side Diff: media/formats/mp2t/es_parser_adts.h

Issue 2378443002: Fix MSE ADTS parsing on Android. (Closed)
Patch Set: Address comments. Created 4 years, 2 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
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/formats/mp2t/es_parser_adts.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_ 5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_
6 #define MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_ 6 #define MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "media/base/audio_decoder_config.h" 18 #include "media/base/audio_decoder_config.h"
19 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
20 #include "media/formats/mp2t/es_parser.h" 20 #include "media/formats/mp2t/es_parser.h"
21 #include "media/formats/mpeg/adts_stream_parser.h"
21 22
22 namespace media { 23 namespace media {
23 class AudioTimestampHelper; 24 class AudioTimestampHelper;
24 class BitReader; 25 class BitReader;
25 class OffsetByteQueue; 26 class OffsetByteQueue;
26 class StreamParserBuffer; 27 class StreamParserBuffer;
27 } 28 }
28 29
29 namespace media { 30 namespace media {
30 namespace mp2t { 31 namespace mp2t {
(...skipping 23 matching lines...) Expand all
54 // |adts_frame| structure is filled up accordingly. 55 // |adts_frame| structure is filled up accordingly.
55 // Returns false otherwise (no ADTS syncword found or partial ADTS frame). 56 // Returns false otherwise (no ADTS syncword found or partial ADTS frame).
56 bool LookForAdtsFrame(AdtsFrame* adts_frame); 57 bool LookForAdtsFrame(AdtsFrame* adts_frame);
57 58
58 // Skip an ADTS frame in the ES queue. 59 // Skip an ADTS frame in the ES queue.
59 void SkipAdtsFrame(const AdtsFrame& adts_frame); 60 void SkipAdtsFrame(const AdtsFrame& adts_frame);
60 61
61 // Signal any audio configuration change (if any). 62 // Signal any audio configuration change (if any).
62 // Return false if the current audio config is not 63 // Return false if the current audio config is not
63 // a supported ADTS audio config. 64 // a supported ADTS audio config.
64 bool UpdateAudioConfiguration(const uint8_t* adts_header); 65 bool UpdateAudioConfiguration(const uint8_t* adts_header, int size);
65 66
66 // Callbacks: 67 // Callbacks:
67 // - to signal a new audio configuration, 68 // - to signal a new audio configuration,
68 // - to send ES buffers. 69 // - to send ES buffers.
69 NewAudioConfigCB new_audio_config_cb_; 70 NewAudioConfigCB new_audio_config_cb_;
70 EmitBufferCB emit_buffer_cb_; 71 EmitBufferCB emit_buffer_cb_;
71 72
72 // True when AAC SBR extension is signalled in the mimetype 73 // True when AAC SBR extension is signalled in the mimetype
73 // (mp4a.40.5 in the codecs parameter). 74 // (mp4a.40.5 in the codecs parameter).
74 bool sbr_in_mimetype_; 75 bool sbr_in_mimetype_;
75 76
76 // Interpolated PTS for frames that don't have one. 77 // Interpolated PTS for frames that don't have one.
77 std::unique_ptr<AudioTimestampHelper> audio_timestamp_helper_; 78 std::unique_ptr<AudioTimestampHelper> audio_timestamp_helper_;
78 79
79 // Last audio config. 80 // Last audio config.
80 AudioDecoderConfig last_audio_decoder_config_; 81 AudioDecoderConfig last_audio_decoder_config_;
81 82
83 ADTSStreamParser adts_parser_;
84
82 DISALLOW_COPY_AND_ASSIGN(EsParserAdts); 85 DISALLOW_COPY_AND_ASSIGN(EsParserAdts);
83 }; 86 };
84 87
85 } // namespace mp2t 88 } // namespace mp2t
86 } // namespace media 89 } // namespace media
87 90
88 #endif // MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_ 91 #endif // MEDIA_FORMATS_MP2T_ES_PARSER_ADTS_H_
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/formats/mp2t/es_parser_adts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698