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

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

Issue 123213006: Make VideoDecoder use (kAborted, NULL) to signify an aborted decode, instead of (kOk, NULL). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 6 years, 11 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 void FFmpegVideoDecoder::Stop(const base::Closure& closure) { 194 void FFmpegVideoDecoder::Stop(const base::Closure& closure) {
195 DCHECK(task_runner_->BelongsToCurrentThread()); 195 DCHECK(task_runner_->BelongsToCurrentThread());
196 base::ScopedClosureRunner runner(BindToCurrentLoop(closure)); 196 base::ScopedClosureRunner runner(BindToCurrentLoop(closure));
197 197
198 if (state_ == kUninitialized) 198 if (state_ == kUninitialized)
199 return; 199 return;
200 200
201 if (!decode_cb_.is_null()) { 201 if (!decode_cb_.is_null()) {
202 base::ResetAndReturn(&decode_cb_).Run(kOk, NULL); 202 base::ResetAndReturn(&decode_cb_).Run(kAborted, NULL);
203 // Reset is pending only when decode is pending. 203 // Reset is pending only when decode is pending.
204 if (!reset_cb_.is_null()) 204 if (!reset_cb_.is_null())
205 base::ResetAndReturn(&reset_cb_).Run(); 205 base::ResetAndReturn(&reset_cb_).Run();
206 } 206 }
207 207
208 ReleaseFFmpegResources(); 208 ReleaseFFmpegResources();
209 state_ = kUninitialized; 209 state_ = kUninitialized;
210 } 210 }
211 211
212 FFmpegVideoDecoder::~FFmpegVideoDecoder() { 212 FFmpegVideoDecoder::~FFmpegVideoDecoder() {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 378 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
379 ReleaseFFmpegResources(); 379 ReleaseFFmpegResources();
380 return false; 380 return false;
381 } 381 }
382 382
383 av_frame_.reset(av_frame_alloc()); 383 av_frame_.reset(av_frame_alloc());
384 return true; 384 return true;
385 } 385 }
386 386
387 } // namespace media 387 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_video_decoder_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698