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

Side by Side Diff: media/filters/decoder_stream_traits.h

Issue 1954633002: MEDIA_LOG for large encoded timestamp gaps in decoder stream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 6 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 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_FILTERS_DECODER_STREAM_TRAITS_H_ 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
6 #define MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ 6 #define MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
7 7
8 #include "media/base/cdm_context.h" 8 #include "media/base/cdm_context.h"
9 #include "media/base/demuxer_stream.h" 9 #include "media/base/demuxer_stream.h"
10 #include "media/base/pipeline_status.h" 10 #include "media/base/pipeline_status.h"
11 #include "media/filters/audio_timestamp_validator.h"
11 12
12 namespace media { 13 namespace media {
13 14
14 class AudioBuffer; 15 class AudioBuffer;
15 class AudioDecoder; 16 class AudioDecoder;
16 class CdmContext; 17 class CdmContext;
17 class DecryptingAudioDecoder; 18 class DecryptingAudioDecoder;
18 class DecryptingVideoDecoder; 19 class DecryptingVideoDecoder;
19 class DemuxerStream; 20 class DemuxerStream;
20 class VideoDecoder; 21 class VideoDecoder;
21 class VideoFrame; 22 class VideoFrame;
22 23
23 template <DemuxerStream::Type StreamType> 24 template <DemuxerStream::Type StreamType>
24 struct DecoderStreamTraits {}; 25 class DecoderStreamTraits {};
25 26
26 template <> 27 template <>
27 struct DecoderStreamTraits<DemuxerStream::AUDIO> { 28 class MEDIA_EXPORT DecoderStreamTraits<DemuxerStream::AUDIO> {
29 public:
28 typedef AudioBuffer OutputType; 30 typedef AudioBuffer OutputType;
29 typedef AudioDecoder DecoderType; 31 typedef AudioDecoder DecoderType;
32 typedef AudioDecoderConfig ConfigType;
30 typedef DecryptingAudioDecoder DecryptingDecoderType; 33 typedef DecryptingAudioDecoder DecryptingDecoderType;
31 typedef base::Callback<void(bool success)> InitCB; 34 typedef base::Callback<void(bool success)> InitCB;
32 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; 35 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB;
33 36
37 explicit DecoderStreamTraits(const scoped_refptr<MediaLog>& media_log);
38
34 static std::string ToString(); 39 static std::string ToString();
35 static void InitializeDecoder(DecoderType* decoder, 40 void InitializeDecoder(DecoderType* decoder,
36 DemuxerStream* stream, 41 DemuxerStream* stream,
37 CdmContext* cdm_context, 42 CdmContext* cdm_context,
38 const InitCB& init_cb, 43 const InitCB& init_cb,
39 const OutputCB& output_cb); 44 const OutputCB& output_cb);
40 static bool NeedsBitstreamConversion(DecoderType* decoder); 45 static bool NeedsBitstreamConversion(DecoderType* decoder);
46 void OnDecode(const scoped_refptr<DecoderBuffer>& buffer);
47 void OnDecodeDone(const scoped_refptr<OutputType>& buffer);
48 void OnStreamReset(ConfigType config);
41 static void ReportStatistics(const StatisticsCB& statistics_cb, 49 static void ReportStatistics(const StatisticsCB& statistics_cb,
42 int bytes_decoded); 50 int bytes_decoded);
43 static scoped_refptr<OutputType> CreateEOSOutput(); 51 static scoped_refptr<OutputType> CreateEOSOutput();
52
53 private:
54 // Validates encoded timestamps match decoded output duration. MEDIA_LOG warns
55 // if timestamp gaps are detected. Sufficiently large gaps can lead to AV sync
56 // drift.
57 std::unique_ptr<AudioTimestampValidator> audio_ts_validator_;
58
59 scoped_refptr<MediaLog> media_log_;
44 }; 60 };
45 61
46 template <> 62 template <>
47 struct DecoderStreamTraits<DemuxerStream::VIDEO> { 63 class MEDIA_EXPORT DecoderStreamTraits<DemuxerStream::VIDEO> {
64 public:
48 typedef VideoFrame OutputType; 65 typedef VideoFrame OutputType;
49 typedef VideoDecoder DecoderType; 66 typedef VideoDecoder DecoderType;
67 typedef VideoDecoderConfig ConfigType;
50 typedef DecryptingVideoDecoder DecryptingDecoderType; 68 typedef DecryptingVideoDecoder DecryptingDecoderType;
51 typedef base::Callback<void(bool success)> InitCB; 69 typedef base::Callback<void(bool success)> InitCB;
52 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; 70 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB;
53 71
72 explicit DecoderStreamTraits(const scoped_refptr<MediaLog>& media_log);
73
54 static std::string ToString(); 74 static std::string ToString();
55 static void InitializeDecoder(DecoderType* decoder, 75 void InitializeDecoder(DecoderType* decoder,
56 DemuxerStream* stream, 76 DemuxerStream* stream,
57 CdmContext* cdm_context, 77 CdmContext* cdm_context,
58 const InitCB& init_cb, 78 const InitCB& init_cb,
59 const OutputCB& output_cb); 79 const OutputCB& output_cb);
60 static bool NeedsBitstreamConversion(DecoderType* decoder); 80 static bool NeedsBitstreamConversion(DecoderType* decoder);
81 void OnDecode(const scoped_refptr<DecoderBuffer>& buffer);
DaleCurtis 2016/06/22 01:19:24 If the compiler will let you get away with it, inl
chcunningham 2016/06/23 23:39:52 Done.
82 void OnDecodeDone(const scoped_refptr<OutputType>& buffer);
83 void OnStreamReset(ConfigType config);
61 static void ReportStatistics(const StatisticsCB& statistics_cb, 84 static void ReportStatistics(const StatisticsCB& statistics_cb,
62 int bytes_decoded); 85 int bytes_decoded);
63 static scoped_refptr<OutputType> CreateEOSOutput(); 86 static scoped_refptr<OutputType> CreateEOSOutput();
64 }; 87 };
65 88
66 } // namespace media 89 } // namespace media
67 90
68 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ 91 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698