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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 *video_frame = NULL; | 314 *video_frame = NULL; |
315 return false; | 315 return false; |
316 } | 316 } |
317 | 317 |
318 if (!av_frame_->opaque) { | 318 if (!av_frame_->opaque) { |
319 LOG(ERROR) << "VideoFrame object associated with frame data not set."; | 319 LOG(ERROR) << "VideoFrame object associated with frame data not set."; |
320 return false; | 320 return false; |
321 } | 321 } |
322 *video_frame = static_cast<VideoFrame*>(av_frame_->opaque); | 322 *video_frame = static_cast<VideoFrame*>(av_frame_->opaque); |
323 | 323 |
324 (*video_frame)->SetTimestamp( | 324 (*video_frame)->set_timestamp( |
325 base::TimeDelta::FromMicroseconds(av_frame_->reordered_opaque)); | 325 base::TimeDelta::FromMicroseconds(av_frame_->reordered_opaque)); |
326 | 326 |
327 return true; | 327 return true; |
328 } | 328 } |
329 | 329 |
330 void FFmpegVideoDecoder::ReleaseFFmpegResources() { | 330 void FFmpegVideoDecoder::ReleaseFFmpegResources() { |
331 codec_context_.reset(); | 331 codec_context_.reset(); |
332 av_frame_.reset(); | 332 av_frame_.reset(); |
333 } | 333 } |
334 | 334 |
(...skipping 18 matching lines...) Expand all Loading... |
353 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 353 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
354 ReleaseFFmpegResources(); | 354 ReleaseFFmpegResources(); |
355 return false; | 355 return false; |
356 } | 356 } |
357 | 357 |
358 av_frame_.reset(av_frame_alloc()); | 358 av_frame_.reset(av_frame_alloc()); |
359 return true; | 359 return true; |
360 } | 360 } |
361 | 361 |
362 } // namespace media | 362 } // namespace media |
OLD | NEW |