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

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

Issue 57403003: Remove EMPTY from VideoFrame::Format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vframe_rgb
Patch Set: Created 7 years, 1 month 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 CHECK(decode_cb_.is_null()) << "Overlapping decodes are not supported."; 158 CHECK(decode_cb_.is_null()) << "Overlapping decodes are not supported.";
159 decode_cb_ = BindToCurrentLoop(decode_cb); 159 decode_cb_ = BindToCurrentLoop(decode_cb);
160 160
161 if (state_ == kError) { 161 if (state_ == kError) {
162 base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL); 162 base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL);
163 return; 163 return;
164 } 164 }
165 165
166 // Return empty frames if decoding has finished. 166 // Return empty frames if decoding has finished.
167 if (state_ == kDecodeFinished) { 167 if (state_ == kDecodeFinished) {
168 base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEmptyFrame()); 168 base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEOSFrame());
169 return; 169 return;
170 } 170 }
171 171
172 DecodeBuffer(buffer); 172 DecodeBuffer(buffer);
173 } 173 }
174 174
175 void FFmpegVideoDecoder::Reset(const base::Closure& closure) { 175 void FFmpegVideoDecoder::Reset(const base::Closure& closure) {
176 DCHECK(message_loop_->BelongsToCurrentThread()); 176 DCHECK(message_loop_->BelongsToCurrentThread());
177 DCHECK(reset_cb_.is_null()); 177 DCHECK(reset_cb_.is_null());
178 reset_cb_ = BindToCurrentLoop(closure); 178 reset_cb_ = BindToCurrentLoop(closure);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 state_ = kError; 264 state_ = kError;
265 base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL); 265 base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL);
266 return; 266 return;
267 } 267 }
268 268
269 if (!video_frame.get()) { 269 if (!video_frame.get()) {
270 if (state_ == kFlushCodec) { 270 if (state_ == kFlushCodec) {
271 DCHECK(buffer->end_of_stream()); 271 DCHECK(buffer->end_of_stream());
272 state_ = kDecodeFinished; 272 state_ = kDecodeFinished;
273 base::ResetAndReturn(&decode_cb_) 273 base::ResetAndReturn(&decode_cb_)
274 .Run(kOk, VideoFrame::CreateEmptyFrame()); 274 .Run(kOk, VideoFrame::CreateEOSFrame());
275 return; 275 return;
276 } 276 }
277 277
278 base::ResetAndReturn(&decode_cb_).Run(kNotEnoughData, NULL); 278 base::ResetAndReturn(&decode_cb_).Run(kNotEnoughData, NULL);
279 return; 279 return;
280 } 280 }
281 281
282 base::ResetAndReturn(&decode_cb_).Run(kOk, video_frame); 282 base::ResetAndReturn(&decode_cb_).Run(kOk, video_frame);
283 } 283 }
284 284
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 379 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
380 ReleaseFFmpegResources(); 380 ReleaseFFmpegResources();
381 return false; 381 return false;
382 } 382 }
383 383
384 av_frame_.reset(avcodec_alloc_frame()); 384 av_frame_.reset(avcodec_alloc_frame());
385 return true; 385 return true;
386 } 386 }
387 387
388 } // namespace media 388 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/fake_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