Skip to content

Commit

Permalink
[player] Refine VideoDmpReader::video_stream_info()
Browse files Browse the repository at this point in the history
It tried to return the stream info of the first video access unit, and
may crash when VideoDmpReader is working under read on demand mode.

Now `EnsureSampleLoaded(0)` is called before accessing the first video
access unit.

b/271618424

Change-Id: Ia097881daced821b0dba5df6773cbfe6abe3e34f
NOKEYCHECK=True
GitOrigin-RevId: 876612fa799700d6c2de7b842261dbd26b236246
  • Loading branch information
xiaomings authored and andrewsavage1 committed Mar 23, 2023
1 parent 9c5817a commit 7a5f65c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion starboard/shared/starboard/player/video_dmp_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ class VideoDmpReader {
const media::AudioStreamInfo& audio_stream_info() const {
return dmp_info_.audio_sample_info.stream_info;
}
const media::VideoStreamInfo& video_stream_info() const {
const media::VideoStreamInfo& video_stream_info() {
EnsureSampleLoaded(kSbMediaTypeVideo, 0);
SB_DCHECK(!video_access_units_.empty());
return video_access_units_[0].video_sample_info().stream_info;
}
Expand Down

0 comments on commit 7a5f65c

Please sign in to comment.