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

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 1921803002: Avoid unnecessary post task during frame delivery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 4 years, 8 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 (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 #include "media/filters/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 FFmpegGlue::InitializeFFmpeg(); 187 FFmpegGlue::InitializeFFmpeg();
188 config_ = config; 188 config_ = config;
189 189
190 // TODO(xhwang): Only set |config_| after we successfully configure the 190 // TODO(xhwang): Only set |config_| after we successfully configure the
191 // decoder. 191 // decoder.
192 if (!ConfigureDecoder(low_delay)) { 192 if (!ConfigureDecoder(low_delay)) {
193 bound_init_cb.Run(false); 193 bound_init_cb.Run(false);
194 return; 194 return;
195 } 195 }
196 196
197 output_cb_ = BindToCurrentLoop(output_cb); 197 output_cb_ = output_cb;
198 198
199 // Success! 199 // Success!
200 state_ = kNormal; 200 state_ = kNormal;
201 bound_init_cb.Run(true); 201 bound_init_cb.Run(true);
202 } 202 }
203 203
204 void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, 204 void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
205 const DecodeCB& decode_cb) { 205 const DecodeCB& decode_cb) {
206 DCHECK(thread_checker_.CalledOnValidThread()); 206 DCHECK(thread_checker_.CalledOnValidThread());
207 DCHECK(buffer.get()); 207 DCHECK(buffer.get());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 374 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
375 ReleaseFFmpegResources(); 375 ReleaseFFmpegResources();
376 return false; 376 return false;
377 } 377 }
378 378
379 av_frame_.reset(av_frame_alloc()); 379 av_frame_.reset(av_frame_alloc());
380 return true; 380 return true;
381 } 381 }
382 382
383 } // namespace media 383 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698