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

Unified Diff: content/renderer/media/video_track_adapter.cc

Issue 955253002: Add metadata to media::VideoFrame and plumb it through IPC/MediaStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi's nits addressed 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
Index: content/renderer/media/video_track_adapter.cc
diff --git a/content/renderer/media/video_track_adapter.cc b/content/renderer/media/video_track_adapter.cc
index 855cf7674a643b902360a19f04d674c094f64236..d56e8d4f036b78c2b9f65576788402f83b5d6e16 100644
--- a/content/renderer/media/video_track_adapter.cc
+++ b/content/renderer/media/video_track_adapter.cc
@@ -76,7 +76,6 @@ class VideoTrackAdapter::VideoFrameResolutionAdapter
void RemoveCallback(const MediaStreamVideoTrack* track);
void DeliverFrame(const scoped_refptr<media::VideoFrame>& frame,
- const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time);
// Returns true if all arguments match with the output of this adapter.
@@ -93,7 +92,6 @@ class VideoTrackAdapter::VideoFrameResolutionAdapter
virtual void DoDeliverFrame(
const scoped_refptr<media::VideoFrame>& frame,
- const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time);
// Returns |true| if the input frame rate is higher that the requested max
@@ -174,17 +172,21 @@ VideoFrameResolutionAdapter::~VideoFrameResolutionAdapter() {
void VideoTrackAdapter::VideoFrameResolutionAdapter::DeliverFrame(
const scoped_refptr<media::VideoFrame>& frame,
- const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time) {
DCHECK(io_thread_checker_.CalledOnValidThread());
- if (MaybeDropFrame(frame, format.frame_rate))
+ double frame_rate;
+ if (!frame->metadata()->GetDouble(media::VideoFrameMetadata::FRAME_RATE,
+ &frame_rate)) {
+ frame_rate = MediaStreamVideoSource::kUnknownFrameRate;
+ }
+ if (MaybeDropFrame(frame, frame_rate))
return;
// TODO(perkj): Allow cropping / scaling of textures once
// http://crbug/362521 is fixed.
if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) {
- DoDeliverFrame(frame, format, estimated_capture_time);
+ DoDeliverFrame(frame, estimated_capture_time);
return;
}
scoped_refptr<media::VideoFrame> video_frame(frame);
@@ -246,7 +248,7 @@ void VideoTrackAdapter::VideoFrameResolutionAdapter::DeliverFrame(
<< " output visible rect "
<< video_frame->visible_rect().ToString();
}
- DoDeliverFrame(video_frame, format, estimated_capture_time);
+ DoDeliverFrame(video_frame, estimated_capture_time);
}
bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
@@ -311,13 +313,10 @@ bool VideoTrackAdapter::VideoFrameResolutionAdapter::MaybeDropFrame(
void VideoTrackAdapter::
VideoFrameResolutionAdapter::DoDeliverFrame(
const scoped_refptr<media::VideoFrame>& frame,
- const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time) {
DCHECK(io_thread_checker_.CalledOnValidThread());
- for (std::vector<VideoIdCallbackPair>::const_iterator it = callbacks_.begin();
- it != callbacks_.end(); ++it) {
- it->second.Run(frame, format, estimated_capture_time);
- }
+ for (const auto& entry : callbacks_)
+ entry.second.Run(frame, estimated_capture_time);
}
void VideoTrackAdapter::VideoFrameResolutionAdapter::AddCallback(
@@ -494,15 +493,12 @@ void VideoTrackAdapter::RemoveTrackOnIO(const MediaStreamVideoTrack* track) {
void VideoTrackAdapter::DeliverFrameOnIO(
const scoped_refptr<media::VideoFrame>& frame,
- const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time) {
DCHECK(io_message_loop_->BelongsToCurrentThread());
TRACE_EVENT0("video", "VideoTrackAdapter::DeliverFrameOnIO");
++frame_counter_;
- for (FrameAdapters::iterator it = adapters_.begin();
- it != adapters_.end(); ++it) {
- (*it)->DeliverFrame(frame, format, estimated_capture_time);
- }
+ for (const auto& adapter : adapters_)
+ adapter->DeliverFrame(frame, estimated_capture_time);
}
void VideoTrackAdapter::CheckFramesReceivedOnIO(
« no previous file with comments | « content/renderer/media/video_track_adapter.h ('k') | content/renderer/media/webrtc/media_stream_remote_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698