OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/video/ffmpeg_video_decode_engine.h" | 5 #include "media/video/ffmpeg_video_decode_engine.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 config.height(), | 120 config.height(), |
121 kNoTimestamp, | 121 kNoTimestamp, |
122 kNoTimestamp, | 122 kNoTimestamp, |
123 &video_frame); | 123 &video_frame); |
124 if (!video_frame.get()) { | 124 if (!video_frame.get()) { |
125 buffer_allocated = false; | 125 buffer_allocated = false; |
126 break; | 126 break; |
127 } | 127 } |
128 frame_queue_available_.push_back(video_frame); | 128 frame_queue_available_.push_back(video_frame); |
129 } | 129 } |
130 | 130 codec_context_->thread_count = decode_threads; |
131 if (codec && | 131 if (codec && |
132 avcodec_thread_init(codec_context_, decode_threads) >= 0 && | |
133 avcodec_open(codec_context_, codec) >= 0 && | 132 avcodec_open(codec_context_, codec) >= 0 && |
134 av_frame_.get() && | 133 av_frame_.get() && |
135 buffer_allocated) { | 134 buffer_allocated) { |
136 info.success = true; | 135 info.success = true; |
137 } | 136 } |
138 event_handler_ = event_handler; | 137 event_handler_ = event_handler; |
139 event_handler_->OnInitializeComplete(info); | 138 event_handler_->OnInitializeComplete(info); |
140 } | 139 } |
141 | 140 |
142 // TODO(scherkus): Move this function to a utility class and unit test. | 141 // TODO(scherkus): Move this function to a utility class and unit test. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 break; | 356 break; |
358 } | 357 } |
359 return VideoFrame::INVALID; | 358 return VideoFrame::INVALID; |
360 } | 359 } |
361 | 360 |
362 } // namespace media | 361 } // namespace media |
363 | 362 |
364 // Disable refcounting for this object because this object only lives | 363 // Disable refcounting for this object because this object only lives |
365 // on the video decoder thread and there's no need to refcount it. | 364 // on the video decoder thread and there's no need to refcount it. |
366 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::FFmpegVideoDecodeEngine); | 365 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::FFmpegVideoDecodeEngine); |
OLD | NEW |