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

Side by Side Diff: content/renderer/media/rtc_video_decoder_unittest.cc

Issue 1150543002: RtcVideoDecoder: fall back to SW decode for unsupported profiles/resolutions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rtcvd unittest Created 5 years, 7 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 | « content/renderer/media/rtc_video_decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/synchronization/waitable_event.h" 7 #include "base/synchronization/waitable_event.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "content/renderer/media/rtc_video_decoder.h" 9 #include "content/renderer/media/rtc_video_decoder.h"
10 #include "media/base/gmock_callback_support.h" 10 #include "media/base/gmock_callback_support.h"
(...skipping 17 matching lines...) Expand all
28 : mock_gpu_factories_(new media::MockGpuVideoAcceleratorFactories), 28 : mock_gpu_factories_(new media::MockGpuVideoAcceleratorFactories),
29 vda_thread_("vda_thread"), 29 vda_thread_("vda_thread"),
30 idle_waiter_(false, false) { 30 idle_waiter_(false, false) {
31 memset(&codec_, 0, sizeof(codec_)); 31 memset(&codec_, 0, sizeof(codec_));
32 } 32 }
33 33
34 void SetUp() override { 34 void SetUp() override {
35 ASSERT_TRUE(vda_thread_.Start()); 35 ASSERT_TRUE(vda_thread_.Start());
36 vda_task_runner_ = vda_thread_.message_loop_proxy(); 36 vda_task_runner_ = vda_thread_.message_loop_proxy();
37 mock_vda_ = new media::MockVideoDecodeAccelerator; 37 mock_vda_ = new media::MockVideoDecodeAccelerator;
38
39 media::VideoDecodeAccelerator::SupportedProfile supported_profile;
40 supported_profile.min_resolution.SetSize(16, 16);
41 supported_profile.max_resolution.SetSize(1920, 1088);
42 supported_profile.profile = media::H264PROFILE_MAIN;
43 supported_profiles_.push_back(supported_profile);
44 supported_profile.profile = media::VP8PROFILE_ANY;
45 supported_profiles_.push_back(supported_profile);
46
38 EXPECT_CALL(*mock_gpu_factories_.get(), GetTaskRunner()) 47 EXPECT_CALL(*mock_gpu_factories_.get(), GetTaskRunner())
39 .WillRepeatedly(Return(vda_task_runner_)); 48 .WillRepeatedly(Return(vda_task_runner_));
49 EXPECT_CALL(*mock_gpu_factories_.get(),
50 GetVideoDecodeAcceleratorSupportedProfiles())
51 .WillRepeatedly(Return(supported_profiles_));
40 EXPECT_CALL(*mock_gpu_factories_.get(), DoCreateVideoDecodeAccelerator()) 52 EXPECT_CALL(*mock_gpu_factories_.get(), DoCreateVideoDecodeAccelerator())
41 .WillRepeatedly(Return(mock_vda_)); 53 .WillRepeatedly(Return(mock_vda_));
42 EXPECT_CALL(*mock_vda_, Initialize(_, _)) 54 EXPECT_CALL(*mock_vda_, Initialize(_, _))
43 .Times(1) 55 .Times(1)
44 .WillRepeatedly(Return(true)); 56 .WillRepeatedly(Return(true));
45 EXPECT_CALL(*mock_vda_, Destroy()).Times(1); 57 EXPECT_CALL(*mock_vda_, Destroy()).Times(1);
46 } 58 }
47 59
48 void TearDown() override { 60 void TearDown() override {
49 DVLOG(2) << "TearDown"; 61 DVLOG(2) << "TearDown";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 base::Unretained(&idle_waiter_))); 102 base::Unretained(&idle_waiter_)));
91 idle_waiter_.Wait(); 103 idle_waiter_.Wait();
92 } 104 }
93 105
94 protected: 106 protected:
95 scoped_refptr<media::MockGpuVideoAcceleratorFactories> mock_gpu_factories_; 107 scoped_refptr<media::MockGpuVideoAcceleratorFactories> mock_gpu_factories_;
96 media::MockVideoDecodeAccelerator* mock_vda_; 108 media::MockVideoDecodeAccelerator* mock_vda_;
97 scoped_ptr<RTCVideoDecoder> rtc_decoder_; 109 scoped_ptr<RTCVideoDecoder> rtc_decoder_;
98 webrtc::VideoCodec codec_; 110 webrtc::VideoCodec codec_;
99 base::Thread vda_thread_; 111 base::Thread vda_thread_;
112 media::VideoDecodeAccelerator::SupportedProfiles supported_profiles_;
100 113
101 private: 114 private:
102 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; 115 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_;
103 116
104 base::Lock lock_; 117 base::Lock lock_;
105 base::WaitableEvent idle_waiter_; 118 base::WaitableEvent idle_waiter_;
106 }; 119 };
107 120
108 TEST_F(RTCVideoDecoderTest, CreateReturnsNullOnUnsupportedCodec) { 121 TEST_F(RTCVideoDecoderTest, CreateReturnsNullOnUnsupportedCodec) {
109 CreateDecoder(webrtc::kVideoCodecVP8); 122 CreateDecoder(webrtc::kVideoCodecVP8);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 233
221 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST, 234 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST,
222 RTCVideoDecoder::ID_LAST)); 235 RTCVideoDecoder::ID_LAST));
223 EXPECT_TRUE( 236 EXPECT_TRUE(
224 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST)); 237 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST));
225 EXPECT_FALSE( 238 EXPECT_FALSE(
226 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST)); 239 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST));
227 } 240 }
228 241
229 } // content 242 } // content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698