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/webm/webm_cluster_parser.h" | 5 #include "media/webm/webm_cluster_parser.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/data_buffer.h" | 8 #include "media/base/data_buffer.h" |
9 #include "media/webm/webm_constants.h" | |
10 | |
11 #if !defined(OS_ANDROID) | |
9 #include "media/ffmpeg/ffmpeg_common.h" | 12 #include "media/ffmpeg/ffmpeg_common.h" |
10 #include "media/webm/webm_constants.h" | 13 |
14 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are | |
15 // padded with this value. | |
16 #define INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE | |
17 #else | |
18 // Since FFmpeg is not available on Android, align the value with the setting | |
19 // in libavcodec's avcodec.h. | |
20 #define INPUT_BUFFER_PADDING_SIZE 16 | |
acolwell GONE FROM CHROMIUM
2012/01/31 16:30:43
Since you're not compiling webm_stream_parser.cc f
| |
21 #endif | |
11 | 22 |
12 namespace media { | 23 namespace media { |
13 | 24 |
14 static Buffer* CreateBuffer(const uint8* data, size_t size) { | 25 static Buffer* CreateBuffer(const uint8* data, size_t size) { |
15 // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are | 26 scoped_array<uint8> buf(new uint8[size + INPUT_BUFFER_PADDING_SIZE]); |
16 // padded with this value. | |
17 scoped_array<uint8> buf(new uint8[size + FF_INPUT_BUFFER_PADDING_SIZE]); | |
18 memcpy(buf.get(), data, size); | 27 memcpy(buf.get(), data, size); |
19 memset(buf.get() + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); | 28 memset(buf.get() + size, 0, INPUT_BUFFER_PADDING_SIZE); |
20 return new DataBuffer(buf.Pass(), size); | 29 return new DataBuffer(buf.Pass(), size); |
21 } | 30 } |
22 | 31 |
23 WebMClusterParser::WebMClusterParser(int64 timecode_scale, | 32 WebMClusterParser::WebMClusterParser(int64 timecode_scale, |
24 int audio_track_num, | 33 int audio_track_num, |
25 base::TimeDelta audio_default_duration, | 34 base::TimeDelta audio_default_duration, |
26 int video_track_num, | 35 int video_track_num, |
27 base::TimeDelta video_default_duration) | 36 base::TimeDelta video_default_duration) |
28 : timecode_multiplier_(timecode_scale / 1000.0), | 37 : timecode_multiplier_(timecode_scale / 1000.0), |
29 audio_track_num_(audio_track_num), | 38 audio_track_num_(audio_track_num), |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically " | 144 DVLOG(1) << "Got SimpleBlock timecode is not strictly monotonically " |
136 << "increasing for track " << track_num; | 145 << "increasing for track " << track_num; |
137 return false; | 146 return false; |
138 } | 147 } |
139 | 148 |
140 queue->push_back(buffer); | 149 queue->push_back(buffer); |
141 return true; | 150 return true; |
142 } | 151 } |
143 | 152 |
144 } // namespace media | 153 } // namespace media |
OLD | NEW |