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

Side by Side Diff: media/base/decoder_buffer.cc

Issue 1018373003: Improving WebM video duration estimation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding limited media log (10 times max) for WebM duration estimates. Created 5 years, 9 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
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/base/decoder_buffer.h" 5 #include "media/base/decoder_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/buffers.h" 8 #include "media/base/buffers.h"
9 #include "media/base/decrypt_config.h" 9 #include "media/base/decrypt_config.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 // Allocates a block of memory which is padded for use with the SIMD 13 // Allocates a block of memory which is padded for use with the SIMD
14 // optimizations used by FFmpeg. 14 // optimizations used by FFmpeg.
15 static uint8* AllocateFFmpegSafeBlock(int size) { 15 static uint8* AllocateFFmpegSafeBlock(int size) {
16 uint8* const block = reinterpret_cast<uint8*>(base::AlignedAlloc( 16 uint8* const block = reinterpret_cast<uint8*>(base::AlignedAlloc(
17 size + DecoderBuffer::kPaddingSize, DecoderBuffer::kAlignmentSize)); 17 size + DecoderBuffer::kPaddingSize, DecoderBuffer::kAlignmentSize));
18 memset(block + size, 0, DecoderBuffer::kPaddingSize); 18 memset(block + size, 0, DecoderBuffer::kPaddingSize);
19 return block; 19 return block;
20 } 20 }
21 21
22 DecoderBuffer::DecoderBuffer(int size) 22 DecoderBuffer::DecoderBuffer(int size)
23 : size_(size), 23 : is_duration_estimated_(false),
24 size_(size),
24 side_data_size_(0), 25 side_data_size_(0),
25 is_key_frame_(false) { 26 is_key_frame_(false) {
26 Initialize(); 27 Initialize();
27 } 28 }
28 29
29 DecoderBuffer::DecoderBuffer(const uint8* data, int size, 30 DecoderBuffer::DecoderBuffer(const uint8* data,
30 const uint8* side_data, int side_data_size) 31 int size,
31 : size_(size), 32 const uint8* side_data,
33 int side_data_size)
34 : is_duration_estimated_(false),
35 size_(size),
32 side_data_size_(side_data_size), 36 side_data_size_(side_data_size),
33 is_key_frame_(false) { 37 is_key_frame_(false) {
34 if (!data) { 38 if (!data) {
35 CHECK_EQ(size_, 0); 39 CHECK_EQ(size_, 0);
36 CHECK(!side_data); 40 CHECK(!side_data);
37 return; 41 return;
38 } 42 }
39 43
40 Initialize(); 44 Initialize();
41 45
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 side_data_size_ = side_data_size; 118 side_data_size_ = side_data_size;
115 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_)); 119 side_data_.reset(AllocateFFmpegSafeBlock(side_data_size_));
116 memcpy(side_data_.get(), side_data, side_data_size_); 120 memcpy(side_data_.get(), side_data, side_data_size_);
117 } else { 121 } else {
118 side_data_.reset(); 122 side_data_.reset();
119 side_data_size_ = 0; 123 side_data_size_ = 0;
120 } 124 }
121 } 125 }
122 126
123 } // namespace media 127 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698