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

Unified Diff: media/cast/cast_sender_impl.cc

Issue 906403006: [Cast] Size-Adaptable platform video encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed hubbe's comments. Created 5 years, 10 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
« no previous file with comments | « media/cast/cast_sender.h ('k') | media/cast/cast_testing.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/cast_sender_impl.cc
diff --git a/media/cast/cast_sender_impl.cc b/media/cast/cast_sender_impl.cc
index b47ae9c30220e13096a290fd600a50a55ee34848..23e8a2310954764a4d10d19c82482edaf16d37c0 100644
--- a/media/cast/cast_sender_impl.cc
+++ b/media/cast/cast_sender_impl.cc
@@ -19,11 +19,12 @@ namespace cast {
class LocalVideoFrameInput : public VideoFrameInput {
public:
LocalVideoFrameInput(scoped_refptr<CastEnvironment> cast_environment,
- base::WeakPtr<VideoSender> video_sender,
- scoped_ptr<VideoFrameFactory> video_frame_factory)
+ base::WeakPtr<VideoSender> video_sender)
: cast_environment_(cast_environment),
video_sender_(video_sender),
- video_frame_factory_(video_frame_factory.Pass()) {}
+ video_frame_factory_(
+ video_sender.get() ?
+ video_sender->CreateVideoFrameFactory().release() : nullptr) {}
void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
const base::TimeTicks& capture_time) override {
@@ -35,13 +36,14 @@ class LocalVideoFrameInput : public VideoFrameInput {
capture_time));
}
- scoped_refptr<VideoFrame> CreateOptimizedFrame(
+ scoped_refptr<VideoFrame> MaybeCreateOptimizedFrame(
+ const gfx::Size& frame_size,
base::TimeDelta timestamp) override {
- DCHECK(video_frame_factory_.get());
- return video_frame_factory_->CreateFrame(timestamp);
+ return video_frame_factory_ ?
+ video_frame_factory_->MaybeCreateFrame(frame_size, timestamp) : nullptr;
}
- bool SupportsCreateOptimizedFrame() const override {
+ bool CanCreateOptimizedFrames() const override {
return video_frame_factory_.get() != nullptr;
}
@@ -51,9 +53,9 @@ class LocalVideoFrameInput : public VideoFrameInput {
private:
friend class base::RefCountedThreadSafe<LocalVideoFrameInput>;
- scoped_refptr<CastEnvironment> cast_environment_;
- base::WeakPtr<VideoSender> video_sender_;
- scoped_ptr<VideoFrameFactory> video_frame_factory_;
+ const scoped_refptr<CastEnvironment> cast_environment_;
+ const base::WeakPtr<VideoSender> video_sender_;
+ const scoped_ptr<VideoFrameFactory> video_frame_factory_;
DISALLOW_COPY_AND_ASSIGN(LocalVideoFrameInput);
};
@@ -194,8 +196,7 @@ void CastSenderImpl::OnVideoStatusChange(
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
if (status == STATUS_INITIALIZED && !video_frame_input_) {
video_frame_input_ =
- new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr(),
- video_sender_->CreateVideoFrameFactory());
+ new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
}
status_change_cb.Run(status);
}
« no previous file with comments | « media/cast/cast_sender.h ('k') | media/cast/cast_testing.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698