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

Side by Side Diff: media/filters/ffmpeg_video_decoder.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 months 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
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (opaque) 106 if (opaque)
107 static_cast<VideoFrame*>(opaque)->Release(); 107 static_cast<VideoFrame*>(opaque)->Release();
108 } 108 }
109 109
110 // static 110 // static
111 bool FFmpegVideoDecoder::IsCodecSupported(VideoCodec codec) { 111 bool FFmpegVideoDecoder::IsCodecSupported(VideoCodec codec) {
112 FFmpegGlue::InitializeFFmpeg(); 112 FFmpegGlue::InitializeFFmpeg();
113 return avcodec_find_decoder(VideoCodecToCodecID(codec)) != nullptr; 113 return avcodec_find_decoder(VideoCodecToCodecID(codec)) != nullptr;
114 } 114 }
115 115
116 FFmpegVideoDecoder::FFmpegVideoDecoder(scoped_refptr<MediaLog> media_log) 116 FFmpegVideoDecoder::FFmpegVideoDecoder(MediaLog* media_log)
117 : media_log_(std::move(media_log)), 117 : media_log_(media_log), state_(kUninitialized), decode_nalus_(false) {
118 state_(kUninitialized),
119 decode_nalus_(false) {
120 thread_checker_.DetachFromThread(); 118 thread_checker_.DetachFromThread();
121 } 119 }
122 120
123 int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context, 121 int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
124 AVFrame* frame, 122 AVFrame* frame,
125 int flags) { 123 int flags) {
126 // Don't use |codec_context_| here! With threaded decoding, 124 // Don't use |codec_context_| here! With threaded decoding,
127 // it will contain unsynchronized width/height/pix_fmt values, 125 // it will contain unsynchronized width/height/pix_fmt values,
128 // whereas |codec_context| contains the current threads's 126 // whereas |codec_context| contains the current threads's
129 // updated width/height/pix_fmt, which can change for adaptive 127 // updated width/height/pix_fmt, which can change for adaptive
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 432 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
435 ReleaseFFmpegResources(); 433 ReleaseFFmpegResources();
436 return false; 434 return false;
437 } 435 }
438 436
439 av_frame_.reset(av_frame_alloc()); 437 av_frame_.reset(av_frame_alloc());
440 return true; 438 return true;
441 } 439 }
442 440
443 } // namespace media 441 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698