OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.h" | 5 #include "media/cdm/ppapi/external_clear_key/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" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 av_init_packet(&packet); | 219 av_init_packet(&packet); |
220 | 220 |
221 // The FFmpeg API does not allow us to have const read-only pointers. | 221 // The FFmpeg API does not allow us to have const read-only pointers. |
222 packet.data = const_cast<uint8_t*>(compressed_frame); | 222 packet.data = const_cast<uint8_t*>(compressed_frame); |
223 packet.size = compressed_frame_size; | 223 packet.size = compressed_frame_size; |
224 | 224 |
225 // Let FFmpeg handle presentation timestamp reordering. | 225 // Let FFmpeg handle presentation timestamp reordering. |
226 codec_context_->reordered_opaque = timestamp; | 226 codec_context_->reordered_opaque = timestamp; |
227 | 227 |
228 // Reset frame to default values. | 228 // Reset frame to default values. |
229 avcodec_get_frame_defaults(av_frame_.get()); | 229 av_frame_unref(av_frame_.get()); |
230 | 230 |
231 // This is for codecs not using get_buffer to initialize | 231 // This is for codecs not using get_buffer to initialize |
232 // |av_frame_->reordered_opaque| | 232 // |av_frame_->reordered_opaque| |
233 av_frame_->reordered_opaque = codec_context_->reordered_opaque; | 233 av_frame_->reordered_opaque = codec_context_->reordered_opaque; |
234 | 234 |
235 int frame_decoded = 0; | 235 int frame_decoded = 0; |
236 int result = avcodec_decode_video2(codec_context_.get(), | 236 int result = avcodec_decode_video2(codec_context_.get(), |
237 av_frame_.get(), | 237 av_frame_.get(), |
238 &frame_decoded, | 238 &frame_decoded, |
239 &packet); | 239 &packet); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 330 } |
331 | 331 |
332 void FFmpegCdmVideoDecoder::ReleaseFFmpegResources() { | 332 void FFmpegCdmVideoDecoder::ReleaseFFmpegResources() { |
333 DVLOG(1) << "ReleaseFFmpegResources()"; | 333 DVLOG(1) << "ReleaseFFmpegResources()"; |
334 | 334 |
335 codec_context_.reset(); | 335 codec_context_.reset(); |
336 av_frame_.reset(); | 336 av_frame_.reset(); |
337 } | 337 } |
338 | 338 |
339 } // namespace media | 339 } // namespace media |
OLD | NEW |