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

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

Issue 2871263003: Set |config_| only after decoder has been successfully configured (Closed)
Patch Set: fixed unittests Created 3 years, 7 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 | « no previous file | media/filters/ffmpeg_audio_decoder.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FFMPEG_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void DoReset(); 84 void DoReset();
85 85
86 // Handles decoding an unencrypted encoded buffer. 86 // Handles decoding an unencrypted encoded buffer.
87 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer, 87 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer,
88 const DecodeCB& decode_cb); 88 const DecodeCB& decode_cb);
89 bool FFmpegDecode(const scoped_refptr<DecoderBuffer>& buffer, 89 bool FFmpegDecode(const scoped_refptr<DecoderBuffer>& buffer,
90 bool* has_produced_frame); 90 bool* has_produced_frame);
91 91
92 // Handles (re-)initializing the decoder with a (new) config. 92 // Handles (re-)initializing the decoder with a (new) config.
93 // Returns true if initialization was successful. 93 // Returns true if initialization was successful.
94 bool ConfigureDecoder(); 94 bool ConfigureDecoder(const AudioDecoderConfig& config);
95 95
96 // Releases resources associated with |codec_context_| and |av_frame_| 96 // Releases resources associated with |codec_context_| and |av_frame_|
97 // and resets them to NULL. 97 // and resets them to NULL.
98 void ReleaseFFmpegResources(); 98 void ReleaseFFmpegResources();
99 void ResetTimestampState(); 99 void ResetTimestampState(const AudioDecoderConfig& config);
100 100
101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
102 102
103 OutputCB output_cb_; 103 OutputCB output_cb_;
104 104
105 DecoderState state_; 105 DecoderState state_;
106 106
107 // FFmpeg structures owned by this object. 107 // FFmpeg structures owned by this object.
108 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 108 std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
109 std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 109 std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
110 110
111 AudioDecoderConfig config_; 111 AudioDecoderConfig config_;
112 112
113 // AVSampleFormat initially requested; not Chrome's SampleFormat. 113 // AVSampleFormat initially requested; not Chrome's SampleFormat.
114 int av_sample_format_; 114 int av_sample_format_;
115 115
116 std::unique_ptr<AudioDiscardHelper> discard_helper_; 116 std::unique_ptr<AudioDiscardHelper> discard_helper_;
117 117
118 MediaLog* media_log_; 118 MediaLog* media_log_;
119 119
120 scoped_refptr<AudioBufferMemoryPool> pool_; 120 scoped_refptr<AudioBufferMemoryPool> pool_;
121 121
122 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); 122 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
123 }; 123 };
124 124
125 } // namespace media 125 } // namespace media
126 126
127 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 127 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698