summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 10:58:01 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 10:58:01 +0000
commit6e8befe8bff0078fc36d46bddaeedb16db8492cf (patch)
tree61f9d25f05f3e384673b80355bbb12bb3acf8298 /media
parent417ed662043bbec5ecc7accbd9ece10a7ff28029 (diff)
downloadchromium_src-6e8befe8bff0078fc36d46bddaeedb16db8492cf.zip
chromium_src-6e8befe8bff0078fc36d46bddaeedb16db8492cf.tar.gz
chromium_src-6e8befe8bff0078fc36d46bddaeedb16db8492cf.tar.bz2
Initialize uninitialized members in a couple media classes.
BUG=None TEST=None CID=11311, 11977, 11976. Review URL: http://codereview.chromium.org/6730055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/video_renderer_base.cc2
-rw-r--r--media/video/ffmpeg_video_allocator.cc12
-rw-r--r--media/video/ffmpeg_video_allocator.h10
3 files changed, 16 insertions, 8 deletions
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index 493de69..1c39964 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -29,6 +29,8 @@ static const int kIdleMilliseconds = 10;
VideoRendererBase::VideoRendererBase()
: width_(0),
height_(0),
+ surface_format_(VideoFrame::INVALID),
+ surface_type_(VideoFrame::TYPE_SYSTEM_MEMORY),
frame_available_(&lock_),
state_(kUninitialized),
thread_(base::kNullThreadHandle),
diff --git a/media/video/ffmpeg_video_allocator.cc b/media/video/ffmpeg_video_allocator.cc
index 5b57293..62ecade 100644
--- a/media/video/ffmpeg_video_allocator.cc
+++ b/media/video/ffmpeg_video_allocator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,7 +17,8 @@
namespace media {
FFmpegVideoAllocator::FFmpegVideoAllocator()
- : get_buffer_(NULL),
+ : surface_format_(VideoFrame::INVALID),
+ get_buffer_(NULL),
release_buffer_(NULL) {
}
@@ -126,8 +127,7 @@ int FFmpegVideoAllocator::InternalAllocateBuffer(
if (available_frames_[index].empty()) {
int ret = get_buffer_(codec_context, av_frame);
CHECK_EQ(ret, 0);
- ffmpeg_video_frame = new RefCountedAVFrame();
- ffmpeg_video_frame->av_frame_ = *av_frame;
+ ffmpeg_video_frame = new RefCountedAVFrame(av_frame);
frame_pool_.push_back(ffmpeg_video_frame);
} else {
ffmpeg_video_frame = available_frames_[index].front();
@@ -173,9 +173,9 @@ void FFmpegVideoAllocator::InternalReleaseBuffer(
if (ffmpeg_video_frame->Release() == 0)
available_frames_[index].push_back(ffmpeg_video_frame);
- for(int k = 0; k < 4; ++k)
+ for (int k = 0; k < 4; ++k)
av_frame->data[k]=NULL;
#endif
}
-} // namespace media
+} // namespace media
diff --git a/media/video/ffmpeg_video_allocator.h b/media/video/ffmpeg_video_allocator.h
index 8866369..5e54925 100644
--- a/media/video/ffmpeg_video_allocator.h
+++ b/media/video/ffmpeg_video_allocator.h
@@ -26,7 +26,9 @@ class FFmpegVideoAllocator {
virtual ~FFmpegVideoAllocator();
struct RefCountedAVFrame {
- RefCountedAVFrame() : usage_count_(0) {}
+ explicit RefCountedAVFrame(AVFrame* av_frame)
+ : av_frame_(*av_frame),
+ usage_count_(0) {}
// TODO(jiesun): we had commented out "DCHECK_EQ(usage_count_, 0);" here.
// Because the way FFMPEG-MT handle release buffer in delayed fashion.
@@ -42,6 +44,10 @@ class FFmpegVideoAllocator {
return base::AtomicRefCountDecN(&usage_count_, 1);
}
+ // Technically AVFrame should *always* be heap-allocated via
+ // avcodec_alloc_frame() otherwise (while rare) we can run into nasty binary
+ // mismatch incompatibility stuff if people swap binaries (which might
+ // happen with some Linux distributions). See http://crbug.com/77629.
AVFrame av_frame_;
base::AtomicRefCount usage_count_;
};
@@ -88,6 +94,6 @@ class FFmpegVideoAllocator {
void (*release_buffer_)(struct AVCodecContext *c, AVFrame *pic);
};
-} // namespace media
+} // namespace media
#endif // MEDIA_VIDEO_FFMPEG_VIDEO_ALLOCATOR_H_