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

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

Issue 379983002: Fix AnnexB validation logic to work with encrypted content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comment Created 6 years, 4 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
« no previous file with comments | « no previous file | media/filters/h264_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <deque> 6 #include <deque>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 DemuxerStream::Status status, 868 DemuxerStream::Status status,
869 const scoped_refptr<DecoderBuffer>& buffer) { 869 const scoped_refptr<DecoderBuffer>& buffer) {
870 EXPECT_EQ(status, DemuxerStream::kOk); 870 EXPECT_EQ(status, DemuxerStream::kOk);
871 871
872 if (buffer->end_of_stream()) { 872 if (buffer->end_of_stream()) {
873 base::MessageLoop::current()->PostTask( 873 base::MessageLoop::current()->PostTask(
874 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 874 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
875 return; 875 return;
876 } 876 }
877 877
878 std::vector<SubsampleEntry> subsamples;
879
880 if (buffer->decrypt_config())
881 subsamples = buffer->decrypt_config()->subsamples();
882
878 bool is_valid = 883 bool is_valid =
879 mp4::AVC::IsValidAnnexB(buffer->data(), buffer->data_size()); 884 mp4::AVC::IsValidAnnexB(buffer->data(), buffer->data_size(),
885 subsamples);
880 EXPECT_TRUE(is_valid); 886 EXPECT_TRUE(is_valid);
881 887
882 if (!is_valid) { 888 if (!is_valid) {
883 LOG(ERROR) << "Buffer contains invalid Annex B data."; 889 LOG(ERROR) << "Buffer contains invalid Annex B data.";
884 base::MessageLoop::current()->PostTask( 890 base::MessageLoop::current()->PostTask(
885 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 891 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
886 return; 892 return;
887 } 893 }
888 894
889 stream->Read(base::Bind(&ValidateAnnexB, stream)); 895 stream->Read(base::Bind(&ValidateAnnexB, stream));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 InitializeDemuxer(); 954 InitializeDemuxer();
949 955
950 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); 956 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO);
951 ASSERT_TRUE(stream); 957 ASSERT_TRUE(stream);
952 ASSERT_EQ(VIDEO_ROTATION_270, stream->video_rotation()); 958 ASSERT_EQ(VIDEO_ROTATION_270, stream->video_rotation());
953 } 959 }
954 960
955 #endif 961 #endif
956 962
957 } // namespace media 963 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/h264_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698