| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 video_frame.swap(reinterpret_cast<VideoFrame**>(&opaque)); | 208 video_frame.swap(reinterpret_cast<VideoFrame**>(&opaque)); |
| 209 frame->buf[0] = | 209 frame->buf[0] = |
| 210 av_buffer_create(frame->data[0], | 210 av_buffer_create(frame->data[0], |
| 211 VideoFrame::AllocationSize(format, coded_size), | 211 VideoFrame::AllocationSize(format, coded_size), |
| 212 ReleaseVideoBufferImpl, | 212 ReleaseVideoBufferImpl, |
| 213 opaque, | 213 opaque, |
| 214 0); | 214 0); |
| 215 return 0; | 215 return 0; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void FFmpegVideoDecoder::SetVideoFramePoolDelegate( |
| 219 std::unique_ptr<VideoFramePoolDelegate> delegate) { |
| 220 frame_pool_.SetDelegate(std::move(delegate)); |
| 221 } |
| 222 |
| 218 std::string FFmpegVideoDecoder::GetDisplayName() const { | 223 std::string FFmpegVideoDecoder::GetDisplayName() const { |
| 219 return "FFmpegVideoDecoder"; | 224 return "FFmpegVideoDecoder"; |
| 220 } | 225 } |
| 221 | 226 |
| 222 void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config, | 227 void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config, |
| 223 bool low_delay, | 228 bool low_delay, |
| 224 CdmContext* /* cdm_context */, | 229 CdmContext* /* cdm_context */, |
| 225 const InitCB& init_cb, | 230 const InitCB& init_cb, |
| 226 const OutputCB& output_cb) { | 231 const OutputCB& output_cb) { |
| 227 DCHECK(thread_checker_.CalledOnValidThread()); | 232 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 431 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 427 ReleaseFFmpegResources(); | 432 ReleaseFFmpegResources(); |
| 428 return false; | 433 return false; |
| 429 } | 434 } |
| 430 | 435 |
| 431 av_frame_.reset(av_frame_alloc()); | 436 av_frame_.reset(av_frame_alloc()); |
| 432 return true; | 437 return true; |
| 433 } | 438 } |
| 434 | 439 |
| 435 } // namespace media | 440 } // namespace media |
| OLD | NEW |