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

Unified Diff: remoting/test/test_video_renderer.h

Issue 1214113009: Update TestVideoRenderer with video decoding capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Addressed feedback from Joe: changed the callback mechanism" Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: remoting/test/test_video_renderer.h
diff --git a/remoting/test/test_video_renderer.h b/remoting/test/test_video_renderer.h
index fcf122abcd9aa29bddcf086d522aae0cd08eb5bc..080ec3f1406df9ed33ede36bf8a29aad0f88a9b3 100644
--- a/remoting/test/test_video_renderer.h
+++ b/remoting/test/test_video_renderer.h
@@ -5,11 +5,23 @@
#ifndef REMOTING_TEST_TEST_VIDEO_RENDERER_H_
#define REMOTING_TEST_TEST_VIDEO_RENDERER_H_
-#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "media/base/video_frame.h"
#include "remoting/client/video_renderer.h"
+#include "remoting/protocol/session_config.h"
#include "remoting/protocol/video_stub.h"
+namespace base {
+class Thread;
+class SingleThreadTaskRunner;
+}
+
+namespace webrtc {
+class DesktopFrame;
+}
+
namespace remoting {
namespace test {
@@ -24,13 +36,33 @@ class TestVideoRenderer : public VideoRenderer, public protocol::VideoStub {
ChromotingStats* GetStats() override;
protocol::VideoStub* GetVideoStub() override;
- private:
// protocol::VideoStub interface.
void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
const base::Closure& done) override;
- // Track the number of populated video frames which have been received.
- int video_frames_processed_;
+ // Initialize a decoder to decode video packets.
+ void SetDecoderForDecoding(const protocol::ChannelConfig::Codec codec);
joedow 2015/06/30 20:07:12 SetCodecForDecoding (or just SetCodec)
liaoyuke 2015/06/30 21:15:01 Done.
+
+ // Returns a copy of the current buffer.
+ scoped_ptr<webrtc::DesktopFrame> GetBufferForTest() const;
+
+ private:
+ // The actual implementation resides in Core class.
+ class Core;
+ scoped_ptr<Core> core_;
+
+ // Used to ensure TestVideoRenderer methods are called on the same thread.
+ base::ThreadChecker thread_checker_;
+
+ // Used to decode and process video packets.
+ scoped_ptr<base::Thread> video_decode_thread_;
+
+ // Used to post tasks to video decode thread.
+ scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_;
+
+ // Used to weakly bind |this| to methods.
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<TestVideoRenderer> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TestVideoRenderer);
};

Powered by Google App Engine
This is Rietveld 408576698