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

Side by Side Diff: webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.cc

Issue 11260007: Add FFmpeg audio decoder for the clear key CDM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor changes to make things work. Created 8 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 | 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 "webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h" 5 #include "webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "media/base/buffers.h" 9 #include "media/base/buffers.h"
10 #include "media/base/limits.h" 10 #include "media/base/limits.h"
11 #include "media/ffmpeg/ffmpeg_common.h"
12 #include "webkit/media/crypto/ppapi/content_decryption_module.h" 11 #include "webkit/media/crypto/ppapi/content_decryption_module.h"
13 12
14 // Include FFmpeg header files. 13 // Include FFmpeg header files.
15 extern "C" { 14 extern "C" {
16 // Temporarily disable possible loss of data warning. 15 // Temporarily disable possible loss of data warning.
17 MSVC_PUSH_DISABLE_WARNING(4244); 16 MSVC_PUSH_DISABLE_WARNING(4244);
18 #include <libavcodec/avcodec.h> 17 #include <libavcodec/avcodec.h>
19 MSVC_POP_WARNING(); 18 MSVC_POP_WARNING();
20 } // extern "C" 19 } // extern "C"
21 20
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (!IsValidOutputConfig(config.format, config.coded_size)) { 117 if (!IsValidOutputConfig(config.format, config.coded_size)) {
119 LOG(ERROR) << "Initialize(): invalid video decoder configuration."; 118 LOG(ERROR) << "Initialize(): invalid video decoder configuration.";
120 return false; 119 return false;
121 } 120 }
122 121
123 if (is_initialized_) { 122 if (is_initialized_) {
124 LOG(ERROR) << "Initialize(): Already initialized."; 123 LOG(ERROR) << "Initialize(): Already initialized.";
125 return false; 124 return false;
126 } 125 }
127 126
128 av_register_all();
129
130 // Release existing resources if necessary.
131 ReleaseFFmpegResources();
ddorwin 2012/10/25 01:34:17 Do we not need this anymore? I don't see it being
Tom Finegan 2012/10/25 04:58:37 It's called in ~FFmpegCdmVideoDecoder() and Deinit
132
133 // Initialize AVCodecContext structure. 127 // Initialize AVCodecContext structure.
134 codec_context_ = avcodec_alloc_context3(NULL); 128 codec_context_ = avcodec_alloc_context3(NULL);
135 CdmVideoDecoderConfigToAVCodecContext(config, codec_context_); 129 CdmVideoDecoderConfigToAVCodecContext(config, codec_context_);
136 130
137 // Enable motion vector search (potentially slow), strong deblocking filter 131 // Enable motion vector search (potentially slow), strong deblocking filter
138 // for damaged macroblocks, and set our error detection sensitivity. 132 // for damaged macroblocks, and set our error detection sensitivity.
139 codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; 133 codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
140 codec_context_->err_recognition = AV_EF_CAREFUL; 134 codec_context_->err_recognition = AV_EF_CAREFUL;
141 codec_context_->thread_count = kDecodeThreads; 135 codec_context_->thread_count = kDecodeThreads;
142 codec_context_->opaque = this; 136 codec_context_->opaque = this;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 av_free(codec_context_); 306 av_free(codec_context_);
313 codec_context_ = NULL; 307 codec_context_ = NULL;
314 } 308 }
315 if (av_frame_) { 309 if (av_frame_) {
316 av_free(av_frame_); 310 av_free(av_frame_);
317 av_frame_ = NULL; 311 av_frame_ = NULL;
318 } 312 }
319 } 313 }
320 314
321 } // namespace webkit_media 315 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698