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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 256583006: Fix possible buffer emission during an abort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2718 TEST_P(ChunkDemuxerTest, IsParsingMediaSegmentMidMediaSegment) { 2718 TEST_P(ChunkDemuxerTest, IsParsingMediaSegmentMidMediaSegment) {
2719 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); 2719 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO));
2720 2720
2721 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); 2721 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2);
2722 // Append only part of the cluster data. 2722 // Append only part of the cluster data.
2723 AppendData(cluster->data(), cluster->size() - 13); 2723 AppendData(cluster->data(), cluster->size() - 13);
2724 2724
2725 // Confirm we're in the middle of parsing a media segment. 2725 // Confirm we're in the middle of parsing a media segment.
2726 ASSERT_TRUE(demuxer_->IsParsingMediaSegment(kSourceId)); 2726 ASSERT_TRUE(demuxer_->IsParsingMediaSegment(kSourceId));
2727 2727
2728 demuxer_->Abort(kSourceId); 2728 demuxer_->Abort(kSourceId, timestamp_offset_map_[kSourceId]);
2729 // After Abort(), parsing should no longer be in the middle of a media 2729 // After Abort(), parsing should no longer be in the middle of a media
2730 // segment. 2730 // segment.
2731 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); 2731 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId));
2732 } 2732 }
2733 2733
2734 TEST_P(ChunkDemuxerTest, WebMIsParsingMediaSegmentDetection) { 2734 TEST_P(ChunkDemuxerTest, WebMIsParsingMediaSegmentDetection) {
2735 // TODO(wolenetz): Also test 'unknown' sized clusters. 2735 // TODO(wolenetz): Also test 'unknown' sized clusters.
2736 // See http://crbug.com/335676. 2736 // See http://crbug.com/335676.
2737 const uint8 kBuffer[] = { 2737 const uint8 kBuffer[] = {
2738 0x1F, 0x43, 0xB6, 0x75, 0x83, // CLUSTER (size = 3) 2738 0x1F, 0x43, 0xB6, 0x75, 0x83, // CLUSTER (size = 3)
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 // Verify that audio & video streams continue to return expected values. 3213 // Verify that audio & video streams continue to return expected values.
3214 CheckExpectedBuffers(audio_stream, "160 180"); 3214 CheckExpectedBuffers(audio_stream, "160 180");
3215 CheckExpectedBuffers(video_stream, "180 210"); 3215 CheckExpectedBuffers(video_stream, "180 210");
3216 } 3216 }
3217 3217
3218 // TODO(wolenetz): Enable testing of new frame processor based on this flag, 3218 // TODO(wolenetz): Enable testing of new frame processor based on this flag,
3219 // once the new processor has landed. See http://crbug.com/249422. 3219 // once the new processor has landed. See http://crbug.com/249422.
3220 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true)); 3220 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, ChunkDemuxerTest, Values(true));
3221 3221
3222 } // namespace media 3222 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698