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

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: Rebase Created 4 years, 5 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/decoder_stream.cc ('k') | media/filters/decoder_stream_traits.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_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/base/video_decoder_config.h"
12 #include "media/filters/audio_timestamp_validator.h"
11 13
12 namespace media { 14 namespace media {
13 15
14 class AudioBuffer; 16 class AudioBuffer;
15 class AudioDecoder; 17 class AudioDecoder;
16 class CdmContext; 18 class CdmContext;
17 class DecryptingAudioDecoder; 19 class DecryptingAudioDecoder;
18 class DecryptingVideoDecoder; 20 class DecryptingVideoDecoder;
19 class DemuxerStream; 21 class DemuxerStream;
20 class VideoDecoder; 22 class VideoDecoder;
21 class VideoFrame; 23 class VideoFrame;
22 24
23 template <DemuxerStream::Type StreamType> 25 template <DemuxerStream::Type StreamType>
24 struct DecoderStreamTraits {}; 26 class DecoderStreamTraits {};
25 27
26 template <> 28 template <>
27 struct DecoderStreamTraits<DemuxerStream::AUDIO> { 29 class MEDIA_EXPORT DecoderStreamTraits<DemuxerStream::AUDIO> {
30 public:
28 typedef AudioBuffer OutputType; 31 typedef AudioBuffer OutputType;
29 typedef AudioDecoder DecoderType; 32 typedef AudioDecoder DecoderType;
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(DemuxerStream* stream);
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;
50 typedef DecryptingVideoDecoder DecryptingDecoderType; 67 typedef DecryptingVideoDecoder DecryptingDecoderType;
51 typedef base::Callback<void(bool success)> InitCB; 68 typedef base::Callback<void(bool success)> InitCB;
52 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; 69 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB;
53 70
71 explicit DecoderStreamTraits(const scoped_refptr<MediaLog>& media_log) {}
72
54 static std::string ToString(); 73 static std::string ToString();
55 static void InitializeDecoder(DecoderType* decoder, 74 void InitializeDecoder(DecoderType* decoder,
56 DemuxerStream* stream, 75 DemuxerStream* stream,
57 CdmContext* cdm_context, 76 CdmContext* cdm_context,
58 const InitCB& init_cb, 77 const InitCB& init_cb,
59 const OutputCB& output_cb); 78 const OutputCB& output_cb);
60 static bool NeedsBitstreamConversion(DecoderType* decoder); 79 static bool NeedsBitstreamConversion(DecoderType* decoder);
80 void OnDecode(const scoped_refptr<DecoderBuffer>& buffer) {}
81 void OnDecodeDone(const scoped_refptr<OutputType>& buffer) {}
82 void OnStreamReset(DemuxerStream* stream) {}
61 static void ReportStatistics(const StatisticsCB& statistics_cb, 83 static void ReportStatistics(const StatisticsCB& statistics_cb,
62 int bytes_decoded); 84 int bytes_decoded);
63 static scoped_refptr<OutputType> CreateEOSOutput(); 85 static scoped_refptr<OutputType> CreateEOSOutput();
64 }; 86 };
65 87
66 } // namespace media 88 } // namespace media
67 89
68 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ 90 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
OLDNEW
« no previous file with comments | « media/filters/decoder_stream.cc ('k') | media/filters/decoder_stream_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698