| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "talk/media/base/fakenetworkinterface.h" | 34 #include "talk/media/base/fakenetworkinterface.h" |
| 35 #include "talk/media/base/fakevideocapturer.h" | 35 #include "talk/media/base/fakevideocapturer.h" |
| 36 #include "talk/media/base/fakevideorenderer.h" | 36 #include "talk/media/base/fakevideorenderer.h" |
| 37 #include "talk/media/base/mediachannel.h" | 37 #include "talk/media/base/mediachannel.h" |
| 38 #include "talk/media/base/streamparams.h" | 38 #include "talk/media/base/streamparams.h" |
| 39 #include "webrtc/base/bytebuffer.h" | 39 #include "webrtc/base/bytebuffer.h" |
| 40 #include "webrtc/base/gunit.h" | 40 #include "webrtc/base/gunit.h" |
| 41 #include "webrtc/base/timeutils.h" | 41 #include "webrtc/base/timeutils.h" |
| 42 | 42 |
| 43 #ifdef WIN32 | |
| 44 #include <objbase.h> // NOLINT | |
| 45 #endif | |
| 46 | |
| 47 #define EXPECT_FRAME_WAIT(c, w, h, t) \ | 43 #define EXPECT_FRAME_WAIT(c, w, h, t) \ |
| 48 EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \ | 44 EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \ |
| 49 EXPECT_EQ((w), renderer_.width()); \ | 45 EXPECT_EQ((w), renderer_.width()); \ |
| 50 EXPECT_EQ((h), renderer_.height()); \ | 46 EXPECT_EQ((h), renderer_.height()); \ |
| 51 EXPECT_EQ(0, renderer_.errors()); \ | 47 EXPECT_EQ(0, renderer_.errors()); \ |
| 52 | 48 |
| 53 #define EXPECT_FRAME_ON_RENDERER_WAIT(r, c, w, h, t) \ | 49 #define EXPECT_FRAME_ON_RENDERER_WAIT(r, c, w, h, t) \ |
| 54 EXPECT_EQ_WAIT((c), (r).num_rendered_frames(), (t)); \ | 50 EXPECT_EQ_WAIT((c), (r).num_rendered_frames(), (t)); \ |
| 55 EXPECT_EQ((w), (r).width()); \ | 51 EXPECT_EQ((w), (r).width()); \ |
| 56 EXPECT_EQ((h), (r).height()); \ | 52 EXPECT_EQ((h), (r).height()); \ |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 protected: | 128 protected: |
| 133 // Tests starting and stopping the engine, and creating a channel. | 129 // Tests starting and stopping the engine, and creating a channel. |
| 134 void StartupShutdown() { | 130 void StartupShutdown() { |
| 135 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); | 131 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); |
| 136 cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL); | 132 cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL); |
| 137 EXPECT_TRUE(channel != NULL); | 133 EXPECT_TRUE(channel != NULL); |
| 138 delete channel; | 134 delete channel; |
| 139 engine_.Terminate(); | 135 engine_.Terminate(); |
| 140 } | 136 } |
| 141 | 137 |
| 142 #ifdef WIN32 | |
| 143 // Tests that the COM reference count is not munged by the engine. | |
| 144 // Test to make sure LMI does not munge the CoInitialize reference count. | |
| 145 void CheckCoInitialize() { | |
| 146 // Initial refcount should be 0. | |
| 147 EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED)); | |
| 148 | |
| 149 // Engine should start even with COM already inited. | |
| 150 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); | |
| 151 engine_.Terminate(); | |
| 152 // Refcount after terminate should be 1; this tests if it is nonzero. | |
| 153 EXPECT_EQ(S_FALSE, CoInitializeEx(NULL, COINIT_MULTITHREADED)); | |
| 154 // Decrement refcount to (hopefully) 0. | |
| 155 CoUninitialize(); | |
| 156 CoUninitialize(); | |
| 157 | |
| 158 // Ensure refcount is 0. | |
| 159 EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED)); | |
| 160 CoUninitialize(); | |
| 161 } | |
| 162 #endif | |
| 163 | |
| 164 void ConstrainNewCodecBody() { | 138 void ConstrainNewCodecBody() { |
| 165 cricket::VideoCodec empty, in, out; | 139 cricket::VideoCodec empty, in, out; |
| 166 cricket::VideoCodec max_settings(engine_.codecs()[0].id, | 140 cricket::VideoCodec max_settings(engine_.codecs()[0].id, |
| 167 engine_.codecs()[0].name, | 141 engine_.codecs()[0].name, |
| 168 1280, 800, 30, 0); | 142 1280, 800, 30, 0); |
| 169 | 143 |
| 170 // set max settings of 1280x800x30 | 144 // set max settings of 1280x800x30 |
| 171 EXPECT_TRUE(engine_.SetDefaultEncoderConfig( | 145 EXPECT_TRUE(engine_.SetDefaultEncoderConfig( |
| 172 cricket::VideoEncoderConfig(max_settings))); | 146 cricket::VideoEncoderConfig(max_settings))); |
| 173 | 147 |
| (...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 rtc::scoped_ptr<C> channel_; | 1880 rtc::scoped_ptr<C> channel_; |
| 1907 cricket::FakeNetworkInterface network_interface_; | 1881 cricket::FakeNetworkInterface network_interface_; |
| 1908 cricket::FakeVideoRenderer renderer_; | 1882 cricket::FakeVideoRenderer renderer_; |
| 1909 cricket::VideoMediaChannel::Error media_error_; | 1883 cricket::VideoMediaChannel::Error media_error_; |
| 1910 | 1884 |
| 1911 // Used by test cases where 2 streams are run on the same channel. | 1885 // Used by test cases where 2 streams are run on the same channel. |
| 1912 cricket::FakeVideoRenderer renderer2_; | 1886 cricket::FakeVideoRenderer renderer2_; |
| 1913 }; | 1887 }; |
| 1914 | 1888 |
| 1915 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 1889 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
| OLD | NEW |