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

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

Issue 339653003: No EOS frame in {Audio|Video}Decoder::OutputCB. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 6 years, 6 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 | Annotate | Revision Log
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/vpx_video_decoder.h" 5 #include "media/filters/vpx_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 LOG(ERROR) << "vpx_codec_dec_init failed, status=" << status; 252 LOG(ERROR) << "vpx_codec_dec_init failed, status=" << status;
253 delete context; 253 delete context;
254 return NULL; 254 return NULL;
255 } 255 }
256 return context; 256 return context;
257 } 257 }
258 258
259 bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) { 259 bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) {
260 if (config.codec() != kCodecVP8 && config.codec() != kCodecVP9) 260 if (config.codec() != kCodecVP8 && config.codec() != kCodecVP9)
261 return false; 261 return false;
262 // Only VP8 videos with alpha are handled by VpxVideoDecoder. Everything else 262
263 // goes to FFmpegVideoDecoder. 263 // In VP8 videos, only those with alpha are handled by VpxVideoDecoder. All
264 // other VP8 videos go to FFmpegVideoDecoder.
264 if (config.codec() == kCodecVP8 && config.format() != VideoFrame::YV12A) 265 if (config.codec() == kCodecVP8 && config.format() != VideoFrame::YV12A)
265 return false; 266 return false;
266 267
267 CloseDecoder(); 268 CloseDecoder();
268 269
269 vpx_codec_ = InitializeVpxContext(vpx_codec_, config); 270 vpx_codec_ = InitializeVpxContext(vpx_codec_, config);
270 if (!vpx_codec_) 271 if (!vpx_codec_)
271 return false; 272 return false;
272 273
273 // We use our own buffers for VP9 so that there is no need to copy data after 274 // We use our own buffers for VP9 so that there is no need to copy data after
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 DCHECK(task_runner_->BelongsToCurrentThread()); 348 DCHECK(task_runner_->BelongsToCurrentThread());
348 DCHECK_NE(state_, kUninitialized); 349 DCHECK_NE(state_, kUninitialized);
349 DCHECK_NE(state_, kDecodeFinished); 350 DCHECK_NE(state_, kDecodeFinished);
350 DCHECK_NE(state_, kError); 351 DCHECK_NE(state_, kError);
351 DCHECK(!decode_cb_.is_null()); 352 DCHECK(!decode_cb_.is_null());
352 DCHECK(buffer); 353 DCHECK(buffer);
353 354
354 // Transition to kDecodeFinished on the first end of stream buffer. 355 // Transition to kDecodeFinished on the first end of stream buffer.
355 if (state_ == kNormal && buffer->end_of_stream()) { 356 if (state_ == kNormal && buffer->end_of_stream()) {
356 state_ = kDecodeFinished; 357 state_ = kDecodeFinished;
357 output_cb_.Run(VideoFrame::CreateEOSFrame());
358 base::ResetAndReturn(&decode_cb_).Run(kOk); 358 base::ResetAndReturn(&decode_cb_).Run(kOk);
359 return; 359 return;
360 } 360 }
361 361
362 scoped_refptr<VideoFrame> video_frame; 362 scoped_refptr<VideoFrame> video_frame;
363 if (!VpxDecode(buffer, &video_frame)) { 363 if (!VpxDecode(buffer, &video_frame)) {
364 state_ = kError; 364 state_ = kError;
365 base::ResetAndReturn(&decode_cb_).Run(kDecodeError); 365 base::ResetAndReturn(&decode_cb_).Run(kDecodeError);
366 return; 366 return;
367 } 367 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); 507 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get());
508 return; 508 return;
509 } 509 }
510 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], 510 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
511 vpx_image->stride[VPX_PLANE_Y], 511 vpx_image->stride[VPX_PLANE_Y],
512 vpx_image->d_h, 512 vpx_image->d_h,
513 video_frame->get()); 513 video_frame->get());
514 } 514 }
515 515
516 } // namespace media 516 } // namespace media
OLDNEW
« media/filters/ffmpeg_audio_decoder.h ('K') | « media/filters/video_renderer_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698