summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 19:55:46 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 19:55:46 +0000
commita5d686ae5afb02ab19d5fa95ed985d692fe20947 (patch)
treea1837551e2cd2be1b7e88f95f9fc1350ad222c1d /media
parentd18c3c6d54e381f5336bdbe4234b208cb06bf8e5 (diff)
downloadchromium_src-a5d686ae5afb02ab19d5fa95ed985d692fe20947.zip
chromium_src-a5d686ae5afb02ab19d5fa95ed985d692fe20947.tar.gz
chromium_src-a5d686ae5afb02ab19d5fa95ed985d692fe20947.tar.bz2
Remove no-longer-used FFmpeg index-related helpers.
These methods served AdaptiveDemuxer which died in r103279. BUG=none TEST=trybots Review URL: http://codereview.chromium.org/8084005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/ffmpeg/ffmpeg_common.cc74
-rw-r--r--media/ffmpeg/ffmpeg_common.h28
-rw-r--r--media/ffmpeg/ffmpeg_common_unittest.cc94
3 files changed, 0 insertions, 196 deletions
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 72323c7..76cc36d 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -220,80 +220,6 @@ base::TimeDelta GetFrameDuration(AVStream* stream) {
return ConvertFromTimeBase(time_base, 1);
}
-bool GetSeekTimeAfter(AVStream* stream, const base::TimeDelta& timestamp,
- base::TimeDelta* seek_time) {
- DCHECK(stream);
- DCHECK(timestamp >= base::TimeDelta::FromSeconds(0));
- DCHECK(seek_time);
-
- // Make sure we have index data.
- if (!stream->index_entries || stream->nb_index_entries <= 0)
- return false;
-
- // Search for the index entry >= the specified timestamp.
- int64 stream_ts = ConvertToTimeBase(stream->time_base, timestamp);
- int i = av_index_search_timestamp(stream, stream_ts, 0);
-
- if (i < 0)
- return false;
-
- if (stream->index_entries[i].timestamp == static_cast<int64>(AV_NOPTS_VALUE))
- return false;
-
- *seek_time = ConvertFromTimeBase(stream->time_base,
- stream->index_entries[i].timestamp);
- return true;
-}
-
-
-bool GetStreamByteCountOverRange(AVStream* stream,
- const base::TimeDelta& start_time,
- const base::TimeDelta& end_time,
- int64* bytes,
- base::TimeDelta* range_start,
- base::TimeDelta* range_end) {
- DCHECK(stream);
- DCHECK(start_time < end_time);
- DCHECK(start_time >= base::TimeDelta::FromSeconds(0));
- DCHECK(bytes);
- DCHECK(range_start);
- DCHECK(range_end);
-
- // Make sure the stream has index data.
- if (!stream->index_entries || stream->nb_index_entries <= 1)
- return false;
-
- // Search for the index entries associated with the timestamps.
- int64 start_ts = ConvertToTimeBase(stream->time_base, start_time);
- int64 end_ts = ConvertToTimeBase(stream->time_base, end_time);
- int i = av_index_search_timestamp(stream, start_ts, AVSEEK_FLAG_BACKWARD);
- int j = av_index_search_timestamp(stream, end_ts, 0);
-
- // Make sure start & end indexes are valid.
- if (i < 0 || j < 0)
- return false;
-
- // Shouldn't happen because start & end use different seek flags, but we want
- // to know about it if they end up pointing to the same index entry.
- DCHECK_NE(i, j);
-
- AVIndexEntry* start_ie = &stream->index_entries[i];
- AVIndexEntry* end_ie = &stream->index_entries[j];
-
- // Make sure index entries have valid timestamps & position data.
- if (start_ie->timestamp == static_cast<int64>(AV_NOPTS_VALUE) ||
- end_ie->timestamp == static_cast<int64>(AV_NOPTS_VALUE) ||
- start_ie->timestamp >= end_ie->timestamp ||
- start_ie->pos >= end_ie->pos) {
- return false;
- }
-
- *bytes = end_ie->pos - start_ie->pos;
- *range_start = ConvertFromTimeBase(stream->time_base, start_ie->timestamp);
- *range_end = ConvertFromTimeBase(stream->time_base, end_ie->timestamp);
- return true;
-}
-
int GetNaturalHeight(AVStream* stream) {
return stream->codec->height;
}
diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
index dbdbc6e..9248e18 100644
--- a/media/ffmpeg/ffmpeg_common.h
+++ b/media/ffmpeg/ffmpeg_common.h
@@ -85,34 +85,6 @@ ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout,
// Calculates duration of one frame in the |stream| based on its frame rate.
base::TimeDelta GetFrameDuration(AVStream* stream);
-// Get the timestamp of the next seek point after |timestamp|.
-// Returns true if a valid seek point was found after |timestamp| and
-// |seek_time| was set. Returns false if a seek point could not be
-// found or the parameters are invalid.
-MEDIA_EXPORT bool GetSeekTimeAfter(AVStream* stream,
- const base::TimeDelta& timestamp,
- base::TimeDelta* seek_time);
-
-// Get the number of bytes required to play the stream over a specified
-// time range. This is an estimate based on the available index data.
-// Returns true if input time range was valid and |bytes|, |range_start|,
-// and |range_end|, were set. Returns false if the range was invalid or we don't
-// have enough index data to make an estimate.
-//
-// |bytes| - The number of bytes in the stream for the specified range.
-// |range_start| - The start time for the range covered by |bytes|. This
-// may be different than |start_time| if the index doesn't
-// have data for that exact time. |range_start| <= |start_time|
-// |range_end| - The end time for the range covered by |bytes|. This may be
-// different than |end_time| if the index doesn't have data for
-// that exact time. |range_end| >= |end_time|
-MEDIA_EXPORT bool GetStreamByteCountOverRange(AVStream* stream,
- const base::TimeDelta& start_time,
- const base::TimeDelta& end_time,
- int64* bytes,
- base::TimeDelta* range_start,
- base::TimeDelta* range_end);
-
// Calculates the natural width and height of the video using the video's
// encoded dimensions and sample_aspect_ratio.
int GetNaturalHeight(AVStream* stream);
diff --git a/media/ffmpeg/ffmpeg_common_unittest.cc b/media/ffmpeg/ffmpeg_common_unittest.cc
index f045f76..d67e1fe 100644
--- a/media/ffmpeg/ffmpeg_common_unittest.cc
+++ b/media/ffmpeg/ffmpeg_common_unittest.cc
@@ -79,98 +79,4 @@ TEST_F(FFmpegCommonTest, TestTimeBaseConversions) {
}
}
-TEST_F(FFmpegCommonTest, GetSeekTimeAfterSuccess) {
- int64 test_data[][2] = {
- {5000, 5000}, // Timestamp is a keyframe seek point.
- {2400, 3000}, // Timestamp is just before a keyframe seek point.
- {2000, 3000}, // Timestamp is a non-keyframe entry.
- {1800, 3000}, // Timestamp is just before a non-keyframe entry.
- };
-
- for (size_t i = 0; i < arraysize(test_data); ++i) {
- SCOPED_TRACE(i);
-
- TimeDelta seek_point;
- TimeDelta timestamp = TimeDelta::FromMilliseconds(test_data[i][0]);
- ASSERT_TRUE(GetSeekTimeAfter(&stream_, timestamp, &seek_point));
- EXPECT_EQ(seek_point.InMilliseconds(), test_data[i][1]);
- }
-}
-
-TEST_F(FFmpegCommonTest, GetSeekTimeAfterFailures) {
- TimeDelta seek_point;
-
- // Timestamp after last index entry.
- ASSERT_FALSE(GetSeekTimeAfter(&stream_, TimeDelta::FromSeconds(8),
- &seek_point));
-
- AVStream stream;
- memcpy(&stream, &stream_, sizeof(stream));
- stream.index_entries = NULL;
- // Stream w/o index data.
- ASSERT_FALSE(GetSeekTimeAfter(&stream, TimeDelta::FromSeconds(1),
- &seek_point));
-}
-
-TEST_F(FFmpegCommonTest, GetStreamByteCountOverRangeSuccess) {
- int64 test_data[][5] = {
- { 0, 1000, 2000, 0, 1000}, // Bytes between two adjacent keyframe
- // entries.
- {1000, 2000, 3000, 1000, 3000}, // Bytes between two keyframe entries with a
- // non-keyframe entry between them.
- {5500, 5600, 1000, 5000, 6000}, // Bytes for a range that starts and ends
- // between two index entries.
- {4500, 7000, 6500, 3000, 7000}, // Bytes for a range that ends on the last
- // seek point.
- };
-
-
- for (size_t i = 0; i < arraysize(test_data); ++i) {
- SCOPED_TRACE(i);
-
- TimeDelta start_time = TimeDelta::FromMilliseconds(test_data[i][0]);
- TimeDelta end_time = TimeDelta::FromMilliseconds(test_data[i][1]);
- int64 bytes;
- TimeDelta range_start;
- TimeDelta range_end;
-
- ASSERT_TRUE(GetStreamByteCountOverRange(&stream_, start_time, end_time,
- &bytes, &range_start, &range_end));
- EXPECT_EQ(bytes, test_data[i][2]);
- EXPECT_EQ(range_start.InMilliseconds(), test_data[i][3]);
- EXPECT_EQ(range_end.InMilliseconds(), test_data[i][4]);
- }
-}
-
-TEST_F(FFmpegCommonTest, GetStreamByteCountOverRangeFailures) {
-
- int64 test_data[][2] = {
- {7000, 7600}, // Test a range that starts at the last seek point.
- {7500, 7600}, // Test a range after the last seek point
- };
-
- int64 bytes;
- TimeDelta range_start;
- TimeDelta range_end;
-
- for (size_t i = 0; i < arraysize(test_data); ++i) {
- SCOPED_TRACE(i);
-
- TimeDelta start_time = TimeDelta::FromMilliseconds(test_data[i][0]);
- TimeDelta end_time = TimeDelta::FromMilliseconds(test_data[i][1]);
-
- EXPECT_FALSE(GetStreamByteCountOverRange(&stream_, start_time, end_time,
- &bytes, &range_start, &range_end));
- }
-
- AVStream stream;
- memcpy(&stream, &stream_, sizeof(stream));
- stream.index_entries = NULL;
- // Stream w/o index data.
- ASSERT_FALSE(GetStreamByteCountOverRange(&stream,
- TimeDelta::FromSeconds(1),
- TimeDelta::FromSeconds(2),
- &bytes, &range_start, &range_end));
-}
-
} // namespace media