From 27abb208aa4fe59745dd98cde61c94cd5e7ffdd2 Mon Sep 17 00:00:00 2001 From: Haoming Chen Date: Tue, 16 May 2017 09:59:52 -0700 Subject: [PATCH] Remove the trick_play_factor in media_info.proto. - Use the playback_rate instead. Change-Id: I341c39de1c28aacebab5b31aa013bcbbcc2fa9d0 --- packager/media/base/video_stream_info.h | 3 ++- packager/media/event/muxer_listener_internal.cc | 5 +---- packager/mpd/base/dash_iop_mpd_notifier.cc | 4 ++-- packager/mpd/base/dash_iop_mpd_notifier_unittest.cc | 1 - packager/mpd/base/media_info.proto | 5 +---- packager/mpd/base/mpd_utils.cc | 3 +-- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/packager/media/base/video_stream_info.h b/packager/media/base/video_stream_info.h index 59609c7ff6..2b6f564b0c 100644 --- a/packager/media/base/video_stream_info.h +++ b/packager/media/base/video_stream_info.h @@ -102,7 +102,8 @@ class VideoStreamInfo : public StreamInfo { // example, if the video stream has GOP size of 10 and the trick play factor // is 3, the key frames are in this trick play stream are [frame_0, frame_30, // frame_60, ...]. Then the playback_rate is 30. - uint32_t playback_rate_; + // Non-zero for trick-play streams. + uint32_t playback_rate_ = 0; // Specifies the size of the NAL unit length field. Can be 1, 2 or 4 bytes, or // 0 if the stream is not a NAL structured video stream or if it is an AnnexB diff --git a/packager/media/event/muxer_listener_internal.cc b/packager/media/event/muxer_listener_internal.cc index fb2283c62d..b36baa1c78 100644 --- a/packager/media/event/muxer_listener_internal.cc +++ b/packager/media/event/muxer_listener_internal.cc @@ -102,10 +102,7 @@ void AddVideoInfo(const VideoStreamInfo* video_stream_info, video_info->set_decoder_config(&codec_config[0], codec_config.size()); } - if (video_stream_info->trick_play_factor() > 0) { - video_info->set_trick_play_factor(video_stream_info->trick_play_factor()); - CHECK_GT(video_stream_info->playback_rate(), 0u) - << "Max playout rate should be > 0 for trick play streams."; + if (video_stream_info->playback_rate() > 0) { video_info->set_playback_rate(video_stream_info->playback_rate()); } } diff --git a/packager/mpd/base/dash_iop_mpd_notifier.cc b/packager/mpd/base/dash_iop_mpd_notifier.cc index 06474d7152..c28df2070f 100644 --- a/packager/mpd/base/dash_iop_mpd_notifier.cc +++ b/packager/mpd/base/dash_iop_mpd_notifier.cc @@ -276,7 +276,7 @@ AdaptationSet* DashIopMpdNotifier::NewAdaptationSet( new_adaptation_set->AddRole(AdaptationSet::kRoleMain); } - if (media_info.video_info().trick_play_factor() > 0) { + if (media_info.video_info().has_playback_rate()) { uint32_t trick_play_reference_id = 0; if (!FindOriginalAdaptationSetForTrickPlay(media_info, &trick_play_reference_id)) { @@ -294,7 +294,7 @@ bool DashIopMpdNotifier::FindOriginalAdaptationSetForTrickPlay( const MediaInfo& media_info, uint32_t* main_adaptation_set_id) { MediaInfo media_info_no_trickplay = media_info; - media_info_no_trickplay.mutable_video_info()->clear_trick_play_factor(); + media_info_no_trickplay.mutable_video_info()->clear_playback_rate(); std::string key = GetAdaptationSetKey(media_info_no_trickplay); const std::list& adaptation_sets = adaptation_set_list_map_[key]; diff --git a/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc b/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc index 1087b6f924..1122498d6f 100644 --- a/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc +++ b/packager/mpd/base/dash_iop_mpd_notifier_unittest.cc @@ -167,7 +167,6 @@ TEST_F(DashIopMpdNotifierTest, NotifyNewContainerForTrickPlay) { " frame_duration: 100\n" " pixel_width: 1\n" " pixel_height: 1\n" - " trick_play_factor: 2\n" " playback_rate: 10\n" "}\n" "container_type: 1\n"; diff --git a/packager/mpd/base/media_info.proto b/packager/mpd/base/media_info.proto index 988264a83c..968278518c 100644 --- a/packager/mpd/base/media_info.proto +++ b/packager/mpd/base/media_info.proto @@ -41,12 +41,9 @@ message MediaInfo { optional uint32 pixel_width = 7; optional uint32 pixel_height = 8; - // trick_play_factor: sample rate of the key frame from the original stream. - // e.g., 1 means every key frame, 2 means every two key frames. - optional uint32 trick_play_factor = 9; // playback_rate: the playout capability (e.g., 4x, 8x, 16x fast foward) of // the trick play stream. - optional uint32 playback_rate = 10; + optional uint32 playback_rate = 9; } message AudioInfo { diff --git a/packager/mpd/base/mpd_utils.cc b/packager/mpd/base/mpd_utils.cc index cf9d2eb283..47ef3e1929 100644 --- a/packager/mpd/base/mpd_utils.cc +++ b/packager/mpd/base/mpd_utils.cc @@ -138,8 +138,7 @@ std::string GetAdaptationSetKey(const MediaInfo& media_info) { // Trick play streams of the same original stream, but possibly with // different trick_play_factors, belong to the same trick play AdaptationSet. - if (media_info.has_video_info() && - media_info.video_info().trick_play_factor() > 0) { + if (media_info.video_info().has_playback_rate()) { key.append(":trick_play"); }