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

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

Issue 10165010: Add a media pipeline status error code for decryption error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revise comment and rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « media/base/pipeline_status.h ('k') | media/filters/ffmpeg_video_decoder_unittest.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 #include "media/filters/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // Any time Flush() is called. 279 // Any time Flush() is called.
280 280
281 // Transition to kFlushCodec on the first end of stream buffer. 281 // Transition to kFlushCodec on the first end of stream buffer.
282 if (state_ == kNormal && buffer->IsEndOfStream()) { 282 if (state_ == kNormal && buffer->IsEndOfStream()) {
283 state_ = kFlushCodec; 283 state_ = kFlushCodec;
284 } 284 }
285 285
286 scoped_refptr<Buffer> unencrypted_buffer = buffer; 286 scoped_refptr<Buffer> unencrypted_buffer = buffer;
287 if (buffer->GetDecryptConfig() && buffer->GetDataSize()) { 287 if (buffer->GetDecryptConfig() && buffer->GetDataSize()) {
288 unencrypted_buffer = decryptor_.Decrypt(buffer); 288 unencrypted_buffer = decryptor_.Decrypt(buffer);
289 // TODO(xhwang): Add a decryption error code, see http://crbug.com/121177
290 if (!unencrypted_buffer || !unencrypted_buffer->GetDataSize()) { 289 if (!unencrypted_buffer || !unencrypted_buffer->GetDataSize()) {
291 state_ = kDecodeFinished; 290 state_ = kDecodeFinished;
292 DeliverFrame(VideoFrame::CreateEmptyFrame()); 291 DeliverFrame(VideoFrame::CreateEmptyFrame());
293 host()->SetError(PIPELINE_ERROR_DECODE); 292 host()->SetError(PIPELINE_ERROR_DECRYPT);
294 return; 293 return;
295 } 294 }
296 } 295 }
297 296
298 scoped_refptr<VideoFrame> video_frame; 297 scoped_refptr<VideoFrame> video_frame;
299 if (!Decode(unencrypted_buffer, &video_frame)) { 298 if (!Decode(unencrypted_buffer, &video_frame)) {
300 state_ = kDecodeFinished; 299 state_ = kDecodeFinished;
301 DeliverFrame(VideoFrame::CreateEmptyFrame()); 300 DeliverFrame(VideoFrame::CreateEmptyFrame());
302 host()->SetError(PIPELINE_ERROR_DECODE); 301 host()->SetError(PIPELINE_ERROR_DECODE);
303 return; 302 return;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 scoped_refptr<VideoFrame> FFmpegVideoDecoder::AllocateVideoFrame() { 444 scoped_refptr<VideoFrame> FFmpegVideoDecoder::AllocateVideoFrame() {
446 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context_->pix_fmt); 445 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context_->pix_fmt);
447 size_t width = codec_context_->width; 446 size_t width = codec_context_->width;
448 size_t height = codec_context_->height; 447 size_t height = codec_context_->height;
449 448
450 return VideoFrame::CreateFrame(format, width, height, 449 return VideoFrame::CreateFrame(format, width, height,
451 kNoTimestamp(), kNoTimestamp()); 450 kNoTimestamp(), kNoTimestamp());
452 } 451 }
453 452
454 } // namespace media 453 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_status.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698