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

Side by Side Diff: content/renderer/media/media_recorder_handler.h

Issue 1351473006: WebmMuxer-MediaRecorderHandler: thread hopping and data ownership (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix data ownership before thread jump. ajose@ comment Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/strings/string_piece.h"
12 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
13 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
14 #include "third_party/WebKit/public/platform/WebMediaRecorderHandler.h" 13 #include "third_party/WebKit/public/platform/WebMediaRecorderHandler.h"
15 #include "third_party/WebKit/public/platform/WebMediaStream.h" 14 #include "third_party/WebKit/public/platform/WebMediaStream.h"
16 15
17 namespace blink { 16 namespace blink {
18 class WebMediaRecorderHandlerClient; 17 class WebMediaRecorderHandlerClient;
19 class WebString; 18 class WebString;
20 } // namespace blink 19 } // namespace blink
21 20
(...skipping 28 matching lines...) Expand all
50 const blink::WebString& mimeType) override; 49 const blink::WebString& mimeType) override;
51 bool start() override; 50 bool start() override;
52 bool start(int timeslice) override; 51 bool start(int timeslice) override;
53 void stop() override; 52 void stop() override;
54 void pause() override; 53 void pause() override;
55 void resume() override; 54 void resume() override;
56 55
57 private: 56 private:
58 friend class MediaRecorderHandlerTest; 57 friend class MediaRecorderHandlerTest;
59 58
60 void WriteData(const base::StringPiece& data); 59 void WriteData(scoped_ptr<std::string> data);
61 60
62 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 61 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
63 const base::TimeTicks& timestamp); 62 const base::TimeTicks& timestamp);
64 63
65 // Bound to the main render thread. 64 // Bound to the main render thread.
66 base::ThreadChecker main_render_thread_checker_; 65 base::ThreadChecker main_render_thread_checker_;
67 66
68 bool recording_; 67 bool recording_;
69 blink::WebMediaStream media_stream_; // The MediaStream being recorded. 68 blink::WebMediaStream media_stream_; // The MediaStream being recorded.
70 69
71 // |client_| is a weak pointer, and is valid for the lifetime of this object. 70 // |client_| is a weak pointer, and is valid for the lifetime of this object.
72 blink::WebMediaRecorderHandlerClient* client_; 71 blink::WebMediaRecorderHandlerClient* client_;
73 72
74 ScopedVector<VideoTrackRecorder> video_recorders_; 73 ScopedVector<VideoTrackRecorder> video_recorders_;
75 74
76 // Worker class doing the actual Webm Muxing work. 75 // Worker class doing the actual Webm Muxing work.
77 scoped_ptr<media::WebmMuxer> webm_muxer_; 76 scoped_refptr<media::WebmMuxer> webm_muxer_;
78 77
79 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_; 78 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_;
80 79
81 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler); 80 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler);
82 }; 81 };
83 82
84 } // namespace content 83 } // namespace content
85 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ 84 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_recorder_handler.cc » ('j') | content/renderer/media/media_recorder_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698