Commit f18439bd authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Remove audio codec whitelist for partial append window trimming.

This was needed where codec specific behavior was causing crashes
with splicing, but now that we just use partial append window
trimming, there's no reason not to support it on every audio
codec.

BUG=none
TEST=unittests pass.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ia52d058743f557bcddd24e31bcc5cf694e83ef8a
Reviewed-on: https://chromium-review.googlesource.com/1182662
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarMatthew Wolenetz <wolenetz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585079}
parent e4fcffa1
...@@ -94,7 +94,6 @@ ChunkDemuxerStream::ChunkDemuxerStream(Type type, ...@@ -94,7 +94,6 @@ ChunkDemuxerStream::ChunkDemuxerStream(Type type,
liveness_(DemuxerStream::LIVENESS_UNKNOWN), liveness_(DemuxerStream::LIVENESS_UNKNOWN),
media_track_id_(media_track_id), media_track_id_(media_track_id),
state_(UNINITIALIZED), state_(UNINITIALIZED),
partial_append_window_trimming_enabled_(false),
is_enabled_(true) {} is_enabled_(true) {}
void ChunkDemuxerStream::StartReturningData() { void ChunkDemuxerStream::StartReturningData() {
...@@ -267,13 +266,6 @@ bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config, ...@@ -267,13 +266,6 @@ bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config,
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
if (!SBSTREAM_IS_SET) { if (!SBSTREAM_IS_SET) {
DCHECK_EQ(state_, UNINITIALIZED); DCHECK_EQ(state_, UNINITIALIZED);
// Enable partial append window support for most audio codecs (notably: not
// opus).
partial_append_window_trimming_enabled_ =
config.codec() == kCodecMP3 || config.codec() == kCodecAAC ||
config.codec() == kCodecVorbis || config.codec() == kCodecFLAC;
SBSTREAM_RESET(config, media_log); SBSTREAM_RESET(config, media_log);
return true; return true;
} }
......
...@@ -148,10 +148,6 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { ...@@ -148,10 +148,6 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
// Sets the memory limit, in bytes, on the SourceBufferStream. // Sets the memory limit, in bytes, on the SourceBufferStream.
void SetStreamMemoryLimit(size_t memory_limit); void SetStreamMemoryLimit(size_t memory_limit);
bool supports_partial_append_window_trimming() const {
return partial_append_window_trimming_enabled_;
}
void SetLiveness(Liveness liveness); void SetLiveness(Liveness liveness);
MediaTrack::Id media_track_id() const { return media_track_id_; } MediaTrack::Id media_track_id() const { return media_track_id_; }
...@@ -185,7 +181,6 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { ...@@ -185,7 +181,6 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
mutable base::Lock lock_; mutable base::Lock lock_;
State state_; State state_;
ReadCB read_cb_; ReadCB read_cb_;
bool partial_append_window_trimming_enabled_;
bool is_enabled_; bool is_enabled_;
DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
......
...@@ -1361,8 +1361,6 @@ TEST_P(ChunkDemuxerTest, Init) { ...@@ -1361,8 +1361,6 @@ TEST_P(ChunkDemuxerTest, Init) {
EXPECT_EQ(kSampleFormatPlanarF32, config.sample_format()); EXPECT_EQ(kSampleFormatPlanarF32, config.sample_format());
EXPECT_EQ(is_audio_encrypted, EXPECT_EQ(is_audio_encrypted,
audio_stream->audio_decoder_config().is_encrypted()); audio_stream->audio_decoder_config().is_encrypted());
EXPECT_TRUE(static_cast<ChunkDemuxerStream*>(audio_stream)
->supports_partial_append_window_trimming());
} else { } else {
EXPECT_FALSE(audio_stream); EXPECT_FALSE(audio_stream);
} }
...@@ -1372,8 +1370,6 @@ TEST_P(ChunkDemuxerTest, Init) { ...@@ -1372,8 +1370,6 @@ TEST_P(ChunkDemuxerTest, Init) {
EXPECT_TRUE(video_stream); EXPECT_TRUE(video_stream);
EXPECT_EQ(is_video_encrypted, EXPECT_EQ(is_video_encrypted,
video_stream->video_decoder_config().is_encrypted()); video_stream->video_decoder_config().is_encrypted());
EXPECT_FALSE(static_cast<ChunkDemuxerStream*>(video_stream)
->supports_partial_append_window_trimming());
} else { } else {
EXPECT_FALSE(video_stream); EXPECT_FALSE(video_stream);
} }
......
...@@ -847,10 +847,10 @@ bool FrameProcessor::ProcessFrame(scoped_refptr<StreamParserBuffer> frame, ...@@ -847,10 +847,10 @@ bool FrameProcessor::ProcessFrame(scoped_refptr<StreamParserBuffer> frame,
frame->set_timestamp(presentation_timestamp); frame->set_timestamp(presentation_timestamp);
frame->SetDecodeTimestamp(decode_timestamp); frame->SetDecodeTimestamp(decode_timestamp);
if (track_buffer->stream()->supports_partial_append_window_trimming() && // Attempt to trim audio exactly to fit the append window.
if (frame->type() == DemuxerStream::AUDIO &&
HandlePartialAppendWindowTrimming(append_window_start, HandlePartialAppendWindowTrimming(append_window_start,
append_window_end, append_window_end, frame)) {
frame)) {
// |frame| has been partially trimmed or had preroll added. Though // |frame| has been partially trimmed or had preroll added. Though
// |frame|'s duration may have changed, do not update |frame_duration| // |frame|'s duration may have changed, do not update |frame_duration|
// here, so |track_buffer|'s last frame duration update uses original // here, so |track_buffer|'s last frame duration update uses original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment