Skip to content

Commit

Permalink
add video and audio stream IDs for getStats().switchHistory (#846)
Browse files Browse the repository at this point in the history
Closes #785, #823
  • Loading branch information
russitto authored and joeyparrish committed Jun 5, 2017
1 parent 5f33c11 commit ace0e8c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Jonas Birmé <jonas.birme@eyevinn.se>
Jono Ward <jonoward@gmail.com>
Jozef Chúťka <jozefchutka@gmail.com>
Lucas Gabriel Sánchez <unkiwii@gmail.com>
Matias Russitto <russitto@gmail.com>
Mattias Wadman <mattias.wadman@gmail.com>
Natalie Harris <natalieharris@google.com>
Nick Desaulniers <nick@mozilla.com>
Expand Down
8 changes: 7 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ shakaExtern.Stats;
* audioCodec: ?string,
* videoCodec: ?string,
* primary: boolean,
* roles: !Array.<string>
* roles: !Array.<string>,
* videoId: ?number,
* audioId: ?number
* }}
*
* @description
Expand Down Expand Up @@ -190,6 +192,10 @@ shakaExtern.Stats;
* cannot be satisfied.
* @property {!Array.<string>} roles
* The roles of the track, e.g. 'main', 'caption', or 'commentary'.
* @property {?number} videoId
* (only for variant tracks) The video stream id.
* @property {?number} audioId
* (only for variant tracks) The audio stream id.
* @exportDoc
*/
shakaExtern.Track;
Expand Down
4 changes: 3 additions & 1 deletion lib/util/stream_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ shaka.util.StreamUtils.getVariantTracks =
audioCodec: audioCodec,
videoCodec: videoCodec,
primary: variant.primary,
roles: roles
roles: roles,
videoId: variant.video ? variant.video.id : null,
audioId: variant.audio ? variant.audio.id : null
};
});

Expand Down
4 changes: 3 additions & 1 deletion test/offline/storage_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ describe('Storage', function() {
codecs: 'avc1.4d401f, vorbis',
audioCodec: 'vorbis',
videoCodec: 'avc1.4d401f',
roles: []
roles: [],
videoId: 0,
audioId: 1
}
];
Promise
Expand Down
20 changes: 15 additions & 5 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 4,
audioId: 1
},
{
id: 2,
Expand All @@ -915,7 +917,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 1
},
{
id: 3,
Expand All @@ -933,7 +937,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 4,
audioId: 2
},
{
id: 4,
Expand All @@ -951,7 +957,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 2
},
{
id: 5,
Expand All @@ -969,7 +977,9 @@ describe('Player', function() {
audioCodec: 'mp4a.40.2',
videoCodec: 'avc1.4d401f',
primary: false,
roles: []
roles: [],
videoId: 5,
audioId: 8
}
];

Expand Down

0 comments on commit ace0e8c

Please sign in to comment.